alpacon token acl

acl 명령어를 사용하면 API 토큰에 대한 액세스 제어를 구성하여 각 토큰에서 실행할 수 있는 명령을 지정할 수 있습니다. 보안 요구 사항에 따라 명령 실행 권한을 세밀하게 조정하기 위해 ACL 규칙을 생성, 나열 및 수정할 수 있습니다.

alpacon token acl [flags]
alpacon token acl [command]

옵션 (Options)

  -h, --help   acl 명령어에 대한 도움말 출력

ACL 동작 방식

토큰 ACL은 명령을 직접 전달할 때(예: alpacon websh my-server "command") 또는 exec를 통해 원격 서버에서 실행할 수 있는 쉘 명령을 제어합니다. 각 ACL 규칙은 토큰이 실행할 수 있는 명령 패턴을 지정합니다. 대화형 websh 세션은 명령 ACL의 제한을 받지 않습니다.

# Allow a specific command (exact match)
alpacon token acl add --token=my-token --command="whoami"
 
# Allow a command with any arguments (wildcard)
alpacon token acl add --token=my-token --command="systemctl status *"
 
# Allow npm with any subcommand and arguments
alpacon token acl add --token=my-token --command="npm *"

예를 들어 alpacon websh my-server "pm2 restart app"을 실행하려면, 토큰에 pm2 restart *에 대한 ACL 규칙이 필요합니다.

와일드카드 패턴

*를 와일드카드로 사용하여 임의의 인수를 매칭할 수 있습니다:

ACL 규칙매칭됨매칭 안 됨
whoamiwhoami (정확히 일치)whoami --help
echo *echo "hello", echo foo bar
systemctl status *systemctl status nginx, systemctl status appsystemctl restart nginx
docker compose *docker compose up -d, docker compose psdocker run nginx

와일드카드 없이는 정확한 명령 문자열만 매칭됩니다. 가변 인수를 허용하려면 *를 추가하세요.

예제

토큰의 모든 ACL 나열:

alpacon token acl ls my-token

새 ACL 규칙 추가:

alpacon token acl add --token=my-token --command="systemctl restart *"

ACL 규칙 삭제:

alpacon token acl delete 42

관련 명령어