Security model¶
What is isolated from what, and what an attacker who controls one agent reaches. The privilege mechanism itself is in agentd and the unit model.
| Layer | Enforced by | Holds against an adversarial agent? |
|---|---|---|
| One Linux uid per agent, uid/mode separation, nftables port bands | the kernel | yes |
agentd's SO_PEERCRED scope check on every privileged verb |
the kernel supplies the identity; the daemon's default-deny switch decides | yes |
| The runtime permission gate — the send/delete floor, per-tool MCP risk rules | on pi, an in-process regex matcher; on claude, auto-mode policy prose read by a model | no |
Layers 1 and 2 decide whether it is safe to run two people's agents on one host. Layer 3 is a floor against a careless agent, not an adversarial one.
Agent isolation¶
| Boundary | What is enforced | How |
|---|---|---|
| Linux account | one uid per agent, no privileged group | agents is the only supplementary group; no usermod/gpasswd in the tree |
| Home directory | no agent reads another's home | 0750 <name>:<name>, asserted at provisioning, not re-checked later |
| Root escalation | nothing installs a path to root | no sudoers drop-in, no setuid binary, no polkit rule, no capabilities |
| Login | agentctl installs no way in | no authorized_keys, no password; the account is not locked either |
| SSH reachability | not asserted by agentctl | a property of the host's sshd config — yours to harden |
| Process sandbox | none | no namespacing directive on any agent-facing unit |
| Loopback ports | a guarded port is accepted only from the uid that owns it | agentctl-portguard.service, nftables output hook, meta skuid match |
| Outbound network | nothing | agents.slice accounts CPU, memory, IO and tasks, and also caps pool-wide memory (MemoryHigh=20G) — none of that touches network |
useradd --create-home --home-dir /home/<name> --shell /bin/bash --groups agents <name>
There is no sandbox on the agent process¶
The whole of an agent's unit containment, identical on both runtimes:
MemoryMax=6G
CPUQuota=200%
Slice=agents.slice
The per-instance drop-in adds User= and WorkingDirectory=, and no containment directive.
No agent-facing unit sets ProtectSystem, ProtectHome, PrivateTmp, NoNewPrivileges,
CapabilityBoundingSet, SystemCallFilter or RestrictAddressFamilies. An agent sees all of
/, the shared /tmp, and anything world-readable. The one exception is xvnc@, which
carries IPAddressDeny=any / IPAddressAllow=localhost on the cgroup.
MemoryMax=6G on the per-instance unit is what caps a single agent; the parent
agents.slice additionally carries MemoryHigh=20G as a pool-wide soft cap across every
agent on the host — a throttle, not a hard kill.
Ports and egress¶
An agent's ports are base + uid − 1000. Band map, the uid-0 KasmVNC allowance and the
rollback:
Ports and the port guard § Host port map.
A port-guard failure does not abort the apply — it records "port guard", finishes the pass,
and returns exit 1. Read the exit code, not the last line.
The guard's chain policy is accept; it drops nothing but guarded ports.
agentctl host proxy set writes HTTP_PROXY/HTTPS_PROXY into rendered env files —
configuration a process may ignore, not enforcement. See
Egress proxies and air-gap.
The privilege boundary¶
| Element | Fact |
|---|---|
| Caller identity | the SO_PEERCRED uid, read on accept before the request; kernel-stamped, unforgeable |
| Request contents | verb, args, optional stdin — no token, no caller field |
| Operator scope | uid 0, or an agent flagged admin: true |
| Every other uid | a self-scope allowlist switch with default deny |
| Socket | 0660 root:agents — a coarse first gate, not the authorization |
Verb classification, the self-scope table, the six denial paths and the two capability-signed request kinds: agentd and the unit model.
Secrets¶
| Element | Fact |
|---|---|
| Store | sops+age shards in the GitOps repo, /opt/agentctl/secrets.d/ by default |
| Shards | shared.sops.yaml plus one <agent>.sops.yaml each, all 0600 root-owned |
| Resolution | the agent's own shard first, the shared shard as fallback |
| Key | /etc/agentctl/age.key, 0600, age-keygen-generated, gitignored, never committed |
| Fleet trust | a host registers only its public recipient, but the store re-wraps to every recipient |
| Write guarantee | secret set re-wraps the shard it wrote to every registered fleet host before it reports success. A failed re-wrap exits non-zero and commits nothing, so nothing that only one host can decrypt is ever pushed. No follow-up apply is needed for the value to reach the fleet. |
| Drift audit | agentctl health reports any shard whose recipient set does not match the fleet's, and names the apply that repairs it |
| Agent access | every secret subcommand, get and list included, is Mutating — no local run |
| Admin overlay ACL | recursive on the repo overlay; secrets.d/ re-denied recursively and by default ACL |
Any fleet host's root decrypts the whole store. The encrypted store is not the confidentiality boundary — the key is root-only and an agent's process never holds it.
What agentd checks for a self-scoped read¶
A non-operator's bare secret get KEY is rewritten to --agent self, then refused when:
- the key is root-only;
- no
--agentis present — a bare read targets the operator-only shared store; - the target is
*orall; - the target names another agent.
secret list has no self-scope case and hits the default deny.
The two keys refused in every scope¶
AGENTCTL_HOST_OP_SECRET and AGENTCTL_HOST_OP_GRANT_SECRET sign root executions
(Architecture § Reaching another host). They live
at 0600 root:root in /etc/agentctl/env/, are subtracted from the rendered env files, and
are gated at the daemon in every scope including self. Either key at 640 root:agents, or in
mcp-shared.env, is a fleet-wide compromise and a rotation on every host.
Rendered plaintext¶
| File | Mode / owner | Reachable by |
|---|---|---|
/etc/agentctl/env/agent-<name>.env |
0640 root:<name> |
that one agent (its own primary group) |
/etc/agentctl/env/mcp-shared.env |
0640 root:agents |
every agent on the host |
Containing directories are 0750/0710 root:agents. The files are on disk, not tmpfs;
nothing scrubs them on a schedule; they go when the agent goes. A credential two agents must
not share belongs in a per-agent shard. The agent's unit sources these files, so assume any
credential wired to an agent is a credential that agent holds.
The human floor on sends and deletes¶
Generated from the MCP catalog's risk: declarations and reconciled onto every agent on every
apply — one declared fact, two rendered policies.
| Runtime | Mechanism | Behaviour |
|---|---|---|
| pi | an extension on the tool_call event, regex-matching the command string |
raises an Allow/Deny card and waits up to 300 s; a deny, a timeout, an unreachable operator and a throwing dialog all resolve to block |
| pi | 129 shipped rules — 96 ask, 28 block, 5 allow; PI_FLOOR_OFF=1 |
an ask rule raises the card; a block rule refuses outright, with no override — not even the owner's; an allow rule is an exemption that settles the call with no card and no model call; the kill switch is off by default |
| claude | two autoMode.soft_deny paragraphs, read by a model each turn |
outbound send is human-performed: the agent drafts and stages. Deleting the owner's own data is human-performed too, and the reversible alternative — archive, trash, re-label — stays auto-allowed. Prose for a classifier, not a matcher — see the next row |
| claude | permissions.deny empty, Bash allowed with no pattern, defaultMode: auto |
not a matcher — nothing in the binary refuses a send |
The pi catalog ships at /usr/share/agentctl/defaults/pi-permission-gate.json, a host may
override it from /etc/agentctl/pi-permission-gate.json, and apply renders the per-agent
enabled set into ~/.pi/agent/permission-gate.json. The per-agent copy's raw-API rules
resolve their host from that agent's secret store, so a gitlab MCP pointed at a
self-hosted instance gates that instance rather than gitlab.com.
The catalog holds two lists. rules (19 — 14 ask, 5 allow) is hand-authored — everything
with no mcp.yaml to live in: rm -rf, DROP TABLE, a force-push, docker prune, a history
rewrite, a Telegram send to a foreign chat, a Graph batch payload, the browser's script
evaluation. mcp_rules (110) is generated from each shipped MCP's risk: block: one rule per
declared tool (99), one raw-api-access rule per credentialed API host (9), and a
raw-api-<verb> rule for each HTTP verb an MCP tiers by method (2). A risk: block declares
only ask or block, so every allow rule is hand-authored by construction.
The five allow rules are the exemption tier, and they run FIRST. They exist because a
gate that asks about calls which are not a decision is a gate whose cards stop being read —
and because an unmatched call is not free: it reaches the semantic classifier, which costs an
LLM round-trip per call. self-config-read and workspace-read each wave through a
whole command that only READS, and only inside one named directory of that agent's own
(~/.pi/agent, ~/workspace); both are whole-command whitelists rather than keyword matches,
because cat X > Y and cat X; rm -rf / also start with a read. browser-screenshot waves
through mcp__browser__take_screenshot, which captures pixels and so has no effect of the kind
this floor judges. browser-resize and browser-emulate wave through resize_page and
emulate the same way, and without even browser-screenshot's confidentiality caveat — neither
captures a pixel, so nothing from the page reaches the model's context either. They exist
because a responsive-design QA loop (resize or emulate a viewport, read the layout, screenshot
it, repeat) hits the unmatched case dozens of times in one pass: on 2026-10-25 one such loop on
a single agent produced 218 semantic-classifier round-trips and 95 owner-facing cards in under
five hours, for calls that could not be anything other than allowed or ask by the classifier's
own near-50/50 confidence — i.e. it was guessing. All three browser exemptions' sibling tools
are deliberately NOT exempt — browser-eval still covers evaluate_script, and
navigate/click/fill still take the normal path. Note the limit of what browser-screenshot
settles that the other two don't even raise: a screenshot of a persistent, authenticated profile
can capture whatever is on screen, which is a confidentiality question, and this floor judges
reversibility — resize_page/emulate have no such caveat because they produce no image at
all. An exemption is always live regardless of the per-agent enabled set (gating an exemption
behind the list it carves a hole in would be circular), so deactivate: will not turn one off —
dropping the id in a host's /etc/agentctl override is the way.
28 of those 110 rules are block, and that tier is a different thing from ask. 26 are
the destructive tools three MCPs declare unappealable — 13 in ms365, 9 in
google-workspace, 4 in atlassian (gmail_delete_email, drive_delete_item,
calendar_delete_event, delete-mail-message, delete-group, deleteJiraIssue,
executeDestructive, …). The other two are the raw-api-delete verb rules for
google-workspace and ms365. The remaining eight risk-bearing MCPs declare no block tool
at all.
A blocked tool is refused on every surface that reads the catalog, and there is no approval
path — an owner standing at the cockpit saying "yes, delete it" cannot get one through. He
deletes it himself in Gmail, Drive, Outlook or Jira. The reversible alternative each blocked
tool names in its reason (gmail_modify_email, drive_move_item, move-mail-message,
update-calendar-event, …) stays auto-allowed. The raw-api-access rules themselves are
ask for every MCP, including the three that block tools: that rule matches a
credentialed host, not an operation, so a plain read would otherwise have become
unappealable.
What the floor does not cover¶
| Gap | Detail |
|---|---|
| Credentials | both runtimes match tool names and command strings, never credentials |
curl against a vendor API |
an agent using its own token on the REST API matches no MCP tool name |
raw-api-access rules |
the mitigation: curl/wget/an interpreter/openssl s_client plus a credentialed MCP's API host |
| Its limit | a regex over a command string, defeated by any shape its pattern list does not name |
| Gate config on pi | ~/.pi/agent/permission-gate.json is agent-owned 0644; an agent can empty enabled until the next apply |
| Permission journal | written into the agent's home, as the agent, best-effort, failures swallowed |
| Audit trail | /var/lib/agentctl/hostops (0700 root:root) audits root host shells only |
Destructive verbs¶
| Verb | Confirmation |
|---|---|
agents remove, apply --prune, destructive agentctl docker |
refuse and require --yes |
ws rm --recursive, secret remove, subsession rm |
none; ws rm guards only the workspace root, and is self-scoped |
The cockpit is one session, and it is the whole boundary¶
| Element | Fact |
|---|---|
| Cockpit authentication | none — it trusts X-User-Email absolutely, on a loopback-only listener |
| Front proxy | agentctl-webview-login.service, driver basic or oidc |
| Session | HMAC-signed wv_session cookie: HttpOnly, Secure, SameSite=Lax, 30-day default TTL |
basic credentials |
one shared list per host (WEBVIEW_BASIC_USERS), 8 attempts/min, keyed on the TCP peer unless it's a trusted proxy (WEBVIEW_TRUSTED_PROXIES) |
| Per-agent separation | authorization after the fact: the verified principal is mapped through the ledger |
| No header at all | refused — the empty scope, authorised for nothing. A login proxy in front is required, not advisory: without one nobody can log in |
| Forged header | still believed — the listener runs no peer check, so any local uid that reaches :8731 can assert an address it does not own |
See The webview gateway § Cockpit login for the full rate-limit and trusted-proxy detail.
Two routes hand out more than a dashboard, both behind that one session and neither with a second factor:
| Route | Reaches | Extra containment |
|---|---|---|
/browser/ |
keyboard and mouse on a persistent logged-in Chrome, plus a file picker in the agent's home | none; Xvnc runs -SecurityTypes None, held shut by three loopback bindings and the port guard |
/terminal/ |
a login shell as the agent's uid — every secret it reads, every system it is wired to | AssertPathExists=/etc/agentctl/terminal/<agent>.admin, root-owned, written for every applied agent unconditionally |
That assertion means systemd itself refuses the shell for an agent apply has never run
for, even if the cockpit is bypassed. It is not an admin-role check, despite the .admin
marker name. The route's destination is a unix socket in a 0700 runtime directory, so it has
no port to reach by other means. Details:
Terminal access.
Mini-app data plane¶
| Capability | Default | Opt-in |
|---|---|---|
MCP calls (ctx.mcpRead and ctx.mcpCall) |
any tool on an MCP the agent is wired for, reads and writes alike, unless the MCP's mcp.yaml declares it risk: block. Bounded by viewer-to-agent scope and by the agent's own per-user MCP socket, not by the tool name |
— |
| Call timeout | 20 s, raisable to 120 s with --timeout |
— |
| Workspace writes | denied | writes: true in the manifest, re-checked server-side |
Manifest actions: true |
ignored. Both MCP methods are attached to every app | — |
Manifest admin: true |
a launcher filter that hides an icon, not a boundary | endpoints gated separately by adminScope |
Manifest supervisor: true |
the same, for the fleet-activity oversight role | endpoints gated separately by supervisorScope |
A tool declared risk: ask, and a tool with no declaration at all, is reachable with no
confirmation step. The confirmation lives in the agent's turn, and this plane has no turn —
the human's click is the confirmation. Three narrowings sit on top of the tier:
| Narrowing | Effect |
|---|---|
| Per-tool argument allowlists | A handful of tools on browser, git, github, gitlab and ado accept only named argument keys. That is what keeps filePath off the browser's captures, bypassReason off ADO's PR write and approval_password off GitLab's approve. A tool outside those lists is unconstrained on arguments. |
| Two browser tools refused outright | evaluate_script and upload_file on the cockpit plane. The CLI permits evaluate_script for script and cron automation; upload_file is refused on both. |
| Batch payloads inspected | A batch entrypoint whose payload carries an HTTP verb the catalog blocks is refused, so a Graph batch of DELETEs cannot walk past the per-tool blocks. |
There is no tool-name allowlist on this plane. Beyond the narrowings above, a mini-app
installed on an agent can call any tool on any MCP that agent is wired for, and nothing
distinguishes a read-shaped data flow from one that mutates. The risk: block backstop is
real only where it is declared — 26 destructive tools across ms365, google-workspace and
atlassian, and nothing in the other eight risk-bearing MCPs — so a panel must not be
built around a delete outside those three. A mini-app bundle is therefore as trusted as a
skill on that agent — review it the same way, and note that the agent's own apps dir is
agent-writable, so anything with the agent's uid can install one.
The same gate governs the mcp read and mcp call CLI verbs, which are two names for one
command with one admission rule — anything reachable through one is reachable through the
other. mcp read is additionally relayable cross-agent by the admin agent through the
daemon's operator scope, and it runs as the TARGET agent — so an admin can invoke any
non-blocked tool with a peer's own credentials, indistinguishably from that peer acting. That
is a deliberate grant, not a gap, and it is the one verb on the privileged-read plane that is
not side-effect-free.
What a compromised agent reaches¶
Assume arbitrary code execution as one agent's uid.
Reachable:
- That agent's entire home: sessions, transcripts, skills, memory, workspace, Chrome profile, any MCP token cached there.
- Every credential in
agent-<name>.envandmcp-shared.env— every shared secret on the host — and every external system they reach, over the network, outside every tool-name gate. - Unrestricted outbound network; anything world-readable on the host; the shared
/tmp. - Every self-scope verb through
agentd: restarting itself, wiring or removing its own MCPs and tools, adding its own skills, hooks and subagents, its own crons (bound toUser=<caller>),ws rmunder its own workspace,agent-messageto any named peer. - Its own permission-gate configuration and its own permission journal.
Not reachable:
- Any other agent's home, rendered env file, MCP socket, or loopback band ports (the KasmVNC band additionally accepts uid 0, and nothing else).
- The age key, the encrypted store, and any secret belonging to another agent or to the shared
store through
secret get. - The two root-only signing keys, in any scope.
- Any operator-scope verb: catalog authoring,
host set,host shell up|tunnel|grant, anything targeting*,allor a named peer. - Root, by any path agentctl installs — no sudoers, no setuid, no polkit, no capabilities.
An admin agent has operator scope at the daemon while running as an unprivileged uid. Compromising one is equivalent to compromising the fleet: every agent's secrets, host-shell grants, privileged verbs on every host. Grant it to as few agents as the work needs — see The admin role.
What this model does not defend against¶
| Threat | Why it is not covered |
|---|---|
| A hostile agent | credentials, gate config and journal all sit in the agent's own home |
| Prompt injection reaching a credential | content an agent reads is untrusted input to a process holding live tokens |
| A shared secret being shared | mcp-shared.env is readable by every agent on the host |
| A fleet member's root | any fleet host's age key decrypts the whole store |
| Kernel escape or local privilege escalation | there is no sandbox on the agent process |
| Whoever holds a cockpit session | one credential list per host, no second factor, /browser/ and /terminal/ behind it |
It is safe to run one owner's agents on a host, and safe to run several owners' agents while each owner is trusted not to attack the others. It is not a multi-tenant isolation boundary against a hostile tenant.