alpacon token acl command
API 토큰의 명령어 ACL 규칙을 관리합니다. 토큰이 alpacon exec 또는 비대화형 alpacon websh SERVER "command"를 통해 실행할 수 있는 서버 측 셸 명령어를 설정합니다.
기본 거부: 토큰에 명령어 ACL이 없으면 모든 원격 명령어 실행이 거부됩니다.
alpacon token acl command [flags]
alpacon token acl command [command]
옵션 (Options)
-h, --help help for command
와일드카드 패턴
*를 와일드카드로 사용하여 임의의 인수를 매칭할 수 있습니다:
| ACL 규칙 | 매칭됨 | 매칭 안 됨 |
|---|---|---|
whoami | whoami (정확히 일치) | whoami --help |
echo * | echo "hello", echo foo bar | echo (인자 없음) |
systemctl status * | systemctl status nginx, systemctl status app | systemctl restart nginx |
docker compose * | docker compose up -d, docker compose ps | docker run nginx |
sudo systemctl restart nginx | sudo systemctl restart nginx | systemctl restart nginx, sudo -n systemctl restart nginx |
끝의 *는 인자를 최소 1개 요구하므로, 인자 없는 형태도 허용하려면 규칙을 하나 더 등록하세요.
규칙은 root로 실행될 명령이 아니라 제출한 명령줄과 비교되므로, 권한이 필요한 명령의 규칙에는 sudo 접두어가 포함되어야 합니다. sudo 정책은 정반대 규약을 씁니다.
sudo * 규칙은 절대 추가하지 마세요. 와일드카드는 따옴표를 넘어 매칭되므로 sudo bash -c "rm -rf /"도 허용됩니다. 명령 패턴과 sudo를 참고하세요.
예제
# allow exact command only
alpacon token acl command add my-api-token --command="whoami"
# allow any arguments with wildcard
alpacon token acl command add my-api-token --command="systemctl status *"
# privileged command: the sudo prefix is part of the rule
alpacon token acl command add my-api-token --command="sudo systemctl restart nginx"
# list command ACL rules
alpacon token acl command ls my-api-token