Access rules
Use Access rules to decide what happens when someone opens a session, uses sudo or runs a command. For the underlying model, read How access is decided; for exact defaults and plan requirements, use the reference.
Open Access rules
Open Policies → Access rules in the console. The page is available on every deployment to workspace admins with approval_policy:read; a Superuser always has access. Other members do not see the rule list or its navigation entry.
Creating, editing and deleting approval rules require the corresponding approval_policy permissions. Standing sudo policies use the corresponding sudo_policy permissions. A control can therefore be visible without being editable. The sudo settings also depend on workspace permissions and the deployment’s MFA capabilities; see Server access.
Read the overview and action tabs
Start with Overview and choose a server group. Select a cell to see what decides that actor’s action. Check servers without a group too: a group rule cannot match them.
| Tab | Use it for |
|---|---|
| Opening a session | Session admission, including who requests it, who it is for and the account it will use. |
| Using sudo | Privilege elevation. Choose the location under Where sudo runs. |
| Running a command | Submitted commands from the CLI, agents and API. |
On the sudo tab, Web terminal lists standing sudo policies with Allow after MFA when the workspace supports an additional MFA check. The CLI and API surface has approval rules that allow, request approval or block. Follow the section notice: The rules under Commands decide sudo here too. means the sudo rules under CLI and API also decide web-terminal sudo. Use Try it to check the selected surface.
Add or edit a rule
- Select the action tab and, for sudo, the surface. Select New rule, or open an existing workspace rule.
- Select the underlined parts of the rule sentence. Set who it covers, where it applies and the outcome. Rated command and sudo rules can also name an AI rating. Session admission has no command rating.
- If approval is required, select the approver count and routing offered by your plan. Select Not by the person who asked when the requester must not decide their own request.
- Under More options, give the rule a meaningful name and an optional future end date. With no end date, it keeps applying until disabled or deleted.
- Use Try this rule to check the draft, then select Save rule. A preview does not save the rule.
The fields vary by action. Standing terminal policies name people, specific servers and command patterns. Approval rules use requester classes or roles and server groups. Existing conditions without an editor field are preserved when you save; they are not new editable controls. See Conditions by action.
Put rules in evaluation order
For an orderable approval-rule list, drag a workspace rule into position, or focus its reorder control and use Alt+↑ or Alt+↓. The first matching active rule decides within that list. Put a narrow exception above a broader rule when it should win.
Workspace approval rules are considered before built-in defaults. Disabled and expired rules do not decide. Built-in checks and standing sudo policies do not all belong to the same reorderable list; use the displayed decision path to see where they apply. Reordering cannot bypass a failed scope or account check.
Test a draft with Try it
Open Try it from the selected action, or use the draft preview in the editor. Choose the person, agent or service token, the target server or group, and a command where applicable. For a rated action, supply a rating or leave it unspecified to compare outcomes across ratings.
Read the outcome, deciding rule, approvers and MFA requirement. Inspect the decision path for a rule that did not match. Test both a matching case and a case just outside the intended scope, including a server without a group.
The preview evaluates the rules using the rating you supply. It does not ask AI to rate the command, execute it, create an approval request or grant access. It does not certify token command or file pre-approval. Test those separately in the token’s access rules.
Recipe: require approval for an agent on production servers
Agent sessions already require a person by default. Use this recipe to preserve that requirement on servers in your production group when a broader rule explicitly allows agent sessions automatically. Place this rule above that broader Allow rule.
- Open Opening a session and select New rule.
- Choose AI agents and the
productionserver group. Keep the agent-name condition empty if the rule should cover all agents. - Set the outcome to Ask for approval with one approver. Enable Not by the person who asked if your policy requires a different person.
- Preview an agent on a production server. Confirm that an eligible approver is shown. Also test a person, an agent outside that group and an ungrouped server.
- Save and place the rule above any broader rule that would admit those agents automatically.
This governs opening the session. To require review of each submitted command too, add a matching approval rule on Running a command and test that action separately.
Recipe: allow a role within a sudo risk band
Use this recipe to pre-authorize people with your operator global role for sudo up to High on servers in the staging group. People are already allowed up to Medium at the default risk check; High normally requires approval.
- Open Using sudo and choose CLI and API.
- Create a rule, choose People with a role, and select the
operatorrole andstaginggroup. - Set the rating up to High and choose Allow.
- Preview a person with that role on a staging server at High: the risk rule should allow it. At Critical, it must not allow automatic sudo. Also test a person without the role and a server outside the group; without another matching rule, High requires approval.
- Save the rule in the intended order. Confirm that cases outside it reach the appropriate later rule or default.
The role condition here describes the person the session is for. It is not membership in a user group. Even when the risk decision allows sudo, the session still needs sudo scope and the person still needs recent MFA. Follow the Web terminal section notice: if it says The rules under Commands decide sudo here too., the sudo rules under CLI and API, including this rule, also decide web-terminal sudo. Loosening it therefore loosens web-terminal sudo too. Standing authority checks still apply.
Use this recipe for a named person who needs one known maintenance command on selected servers. The after-MFA outcome appears only when the workspace can ask the person to complete an additional MFA verification.
- Open Using sudo, choose Web terminal, and select New rule.
- Select the person and specific servers. Set a narrow command pattern, such as
systemctl restart postgresql. Check sudo command patterns before using wildcards. - Keep the offered outcome, Allow after MFA. Set an end date if the authorization is temporary.
- Preview that person, server and command. Compare a different person, server and command, and check any scope, risk or MFA restriction in the result.
- Save, then use a work session that includes sudo. The person completes MFA when requested.
This creates standing authorization for the commands it covers; it does not remove MFA. For authority that ends with one work session, request a session-bound sudo policy instead. Such a policy can let the session approval cover MFA and is deactivated when the session ends. See sudo with MFA.
Recipe: restrict one application’s service-token execution
Use the application’s own token controls to limit a deployment job. The Access rules editor does not offer an application or token picker for authoring a new risk rule.
- Open the application under IAM and select Tokens. Open the approved token used by the job.
- In Access rules, apply any prepared rules and restrict the allowed servers and file operations. On a self-hosted deployment, configure command access rules there too.
- On Alpacon Cloud, use Pre-approved commands on the same tab to pre-approve only the required commands. This requires membership in Command ACL admins, including for Superusers. Follow Allow commands with a service token.
- Return to Try it and select the concrete service token for the sudo/command case. Test a grouped server and an ungrouped server, and compare ratings. This checks the risk decision separately from the token’s access rules.
- Check the token’s allowed server and command entries independently before running the job. Confirm an out-of-scope server or command is not pre-approved.
An existing application-specific risk rule can still affect this result. Such a restriction must match the named application or token; adding a server-group condition limits it to that group. A group-only restriction leaves ungrouped servers to the defaults. A command without a work session never waits for approval. Under enforce, no risk rule can auto-approve CRITICAL token execution, and a CRITICAL command without a work session is refused. On Alpacon Cloud under enforce, such a command matching a pre-approved ledger entry is still refused at the critical ceiling. Advisory automatically approves token execution at the risk check, including at the critical ceiling. On Alpacon Cloud, a matching pre-approved ledger entry remains required in either mode. See Service-token execution rules.
Check the saved result
Reopen the saved rule and repeat the preview using the actual subject and target. Check the rule order, its enabled state, expiry, deployment notices and workspace posture. A result shown under advisory is not proof that the action would run under enforce.
After a real attempt, check Commands, Privilege elevation or pending requests, as appropriate. The sudo record shows how access was granted. Confirm the current request state; a rejected, withdrawn or expired approval request is no longer waiting. Use the error-code guide to choose the next action.