Security model
How Ant authenticates, authorizes, and limits what a peer can do.
Identity
- Every principal holds an ed25519 keypair. The public key is the NodeID, in
base32 (no padding). Account keys live at
~/.ant/identity; a machine's key lives on the machine (~/.ant/worker/agent-identity, or wherever the worker's--identitypoints). A provisioned machine generates its own key, and the operator only records the NodeID — the private key never leaves the machine. - The transport binds an endpoint with the identity's seed and verifies the bound endpoint id equals the NodeID, so a peer cannot present a key it does not hold.
Transport
- iroh = QUIC + TLS 1.3 with mutual authentication: both sides prove possession of their key. Dialing is by NodeID; no open ports, no host certificates.
- A self-hosted relay, when configured, only forwards encrypted bytes.
- Private keys are
0600. The account's portable credential bundle is passphrase-encrypted by default (PBKDF2-HMAC-SHA256, 210k iterations, AES-256-GCM), and load re-checks that the key matches the profile NodeID.
Authorization: the daemon is the authority
Mutual TLS authenticates the channel; it does not authorize the caller. The machine daemon resolves the caller's NodeID against its roster and enforces a method → capability table:
| Method | Requires |
|---|---|
ping, whoami | public |
invites.redeem | public, gated by a signed invite token |
users.list, containers.list, containers.logs, images.list, volumes.list, metrics.get, caddy.status, tools.probe, swarm.status, swarm.nodes, swarm.services, swarm.service.tasks, swarm.service.logs | read (viewer+) |
users.add, users.setRole, users.remove, users.update, invites.revoke, state.export, audit.list, swarm.init, swarm.leave, swarm.node.update, swarm.node.rm, swarm.joinToken | colony manage, and the caller must be allowed to grant/remove/modify the target's role |
state.import | ownership (owner only) |
deploy.run, deploy.rollback, deploy.commit, image.load, build.run, compose.apply, compose.down, stack.apply, stack.down, route.apply, containers.action, containers.remove, volumes.remove, swarm.service.scale, swarm.service.restart, swarm.service.update, swarm.service.rm, handover.export, tunnel.open | deploy (deployer, ci, admin, owner) |
Role capabilities: owner (all) · admin (all but ownership transfer) ·
deployer (read, deploy, osuser) · viewer (read) · ci (read, deploy).
Ownership transfer (state.import) is owner-only.
Which role is for whom:
| Role | Can | Give it to |
|---|---|---|
viewer | read containers, logs, metrics, tool and swarm state | teammates who only need status and logs |
deployer | read + deploy, rollback, tunnels, volume removal — root-equivalent on the machine (see the guards table below) | people you would trust with SSH root |
ci | read + deploy; no roster, audit, or OS accounts | a pipeline bot, scoped to one machine |
admin | everything except ownership transfer, including roster and audit | co-operators; an admin's signed consent is required for an owner election |
owner | everything, including ownership transfer | you, and as few others as possible |
An admin participates in owner elections. With zero owners and at least two admins, an admin may promote a member to owner only with a second admin's signed consent token, which the daemon verifies (signature, the consenter's current admin role, the candidate, expiry, single use). There is no asserted fallback; see Known issues.
Fail closed. With no roster and no boot owner, every gated method is refused. The first owner is seeded out of band:
ant-worker --owner <nodeid>(repeatable), the bootstrap/provisioning owner, emitted byant nest bootstrap; or- writing the owner into the machine's
state.jsonas root.
Invites
- An invite is signed by the inviter's account key and carries the destination machine NodeID, the role, and an expiry.
- Redemption is server-side (
invites.redeem): the daemon verifies the signature, expiry, that the invite is for this machine, the inviter's current role, and the grant matrix, and that the nonce is unused. - Single-use is enforced by the daemon (
state.jsonkeeps consumed nonces until their expiry). The invitee need not be on the roster yet. - Revocable:
invites.revoke(colony manage) records a nonce as revoked until its expiry, and redemption rejects it, so a leaked token can be killed. - Time-limited memberships: an invite can carry a grant TTL
(
--grant-ttl), andusers.add --expires-insets one directly; the daemon stops authorizing the member at the deadline while the row stays for the audit trail. - Workload identity (OIDC): instead of an invite, a CI job can join by
presenting its provider's signed OIDC token, verified against a per-machine
policy (issuer, JWKS, audience, repository/ref); the job's ephemeral NodeID
gets
ciwith an expiry bounded by the token. No secret is stored in CI. See CI.
Least privilege on the machine
- The worker runs unprivileged and never invokes sudo. Privileged work on a
machine is operator-run and executes exact argv, never a shell:
ant nest reconcile --applyruns as root, and the SSH provisioning path (ant nest machines add --host,ant nest bootstrap --host) runs its privileged steps on the target through the SSH user'ssudo. - Docker calls use
exec.Commandwith argument slices, notsh -c. The image is passed after--, so a crafted reference cannot be read as a flag. - Server-side validation: container names, compose project names, and
network names must match
^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,62}$; image refs may not start with-or contain whitespace. This blocks path traversal (../…) and flag injection. - Container actions address the container by exact name only.
What the deploy guards block, and what they do not
Every deploy path is checked on the worker before Docker runs: binds that
reach the worker's state/identity directory or an ancestor of it (so
/home, /var, /run, or ~ are refused when they lead there), the docker
socket (and /run//var/run as its ancestors), and the host root /. The
client pre-checks the same paths for run: container mounts and run: compose
files, so a local run and a remote run behave alike; run: stack is enforced on
the worker only.
| Option | run: container | run: compose | run: stack |
|---|---|---|---|
| state/identity dir, its ancestors | refused | refused | refused |
docker socket, /run, /var/run | refused | refused | refused |
host root / | refused | refused | refused |
privileged: true | not expressible | refused | refused |
host devices: | not expressible | refused | refused |
volumes_from:, volume driver_opts: | n/a | refused | refused |
include:, extends: {file: …} in a resolved document | n/a | refused | refused |
include:, extends: {file: …} in a no-build bundle | n/a | paths checked, then the resolved document is re-guarded | not supported |
network: host / network_mode: host | allowed | allowed | allowed |
cap_add, pid: host, security_opt, user, sysctls, ipc/uts/cgroup | not expressible | allowed | allowed |
any other host path (/etc, /srv, another user's home) | allowed | allowed | allowed |
| named volumes by name | allowed | allowed | allowed |
"Not expressible" means the wire type has no field for it: it cannot be set through the client (or a hand-built RPC) for that run target. The guards are a denylist for ant's own secrets, not a sandbox; "allowed" means exactly that.
The deploy capability is still root-equivalent on the machine
The guard list above does not make the host safe to hand out casually. Treat
deployer and ci as machine-level trust:
- Any image, any environment, any host path outside the protected set. A
deployer can bind-mount
/etc,/srv, or another user's home read-write, and can reuse any pre-existing named volume by name (the worker does not check volume ownership). IngroupDocker mode the worker is in thedockergroup, which is host root; inrootlessmode it is full control of the worker's unix user (including its NodeID key). - Host networking is not refused. A
hostnetwork on a container, ornetwork_mode: hostin a compose/stack file, reaches the machine's loopback, including Caddy's admin API on127.0.0.1:2019and any other local listener. - Compose and stack files are a denylist.
cap_add,pid: host,security_opt, and friends are not inspected; onlyprivileged,devices,volumes_from, and volumedriver_optsare. A deployer can also send a hand-built RPC that publishes ports on every interface (deploy.publish: allis only a client default). - A deploy builds and runs an arbitrary Dockerfile on the machine.
- Adoption stops a workload the deployer names.
--adoptlets a deployer stop (or remove, with--adopt-remove) one explicitly named container or compose project that Ant does not manage, as the final step of a staged cutover. The adopted name is recorded in the audit entry, the worker refuses an Ant-managed name, and nothing happens before the replacement is healthy and routed; but it is still a deployer acting on a workload Ant did not create, so treat it as part of the root-equivalent deploy capability.
Give the admin/owner roles to people you would trust with SSH root on that
machine, and prefer viewer for read-only access. The role matrix (read,
deploy, colony.manage, ownership.transfer, osuser) is enforced
server-side and the worker never runs privileged host commands, but container
execution itself is the escape hatch, as with any Docker-based deploy tool.
Routes and ports
- For
run: containerandrun: compose, a published port binds loopback by default, so a deployed app is reachable through the machine's reverse proxy (and on the machine) but not from the network.deploy.publish: allopts into binding every interface. Arun: stackservice's published ports go through the Swarm ingress mesh on every node — Swarm has no loopback-only mode — so route stack services by domain through Caddy. route.applyaccepts only valid hostnames (no wildcards, ports, schemes, or paths), only loopback upstreams (the machine's own containers), and rejects a host (or host+path) already routed by another app, so a deployer cannot shadow or hijack a teammate's domain.- The worker's Caddy admin API is bound to
127.0.0.1:2019with an origin allowlist (origins 127.0.0.1:2019 localhost:2019), so a browser request carrying a foreignOrigin(a page on another domain that resolves to loopback, i.e. DNS rebinding) cannot reprogram routing, and a request with a foreignHostis refused. On a multi-user host, prefer the distribution'scaddy-only unix socket instead. - The dashboard is operator-local by design: one dashboard per laptop, reading that operator's own files, never hosted on a server. It binds loopback only; a non-loopback bind is refused, there is no password, and there is no remote-access mode. The trust boundary is the local account: any local process that can reach the loopback port can perform the same mutations, so treat a shared workstation accordingly.
- On a loopback bind the dashboard also applies a Host allow-list (rejecting
a request whose
Hostis not loopback, DNS rebinding) and a same-site guard that rejects state-changing requests a browser marks as cross-site. JSON request bodies are capped at 8 MiB. - Deploys and compose files that reach the worker's state/identity directory,
the docker socket, or the host root are refused on the worker for every
run target, and the client pre-checks container mounts and compose files (so
a local run and a remote run behave the same). See
What the deploy guards block
for the exact matrix, including what is not refused. The check is
boundary-aware and covers ancestors of the state directory (e.g.
/home/antexposes/home/ant/.ant/worker/agent-identity). A project-relative mount such as.or./datais allowed in a compose file (it is relative to the compose/project directory, not the worker's home) while arun: containerdeploy refuses relative bind sources outright, because the worker has no project directory to resolve them against. For compose this coversvolumes, top-levelsecrets:/configs:file:sources, and it also rejectsprivileged: trueand hostdevices:. A resolved compose document that still containsinclude:is refused on the worker: compose expands it atuptime, after the guards, so its services could bypass every check. An unresolved bundle (see Compose resolution) may containinclude:andextends.fileinstead: every referenced path is checked before resolution (relative, inside the project directory), builds and signed images are refused, and the document compose produces is guarded again before anything runs. - Untrusted build contexts are extracted with an 8 GiB cap and reject
absolute paths,
..traversal, hard links, and symlinks that leave the context. The transport caps a request frame at 2 MiB (a general frame at 8 MiB), a blob at 64 GiB, and bounds connections and streams per connection. - Every privileged RPC is written to a tamper-evident audit log
(
ant nest audit): each entry chains to the previous by hash and each rotated segment links to the one before it, so an edited entry or a deleted segment fails verification. (The newest lines can still be truncated by anyone who can write the state directory, and deleting the oldest retained segment is indistinguishable from normal rotation.) The log rotates at 8 MiB, and reading it is an admin action that does not itself append. - Secret values are never stored: a
from:provider (1Passwordop://, a genericcmd:, orenv:) is resolved at deploy time and only its warning is surfaced on failure. - Tunnels (
ant nest tunnel, or the dashboard's Tunnel action) forward bytes to a published loopback port of a container ant manages and nothing else, so they add no reach beyond the deploy capability: a peer cannot use one to reach the docker socket, the Caddy admin API, or another local listener. See Tunnels.
Protocol version
Every RPC carries an API version, and both sides reject a mismatch with an
actionable message (peer speaks protocol vN, this worker speaks v1; upgrade the older side) instead of failing as an unknown method. A mixed-version fleet
therefore fails closed on the first call, which is why upgrading worker and CLI
together matters (see the upgrade note in Known issues). Before the first
tagged release the protocol is not stable and the version stays 1; it is
bumped only once there are deployed workers that cannot simply be rebuilt.
At rest
~/.ant/config.json, the machinestate.json, and identity files are0600; the machine state is written atomically.- Build-time secrets are resolved from the environment and never baked into
images or the lockfile. Runtime secrets never appear in command argv or a
persisted compose document: a container deploy (local or remote) passes them
through the docker process environment (a bare
docker run -e KEY, value from the invoking process's environment, so multi-line values survive), and a compose deploy ships${KEY}references plus a0600secrets.envbeside the compose file (docker compose --env-file, removed bycompose down). Ant stores no secret values of its own: there is no secret store, no vault, and no encrypted field in the config or state files. Docker itself records a container's environment, sodocker inspectstill shows the values at runtime; that is the container engine's storage, not ant's. - The files a compose project references are project inputs, not ant's
storage: a no-build remote deploy ships
env_filefiles,.env, andsecrets:/configs:file:sources to the machine, where they are written0600beside the resolved document (they are what the workload reads) and leave with the project's stored files when it is pruned (ant nest doctor --cleanup). Anenv_file's values are inlined into the resolved document at deploy time, exactly as a localdocker compose configdoes.
Supply chain
- The transport pins iroh v1.0.3 and iroh-ffi v1.1.0 through a vendored
Go binding; the static libraries under
packages/iroh-go/libsare committed and regenerated withtask libs:build, so no Rust toolchain is needed to build ant. - Release downloads and
install.shverify a SHA-256 checksum from the release'schecksums.sha256. The binaries are not code-signed yet. - Image signature verification is opt-in (
deploy.image_signing); both the CLI and the worker verify before running when it is set. - No SBOM is published yet; the pins above are the inventory.
- The transport is isolated behind
internal/machine/transport: if the binding or upstream stalls, it can be updated or replaced there, and a build without CGO keeps the local-first path working.
What Ant does not protect against
- A compromised
deployer,ci, oradminaccount (see the guards table), or a malicious image a deploy runs — container execution is not sandboxed. - A compromised machine: root there, the Docker engine, the worker's state directory, or the audit log can all be tampered with (the hash chain makes some tampering detectable, not impossible).
- Lost account keys: there is no account-recovery service. An owner can be re-seeded only with operator access to the machine.
- Relay and address-lookup metadata: NodeIDs, IP addresses, and timing are visible to the infrastructure carrying the connection; payloads stay encrypted (see Transport).
- Other local users on a workstation where the dashboard binds loopback.
Trust boundaries and gaps
- The local dashboard trusts loopback. It performs real mutations (deploy, config). There is no per-user login or OIDC, and the bind is loopback-only, so prefer a single-operator or otherwise trusted host.
- The audit log is local and root-deletable. Privileged actions are
hash-chained,
ant nest auditdetects an edited or removed line, clients anchor the chain head, and a worker can mirror entries to a webhook, but the log lives on the machine and an operator with root can delete it. See Known issues. - Owner election needs a countersignature. When the roster has zero owners and at least two admins, an admin may promote any member (including itself) to owner only with a second admin's signed consent token (bound to the machine and candidate, expiring, single-use), which the daemon verifies. An admin account is still a sensitive target: it can produce a consent for a candidate of its choosing, so give the role only to co-operators.
- Machine NodeID pinning. The transport authenticates that a machine holds the key for the NodeID it presents; direct registration records the first contact (a machine added by hostname learns its NodeID then), and a machine that answers as a different NodeID is refused. Invite tokens additionally pin the machine NodeID out of band.
- Supply chain: the iroh transport uses a vendored Go binding; see Supply chain for the pinned versions, checksums, and what is not signed yet.