Administer
Command policies and reviews
A command policy looks at each command line, SQL statement or Kubernetes request before it reaches the target, and decides what happens to it.
A policy#
In Console → Access control → Command policies:
| Part | Meaning |
|---|---|
| Action | deny: never reaches the target. alert: runs, and the audit marks it. let through: runs, and evaluation stops (an exception placed before broader policies). have reviewed: waits for a reviewer (SSH only) |
| Match | exact (the command or one of its parts equals the pattern), contains, or regex (RE2, linear time) |
| Patterns | 1 to 50, such as reboot, rm -rf, ^DROP\s+TABLE |
| Ignore case | on by default |
| Protocols | ssh, postgresql, mysql, redis, mongodb, sqlserver, kubernetes, or all |
| Who | users and groups; none means every member |
| What | folders, assets, accounts; none means every account |
| Priority | 1 to 1,000. Policies are tried lowest first: the first that matches decides |

What a pattern is compared with#
Whitespace is collapsed. A shell line is compared as a whole, then each simple command in it: the line is split at ;, &&, ||, |, &, parentheses, `…` and $(…), outside quotes. Each part is also read past what usually comes before a program: sudo, env, nohup, timeout, xargs, variable assignments, the program's directory.
| Policy | Matches | Does not match |
|---|---|---|
exact reboot |
reboot, ls; reboot, sudo -u root reboot, /sbin/reboot, echo $(reboot) |
echo reboot, rebooted |
regex ^rm\s+-rf\s+/ |
rm -rf /var, cd /; rm -rf /tmp/x, nohup rm -rf / & |
rm -r -f / |
contains curl |
any line with curl in it |
For SQL, the text is read as the database reads it: comments removed, split at ; outside literals. For Kubernetes, a request reads as delete deployments.apps/web -n prod, and the command of an exec is also read as a shell line, so a policy that refuses rm -rf over SSH refuses it in a pod too.
On SSH#
- A command sent with
ssh host 'command',scp,rsyncor Ansible is checked before it is sent. Refused, it never reaches the server; the client gets the policy's name on stderr and exit status 126. - At a terminal, the gateway checks the line when Enter is pressed. Refused, Enter is not sent, the line is cleared on the server, and the user sees the policy's name.
- A policy change applies to connections opened afterwards.
Command reviews#
A have reviewed policy holds the SSH commands it matches. It names its reviewers (users and groups) and how long a command may wait, 1 to 30 minutes (5 by default).
- The user's terminal says the command waits for a review.
- Reviewers see it in Workspace → Commands to review, with who typed it, where and why it was held.
- One approval lets it run, and the user sees who approved it. A refusal needs a comment, which the user sees. Not decided in time, it is refused.
Nobody reviews their own command, nor one typed in a session shared with them.
Simulation#
The policies page simulates a command for a user and an account, and shows which policy would decide, without running anything. A disabled policy can be simulated before it is turned on.