alpacon token acl command

Manage command ACL rules for a token.

Usage

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

Key facts

  • Use ls to inspect the token’s command rules.
  • Use add or delete to change the rules.
  • Without a matching rule, remote commands are denied.

Flags

FlagTypeDescriptionDefault
-h, --helpboolhelp for commandfalse
--outputstringOutput format: table or jsontable

Examples

List command rules

bash
alpacon token acl command ls my-api-token

Allow an exact command

bash
alpacon token acl command add my-api-token --command="whoami"

Allow command arguments

bash
alpacon token acl command add my-api-token --command="systemctl status *"

Include sudo in a privileged command rule

bash
alpacon token acl command add my-api-token --command="sudo systemctl restart nginx"
Note

If add or delete returns command_acl_moved, ask a Command ACL admin to manage the service token’s pre-approved commands in the web console or with alpacon acl entry. Retrying doesn’t help. On these servers, personal API tokens have no command list. ls remains available.

Wildcard patterns

Use a standalone trailing * to match additional arguments within the limits in Token command matching.

ACL ruleMatchesDoes not match
whoamiwhoami (exact)whoami --help
echo *echo "hello", echo foo barecho (no arguments)
systemctl status *systemctl status nginx, systemctl status appsystemctl restart nginx
docker compose *docker compose up -d, docker compose psdocker run nginx
sudo systemctl restart nginxsudo systemctl restart nginxsystemctl restart nginx, sudo -n systemctl restart nginx

A trailing * requires at least one argument, so allow the bare form with a second rule. Any other * stays inside one word: deploy-* allows deploy-web but not deploy-web --force. A command line with a redirection (>, <, 2>&1, and similar) is rejected whatever the rules say; see How a command rule is matched.

Rules are matched against the command line you submit, not the command that runs as root, which means a rule for a privileged command must include the sudo prefix. Sudo policies use the opposite convention.

Warning

Never add a sudo * rule. A standalone trailing * matches the remaining literal arguments, so it also allows sudo bash -c "rm -rf /". See Command patterns and sudo.

Last updated: