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
lsto inspect the token’s command rules. - Use
addordeleteto change the rules. - Without a matching rule, remote commands are denied.
Flags
| Flag | Type | Description | Default |
|---|---|---|---|
-h, --help | bool | help for command | false |
--output | string | Output format: table or json | table |
Examples
List command rules
alpacon token acl command ls my-api-tokenAllow an exact command
alpacon token acl command add my-api-token --command="whoami"Allow command arguments
alpacon token acl command add my-api-token --command="systemctl status *"Include sudo in a privileged command rule
alpacon token acl command add my-api-token --command="sudo systemctl restart nginx"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 rule | Matches | Does not match |
|---|---|---|
whoami | whoami (exact) | whoami --help |
echo * | echo "hello", echo foo bar | echo (no arguments) |
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 |
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.
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.