Skip to content
docs
type to search↑↓ move↵ openesc close
v0.3.2github

Isolation tiers

6 min readv0.3.2this page as markdown

You choose how strongly each sandbox is kept from your host and from other sandboxes, through the same API. There are five strengths, called tiers, from confined processes on the host’s kernel to a virtual machine with its own kernel. A request that names a tier gets it, or a refusal that says what is missing.

The process and wasm tiers need no root. The others need Docker, Podman or KVM on the host, as the table shows.

Tier Runs Separates a sandbox with Kernel Needs from the host
process Native commands on a bundled userland Landlock, seccomp and rlimits; namespaces and a cgroup of its own where the host allows The host’s Linux with Landlock ABI 3 (6.2 or later); no root
wasm WebAssembly, Python and JavaScript, agentOS packages A virtual kernel in a shared, unprivileged agentOS sidecar A virtual kernel per sandbox x86_64; no root
container Any image the host allows Namespaces, cgroups, every capability dropped The host’s Docker or Podman
gvisor Any image the host allows The container tier’s settings, under gVisor’s runsc gVisor’s user-space kernel Docker with runsc, which the server preset installs
vm linux/amd64 images A Firecracker virtual machine under KVM Its own Linux kernel x86_64 with KVM the daemon’s user can open

Only vm boots its own kernel. By default a node serves every tier its measured host capabilities allow, side by side. Run hermitbox doctor to see the tiers your host serves and why the others are off.

Process tier

The process tier runs each sandbox as confined Linux processes, with no host privilege, so it works for an ordinary user on Linux 6.2 or later. Landlock keeps it out of other sandboxes’ data and /proc, and a seccomp filter denies mounts, ptrace, namespace creation, bpf and identity changes.

What else it gets depends on the host:

  • Namespaces: where user namespaces work, each sandbox gets its own PID and IPC namespaces, a private /tmp, and an empty network for network: 'none'.
  • Limits: where cgroup controllers are delegated to hermitboxd, the kernel enforces memory and CPU limits. Elsewhere memory is a sampled budget, not a hard cap.
  • Users: as root, each sandbox gets its own UID once the host’s credential-drop probe passes. As an ordinary user, sandboxes share yours.
  • Network: with kernel network policy, eBPF programs decide each destination. Without it, internet-enabled process sandboxes share the host’s network and must trust each other.

The process isolation reference covers each mode.

Wasm tier

The wasm tier runs software built for WebAssembly, with Python and JavaScript, inside agentOS’s virtual kernel. All wasm sandboxes on a node share one sidecar, so they share a fault domain and its CPU. Ingress is HTTP over TCP, hostname egress is refused, and sleep keeps data but not processes. See agentOS on Hermitbox.

Container and gVisor

The container tier runs any image the host allows, through Docker or Podman, with every capability dropped, no-new-privileges, private IPC and a PID limit. Images come only from the host’s allowed prefixes. Containers share the host’s kernel.

The gvisor tier runs the same images, but each sandbox’s system calls go to gVisor’s user-space kernel instead of the host’s. It is the same engine, images, limits and firewall as container, with gVisor’s runsc as the runtime. Those system calls cost more: one-byte reads and writes cost about 26 times what they cost in a container. Hostname egress is refused on this tier.

Virtual machine tier

The vm tier gives each sandbox a kernel of its own: it boots each one in a Firecracker virtual machine with its own Linux kernel. It needs an image, and as an ordinary user it can sleep with memory. See Virtual machines for what a host needs and how images become disks.

How the default is chosen

You don’t have to name a tier. When a request names none, control tries container, vm, gvisor, process and wasm, in that order, keeping only the tiers that fit the source:

  • An image runs on container, vm or gvisor.
  • No image runs on process or wasm. Where neither gives the guarantees in require (the server preset requires private-network, which a process sandbox has only with network none on a node that gives it namespaces of its own), a request naming no image or package runs on the first image tier that does, from a pinned Debian image with Python, kept running as a process sandbox would be.
  • packages runs on wasm.

The first tier that a healthy node serves, with the guarantees in require, wins. A snapshot or a template keeps the tier it was saved on. The operator can fix one tier, or change the order, with HERMITBOX_DEFAULT_ISOLATION=process or a comma-separated list.

typescript
// Ask for a container from an image.
const box = await hb.sandbox({
  isolation: 'container',
  image: 'alpine:3.22',
})

console.log(box.isolation) // container
python
# Ask for a container from an image.
box = hb.sandbox(
    isolation='container',
    image='alpine:3.22',
)

print(box.isolation)  # container
rust
use hermitbox::{Isolation, SandboxOptions};

// Ask for a container from an image.
let sandbox = hb
    .create_sandbox(
        SandboxOptions::new()
            .isolation(Isolation::Container)
            .image("alpine:3.22"),
    )
    .await?;

println!("{}", sandbox.isolation().await); // container

The chosen tier is stored before compute starts and never changes for the life of the sandbox.

Never a weaker guarantee

When you name a tier, you get that tier or a refusal. A container request never runs on runsc, and a gvisor request never runs without it. When no healthy node serves the tier, creation answers 503 no_room, naming each node and what it offers, and leaves no sandbox behind:

text
No node can serve the vm tier for this request (node-1: offers container, process, not vm)

The same holds for guarantees. Each sandbox reports guarantees, such as own-kernel, memory-limit, private-network and host-firewall, and a guarantee its node doesn’t announce reads false. A create can require any of them, and a wake checks them again:

typescript
// Place this sandbox only where memory limits are enforced.
const box = await hb.sandbox({
  image: 'alpine:3.22',
  require: ['memory-limit'],
})
python
# Place this sandbox only where memory limits are enforced.
box = hb.sandbox(
    image='alpine:3.22',
    require=['memory-limit'],
)
rust
use hermitbox::{Guarantee, SandboxOptions};

// Place this sandbox only where memory limits are enforced.
let sandbox = hb
    .create_sandbox(
        SandboxOptions::new()
            .image("alpine:3.22")
            .require([Guarantee::MemoryLimit]),
    )
    .await?;

A request can’t loosen the host’s policy. Capabilities, mounts, images, users and network rules come from the host’s configuration, and HERMITBOX_REQUIRE adds requirements no request can remove.

Next steps

run it yourself
$curl -fsSL https://hbx.sh | sh
or ask your agent
Install Hermitbox and set it up for me
Linux (x86_64 or aarch64), no root, no Docker. Agents can read every page: llms.txt · llms-full.txt
the floor · nothing below this line