Sandbox policy on managed computers
Set the organization floor and profile keys that decide what a person's sandbox may do on a managed computer, with packs, asks and saved decisions.
openshell.admin is the organization floor, the loosest anyone gets. guardrail.profiles.<name>.sandbox is a profile overlay with the same keys that can only tighten the floor. The same profile_assignments and default_profile that choose the guardrail profile choose it. The one key that replaces instead of tightens is request_access.
To install OpenShell and turn sandboxes on, see Sandboxes on managed computers.
guardrail:
profiles:
contractors:
description: Contractors. Coding agents only in a sandbox.
mode: action
sandbox:
required_for: [claudecode, codex]
when_unavailable: refuse
allowed_harnesses: [claudecode, codex]
egress_allow_only: [api.anthropic.com, "*.amazonaws.com", github.com]
allow_mount: false
user_approvals: session
allowed_credentials: [bedrock]
delete_stopped_after: 14d
profile_assignments:
- profile: contractors
match: {groups: ["contractors@corp.example.com"]}
default_profile: contractorsThe keys and how they combine
The first table lists the keys under openshell.admin that exist for every OpenShell install. The second lists the keys added for managed sandboxes. A profile overlay can use all of them.
| Key | How a profile tightens the floor | Applies |
|---|---|---|
required_pack, required_pack_digest | The profile's pack must be at least as strict as the floor's pack in every setting, and sit in the policies folder | At create |
min_profile | The stricter profile wins | At create |
allow_yolo, allow_host_ports, allow_learn_mode | false wins | At create (learn mode: live) |
allow_mount, require_copy_for | false wins; the lists are joined | At create |
allowed_harnesses | Intersection | At create |
egress_block, egress_allow_only, block_large_uploads (Preview) | Block lists are joined, allow-only lists intersect, true wins | Live |
allow_unblock | false wins | Live |
max_resources | The minimum | At create |
locked | The lists are joined | At create |
| Managed key | Type | Meaning | How a profile tightens the floor | Applies |
|---|---|---|---|---|
allowed | bool | May this person use sandboxes at all | false wins | At create |
required_for | connector names | Agents that must run in a sandbox on this computer, for example claudecode, codex, cursor, copilot (Require sandboxes) | Union | Host hooks |
when_unavailable | refuse, alert | What a required agent gets where sandboxes cannot run. Default refuse. | refuse wins; alert needs the floor and the profile to both say alert | Host hooks |
user_approvals | none, session | What the person may approve (Asks and saved decisions) | The stricter wins | Live |
allowed_credentials | provider names, or [none] | Which model credentials may enter a sandbox | Intersection. none stands alone. | At create |
on_silence | stop, alert | The response when a user-tier agent works without its hooks | stop wins | Live |
max_silence_after | duration, 1m or more | How long a user-tier agent may work without hooks | The minimum | Live |
process_tree | bool | Sample the sandbox's process tree | true wins | Live |
foreign_sandboxes | stop, alert | What to do with a sandbox DefenseClaw did not start. Default on a managed host: stop. | stop wins | Live |
allow_upstream_telemetry | bool | Let OpenShell send its own usage telemetry. Off on a managed host unless set. | false wins | At create |
delete_stopped_after | duration or Nd, 1h or more | Delete a sandbox that has been stopped, or has completed, this long; one in the error phase is left to its owner | The minimum | Live |
request_access | text, up to 512 bytes | Who the person contacts for an exception. Falls back to "contact your IT help desk" when empty. | A profile value replaces the floor's | Live |
driver_fallback | docker or none | none refuses a Linux sandbox that wants the MicroVM driver where KVM is not available (The docker fallback) | none wins; docker never loosens it | At the next sandbox start |
runtimes | openshell, substrate | Where the person's agents may run. Left out: both. With required_for, [substrate] refuses the host run and a sandbox on this computer, and points to defenseclaw substrate run (Agent Substrate) | Intersection | Host hooks, at create |
- Unset means no constraint. An unset key adds no constraint, and a list left out is "no constraint". An empty list is refused by the schema; to allow no credentials, write
allowed_credentials: [none]. - Upstream telemetry. An account whose profile has
allow_upstream_telemetry: falsehas OpenShell's own telemetry off at its gateway, even if the host's renderedgateway.envallows it. - Agent Substrate keys.
sandbox_class,idle_suspend_after,idle_suspend_tasks,unattended_asks,ask_timeout,actor_secrets,ask_hosts,url_rulesandgit_pushare refused inopenshell.admin. In a profile they apply to Agent Substrate actors only.
Combinations that ensure refuses
A combination that cannot be satisfied is an error when the config loads. config validate and ensure refuse it and keep the previous config:
allowed: falsetogether withrequired_for.- Two
allowed_harnesseslists with nothing in common, or arequired_foragent outsideallowed_harnesses. - An
egress_allow_onlythat leaves no destination once the floor is applied. allowed_credentials: [none]together with other providers.- An unknown
required_forconnector. - A pack outside
<policy_dir>/sandbox/, or looser than the floor's.
Packs
Custom packs for managed hosts live under the policies folder in sandbox/<name>/; a required_pack outside it is refused. See Sandbox policy packs for the pack format.
- Strictness. A profile's
required_packmust be at least as strict as the floor's (with no floor pack, as the default pack:openshell.pack, elsebalanced) in network and approvals modes, workspace, MCP,hooks.fail_mode,on_tamper,on_silence,silence_afterand the egress lists. It must match itsrequired_pack_digestwhen it has one.ensureand the config load refuse anything else and keep the previous config, and every create checks again and fails closed. - Default pack. A run whose profile names no pack gets the default pack (
openshell.pack, elsebalanced; neveropen). - Copy only. A pack that sets or inherits
workspace.mode: mount(a pack that extendsbalancedinherits it) is refused as looser than the default pack. That includes anopenshell.packthatopenshell.admin.locked: [pack]makes the required pack of every sandbox. Setworkspace.mode: copyin the pack. sandbox run --packunder a required pack takes a pack at least as strict in every setting and refuses a looser one, naming the profile and the setting it loosens.extendshelps you write a pack and guarantees nothing.- Folder rules. The packs folder must be owned by
root:defenseclaw(macOSroot:_defenseclaw) with mode 0750. Everyensurerefuses one that other accounts can read, andverifyfails on it.ensureandverifywarn, field by field, wheredefault_profileis looser than an assigned profile, and name a custom pack without a digest. - Pin it everywhere. If you pin a pack for one profile with
required_packandrequired_pack_digest, pin it fordefault_profiletoo.enterprise <os> sandbox pack-digest FILEprints the digest.
Editing a pack
| Change | What happens |
|---|---|
A pack edited in place, config.yaml unchanged | The next ensure applies it: it records the next config_generation and restarts the gateway. policy.applied reads true once the gateway reports the new digest. |
| An edit that no longer loads | ensure fails with config_refused and the reason (also with --config of the config already applied), reports noop with noop_reason policy_refused, records no config_generation, and leaves the gateway running the last good pack. |
A new config.yaml that names a required pack that does not load | It fails validation; see Check a candidate config. |
| A gateway started on a pack that does not load | It refuses to start. A reload keeps the previous configuration. |
Hook silence
Claude Code, Codex, Copilot and Cursor images own their hooks as root, so the agent cannot switch them off, and silence on those only alerts. on_silence and max_silence_after bind the user-tier agents, such as OpenCode and Hermes. sandbox policy explain shows the response that applies to the agent in question.
Silence counts only while the agent works: its model calls and other connections, with no hook request for max_silence_after. An agent idle at its prompt, or waiting on a long tool call that its hooks reported (a build, or sleep 180), is not silent and keeps running.
Profile assignment
- Proven matches. Proven matching assignments combine at their strictest settings.
- The default.
default_profileapplies when no proven assignment matches and no assignment needs an unconfirmed fact. When it is empty, the floor applies alone. - Missing facts. If DefenseClaw cannot read the groups an assignment needs, the request is refused and names the missing fact.
- Keep the default strict. Make
default_profileat least as strict as every assigned profile;ensurewarns for each weaker setting (sandbox_default_profile_looser). - Agents and connectors.
match.agentsis ignored for sandboxes, because agent ids are claimed by the caller. A floor reachable only throughmatch.agentsormatch.connectorsgets a warning; key strict floors on groups. - Group spelling. Write each group the way the host reports it:
group@domainon Linux with SSSD fully qualified names,DOMAIN\groupon macOS and Windows. A bare group name also selects the members of a local group of the same name, which a person with root on that host can create;ensurewarns when a bare entry is ambiguous that way.
See User and group policies. A copyable example is packaging/identity/ad/sandbox-profiles.example.yaml.
A complete profile set with an offline floor
The offline-floor profile repeats every setting of contractors and engineering, so accounts with no matching assignment, and unverified users, get the strictest policy.
guardrail:
profiles:
contractors:
description: Contractors. Coding agents only in a sandbox.
mode: action
sandbox:
required_for: [claudecode, codex]
when_unavailable: refuse
allowed_harnesses: [claudecode, codex]
egress_allow_only: [api.anthropic.com, "*.amazonaws.com", github.com]
allow_mount: false
allow_unblock: false
user_approvals: session
allowed_credentials: [bedrock]
process_tree: true
delete_stopped_after: 14d
engineering:
sandbox:
allowed_harnesses: [claudecode, codex, opencode, hermes]
on_silence: stop
max_silence_after: 5m
offline-floor:
sandbox:
# Offline and unverified users get this profile, so it repeats every
# setting of the strictest profile above.
required_for: [claudecode, codex]
when_unavailable: refuse
min_profile: strict
allowed_harnesses: [claudecode, codex]
egress_allow_only: [api.anthropic.com, "*.amazonaws.com", github.com]
allow_mount: false
allow_unblock: false
user_approvals: session
allowed_credentials: [bedrock]
process_tree: true
on_silence: stop
max_silence_after: 5m
delete_stopped_after: 14d
profile_assignments:
- profile: contractors
match: {groups: ["contractors@corp.example.com"]}
- profile: engineering
match: {groups: ["engineering@corp.example.com"]}
default_profile: offline-floorAsks and saved decisions
An ask is a connection the sandbox's egress proxy does not decide for itself. On a managed host the gateway, not the daemon, decides and stores the answer, and it never passes the organization's floor.
user_approvals | allow_unblock | Allow for this session | "Always" | Lift a block |
|---|---|---|---|---|
| unset | true or unset | Yes | Yes, stored | Yes |
| unset | false | Yes | No | No |
session | true or unset | Yes | No | For the session only |
session | false | Yes | No | No |
none | any | No | No | No |
- Session answers. An answer for the session lasts while the sandbox runs; its next session asks again. Only an "Always" answer outlives the stop. A
sandbox unblock HOST --sandbox NAMEwithout--alwaysalso lasts only for that session. allow_unblock: false. Withallow_unblock: false, the person can approve an ask for this session only, even whenuser_approvalsis unset. A request for "always" and an unblock are both refused, with the rule that refused them and the contact.- Saved decisions. They are per person (
decisions/<uid>.json, service-owned, mode 0600), record who answered (not an operator), and are capped by the floor every time the policy is resolved. A call straight to the decisions route is checked against the same table. - Blocks always store. A block the person adds always stores, because it only tightens. With
user_approvals: none, every rule that came from a user is removed.

A refused answer carries the request-access text and the exact rule, so the person knows what to ask for:
Blocked by your organization's DefenseClaw policy: api.example.net is not on your profile's allowed hosts (profile contractors, rule egress_allow_only). You can't approve this.
Request access: it-security@example.com. Quote: profile contractors, rule egress_allow_only, host api.example.net, sandbox brave-otter.What the agent and the person see for an ask or a block is on What users see.
Foreign sandboxes, rules and containers
On a managed host the daemon lists every sandbox on the user's OpenShell gateway at each reconcile, and on every other local gateway registered with the user's OpenShell CLI that answers. A sandbox made with openshell sandbox create --from directly is not a DefenseClaw sandbox: it is foreign.
| Foreign item | What DefenseClaw does |
|---|---|
| A sandbox without DefenseClaw's labels and a registration | Stopped (foreign_sandboxes: stop, the default) or alerted on (alert), with log.sandbox.foreign_sandbox. The person is told it was not started with defenseclaw sandbox run, which the organization requires. The record reaches the managed gateway even when the person has no registered sandbox. |
| A foreign sandbox OpenShell won't stop yet (provisioning, starting, or in error) | Deleted instead. A failed delete is tried again at the next reconcile; after three reconciles the person is told to remove it with openshell sandbox delete. |
| A network rule DefenseClaw did not render, and no stored decision covers | Removed and audited (sandbox.policy.foreign_rule). A repeat stops the sandbox. |
| An agent process in a container DefenseClaw did not create | Only alerted on (log.sandbox.foreign_container), so ordinary dev containers keep working. |
- Under
alert. A foreign sandbox on the person's managed gateway keeps running while the gateway does, but does not hold the gateway port. When the person's last DefenseClaw sandbox stops, the gateway stops within about 45 seconds and the foreign sandbox with it, so the next account can start. - How containers are found. The daemon checks containers at every reconcile. It finds an agent by its command's name or, under another name, by its package name in the command line or in the program it runs, which it reads from the container with
docker cp(nothing runs in the container). - Which daemon reports a container. On Linux with a rootful Docker engine every account in the
dockergroup sees every container. A container whose agent runs as another account with a running daemon is reported by that account's daemon only. One whose agent runs as root, or as an account without a daemon, is reported by every daemon that sees it.

Limits of this control:
- An agent in a plain container or in the user's own virtual machine is not stopped. The control is the sandbox policy and the alert, not control over every container on a Docker host.
- A second
openshell-gatewaythat the user starts by hand shares the MicroVM driver's state folder and can sweep the first one's sandboxes.defenseclaw sandbox statusandsandbox doctorlist it as "Other gateway" with its process id. - A gateway that is not registered with the user's OpenShell CLI (one started from a private configuration and never added) is outside the reconcile: what it runs is neither stopped nor recorded as foreign.
Changes while sandboxes run
The managed gateway re-matches each live registration when the config changes, or when a person's directory facts change: their principal, directory, tenant or groups, or a slow lookup that has now resolved. The daemon learns of it from the next relayed hook or from a poll every 60 seconds. A renamed or recycled account is different: the registration is revoked, not re-matched.
| Kind of field | What happens |
|---|---|
Live fields (egress lists, approvals, request_access, silence, process tree, retention) | Switch at once and the person sees a status line. An edit of a profile's own settings applies tighter or looser; an assignment change only tightens a running sandbox. |
| Tighter create-time fields (for example mounts no longer allowed) | The violating sandbox is stopped; the notice begins "This sandbox was stopped: your profile no longer allows" and names the field and the command to start again. The agent's session ends with it, sandbox activity shows it, and sandbox status NAME repeats it. Only after a verified match, never on a failed lookup. |
| Looser create-time fields | Apply at the next run. |

Live fields and new connections
- Each new connection. A running sandbox's egress proxy decides each new connection with the policy the managed gateway confirmed for it within the last second, and confirms again first when a relayed hook names another policy. A connection no relayed hook preceded (
sandbox exec, a script that keeps running) is decided with a confirmation at most a second old. - Open connections. A connection already open is checked again once the new policy is in force.
- Gateway not answering. The policy in force stays, except after a relayed hook said it changed: then new connections are refused with "your organization changed this sandbox's policy and DefenseClaw could not confirm the new one yet; try again in a moment" until the new one is confirmed.
- Registration ended. A sandbox whose registration the managed gateway ended has every new connection refused while DefenseClaw stops it.
Floors are pinned per sandbox
- When a person's profile assignment changes, each running sandbox is re-matched but runs under the stricter of two floors: the floor of the profile it was created under and the floor of the new one.
- A sandbox created under a strict profile keeps its blocked destinations after the person moves to a looser profile. One created under a looser profile is tightened at once when the person moves to a stricter one.
- The next sandbox takes the new profile alone. To loosen a running sandbox, stop it and run a new one.
- If the profile a sandbox was created under is removed from the configuration, that sandbox's policy no longer loads and it is refused until it is started again.
- While a sandbox keeps a pinned floor, its refusals,
defenseclaw sandbox statusanddefenseclaw sandbox policy explainname the pinned profile first, then the profile the person is assigned now. The request-access quote names the pinned profile, whose rule refused. sandbox status NAMEshows the organization profile the registration matches now on itsYour policyrow, with the digest of that match. For a running sandbox it asks the organization's gateway first (2 seconds), so after a regroup it names the new profile at once. ThePolicyrow keeps naming the pack and network profile the sandbox runs under.
Directory lookups and accounts
- Cold lookups. When a directory lookup is cold, the create waits up to 10 seconds for it. If a profile assignment needs the unanswered identity fact, the create and hooks are refused with that fact named. If no assignment needs it, the proven profile or
default_profileapplies; a create under the default may be marked provisional and re-evaluated after the fact is confirmed. - The account itself. The computer must still know the account. OpenShell reaches every sandbox over ssh as the person, and ssh refuses an account the computer cannot look up (on Linux, SSSD stopped, or no cached entry). A new
sandbox runthen waits up to 10 seconds, and otherwise stops with "Your account can't be looked up on this computer right now. Try again in a moment." - Late stops. A sandbox still running two minutes after it should have stopped is revoked.
- Recycled or renamed accounts. The same uid with a different name revokes its registrations. The account that holds the uid now never inherits the earlier account's sandboxes or saved decisions: its first
sandbox runremoves them once the account database confirms which account holds the uid (never during a directory outage), and the gateway log names how many it removed. They never count against the new account's limits.
Sandboxes on managed computers
Let people on managed Linux and macOS computers run Claude Code, Codex and other agents in NVIDIA OpenShell sandboxes under their directory group's policy.
What users see in managed sandboxes
See what a person on managed Linux or macOS sees when they run an agent in a sandbox: the run banner, asks and blocks, policy explain, and admin telemetry.