# Host capabilities and guarantees

Know what protects a sandbox before you trust it with work. Each sandbox reports which isolation
guarantees its host enforces, and a create can require any of them, so it runs only where they
hold. `hermitbox doctor` shows what this host can do and what would turn on the rest.

## Guarantees

A public sandbox view carries `guarantees`, with a boolean for every name below. False also covers
enforcement that is unknown or that the node didn't announce, so only true is a promise. The view
reads the node's latest announcement, and a resting sandbox, which has no node, reports false.

| Guarantee | Current evidence |
| --- | --- |
| `separate-users` | A process uid pool, with an actual credential-drop probe; shared-uid process nodes report false |
| `memory-limit` | Container engine info reports kernel memory limits and a cgroup driver; on the process tier, `process-limits`: `hermitboxd`'s cgroup gives each sandbox's own cgroup the memory controller, and that sandbox started with its `memory.max` ([process-tier.md](https://docs.hermitbox.dev/v0.3.2/reference/process-tier.md#limits)) |
| `cpu-limit` | Engine info reports CPU quota and weights and a cgroup driver; on the process tier, the cpu controller in each sandbox's own cgroup, and its `cpu.max` where it asked for a ceiling (weights stay a container's) |
| `private-network` | The container backend's separate network namespace, gvisor's included; a namespaced process sandbox started with network none (reported per sandbox, never announced for the process tier) |
| `host-firewall` | Rootful engine with a readable installed nftables table; refreshed before heartbeats. On the process tier, the `kernel-network-policy` probe (a disposable cgroup, every program loaded by the verifier, attached and removed) and that sandbox's own attached, verified programs ([bpf.md](https://docs.hermitbox.dev/v0.3.2/reference/bpf.md)) |
| `own-kernel` | The `vm` tier, whose guest boots its own kernel ([virtual machines](https://docs.hermitbox.dev/v0.3.2/guides/virtual-machines.md)); false on every other tier |
| `memory-sleep` | Process suspension or a rootful container engine with cgroup enforcement; false on Wasm and rootless engines |
| `browser-sandbox` | Observed browser launch policy plus usable namespaces and the approved container or verified native process policy |
| `private-pids` | The container backend's private PID namespace, gvisor's included; the process tier where the `process-namespaces` probe started the installation's helper, as each sandbox reports it started |

Containers don't claim a unique numeric host uid: several containers can share the configured
uid, and their namespaces stay the container tier's boundary. Require only a guarantee your
deployment actually provides.

## Require guarantees

A create accepts an optional list, for example:

```json
{
  "image": "alpine:3.22",
  "require": ["memory-limit", "host-firewall"]
}
```

`HERMITBOX_REQUIRE=memory-limit,host-firewall` adds deployment requirements to every create, and
no request can remove one. Placement refuses a sandbox whose guarantees are missing with `no_room`,
naming them. Wake checks them again, even when the spec hasn't changed. Leaving requirements out
changes nothing about placement.

A requested `egress`, `network:none`, `user`, `workdir` or nonempty `packages` needs its node
feature on both create and wake, and is refused before any write or start when the feature is
missing. Default internet networking still works with older v1 nodes, where a missing field
already means internet. CPU reservation stays admission metadata behind its existing feature gate;
it never becomes an implied kernel quota.

The optional `requiredTools: ["desktop", "ssh"]` picks a process tier that announces those native
tools, and checks them again before wake. Control uses it for placement only; it adds no field to
the node request. Native tool features belong to their tier, so a container or Wasm request can't
borrow the process tier's readiness. Container tool calls keep their image and host-policy checks.
[Native tools](https://docs.hermitbox.dev/v0.3.2/guides/browser-and-desktop.md) lists the prerequisites.

## Unenforced memory

A container request with a memory limit is refused when the engine lacks the memory controller,
and the refusal names `memory-limit`. An ordinary user can explicitly accept a reservation that
isn't enforced:

```json
{
  "image": "alpine:3.22",
  "resources": {
    "memoryMb": 256,
    "allowUnenforcedMemory": true
  }
}
```

The node must announce `unenforced-memory` before control sends this field. Without a
controller, the sandbox reports `memory-limit: false`, and its 256 MiB still counts for admission.
An engine that can enforce the limit applies it, even when acceptance is true.

This field can't remove deployment requirements, CPU limits or PID limits: a CPU quota, weight or
PID limit the engine can't enforce is still refused. Leaving the field out keeps the spec and the
stored record byte for byte as they were. Doctor explains missing controller delegation and slow
VFS storage.

Podman networks are made through Podman's native API with bridge isolation, and a network that
loses it is refused. The host firewall, FUSE and custom native-tool profiles aren't available on
Podman.

The static `suspend` protocol feature stays for compatibility. `memory-sleep` says more: that
sleep keeps processes alive. Wasm sleep keeps data but disposes of the VM and makes a new one. A
browser on a host without usable namespaces gets no `browser-sandbox` promise, and the native
tool's startup refusal still applies.

## How host probing works

`hermitboxd probe --json` tests what the current caller can do, without changing the host's
configuration. It needs no node configuration and no root. `hermitbox doctor` prints the same
document as text, and `hermitbox doctor --json` keeps it as JSON.

Each result's evidence says what was tested, and its action says what would turn on a capability
that is off. A permission failure reads `unknown`, not proof that the kernel lacks the capability.
Only `on` can become a promised guarantee.

The probe checks, without changing the host:

- A disposable user namespace, using a capability in its private UTS namespace.
- The Landlock ABI.
- The daemon's own cgroup controllers, and as `process-limits` whether its cgroup could give
  process sandboxes memory and cpu (a serving `hermitboxd` reports what it turned on).
- Devices it can open.
- On x86_64 with KVM access, ten real guest HLT exits, measured.

Namespace and guest child processes get a two-second deadline. To find a container engine, the
probe asks for version and info in this order: Unix `DOCKER_HOST`, system Docker, user Docker,
user Podman, system Podman. The first complete answer picks the engine.

A `docker.socket` set in the configuration never falls back to another. Remote engines are refused,
because they can't use this host's paths for sandbox data. The report also covers the firewall
table, systemd, the user session, linger, the architecture and the host's C library.

`hermitboxd doctor --config …` checks the runtime the configuration selects. Process nodes check
that Landlock can be enforced instead of requiring Docker; Wasm nodes check their pinned
distribution. State ownership follows the same per-runtime policy as `serve`.

`hermitbox doctor` also finds the caller's protected installed configuration. With it,
`process-desktop` and `process-ssh` report the verified native bundle, host glibc, agent support,
namespaces and scoped-peer prerequisites. A bare probe leaves them off until it can check a
configured installation. This inspection reads the existing process history; it creates or repairs
nothing, starts no compute and downloads no tools.

The probe reports facts about the user who runs it. A privileged service can have different access
from an interactive user on the same machine.
