Hosts, KVM & Pools
Enroll Linux KVM hosts with Incus 6.14+, configure capacity and storage budgets, and schedule sandboxes across host pools.
A host is a Linux machine you control running the wssp host run daemon. The daemon maintains one outbound WebSocket (wss://<api-origin>/ws/sandbox-host) to the control plane, drives local Incus KVM virtual machines, and enforces sandbox leases and cleanup independently even while offline. The control plane never connects directly to Incus.
Host requirements
A host missing any prerequisite may connect to the control plane, but the server will refuse to schedule sandboxes on it (UNSUPPORTED_CAPABILITY).
1. Linux with KVM and Incus 6.14+
- Linux (
x86_64oraarch64) with/dev/kvmusable by Incus. Sandboxes are always Incusvirtual-machineinstances (wssp-sbx-<sandboxId>), never containers. - Incus 6.14 or newer with the
network_aclAPI extension. Releases older than 6.14 cannot reliably enforce per-sandbox bridge anti-spoofing (CVE-2025-52890), so the daemon advertisesegressEnforcement: falseand refuses creates. - Incus CLI 7.4+ is recommended when using very large domain allowlists (over ~96 KiB / ~1,400 resolved DNS records); older
incusCLIs pass network updates inline on the command line and hit argument-size caps. Restartwssp host runafter upgrading the Incus CLI.
On Ubuntu 24.04, the distro archive ships Incus 6.0.0, which is too old. Install the Zabbly stable repository instead:
sudo mkdir -p /etc/apt/keyrings
sudo curl -fsSL --max-time 120 https://pkgs.zabbly.com/key.asc -o /etc/apt/keyrings/zabbly.asc
sudo sh -c 'cat > /etc/apt/sources.list.d/zabbly-incus-stable.sources <<EOF
Enabled: yes
Types: deb
URIs: https://pkgs.zabbly.com/incus/stable
Suites: $(. /etc/os-release && echo ${VERSION_CODENAME})
Components: main
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/zabbly.asc
EOF'
sudo apt-get update && sudo apt-get install incus
2. Kernel bridge netfilter and conntrack
Sandbox NICs enable security.ipv6_filtering, which requires br_netfilter with net.bridge.bridge-nf-call-ip6tables=1. wssp host run --runtime incus refuses to start until both are active:
sudo modprobe br_netfilter
echo br_netfilter | sudo tee /etc/modules-load.d/wssp-br_netfilter.conf
sudo sysctl -w net.bridge.bridge-nf-call-ip6tables=1
echo net.bridge.bridge-nf-call-ip6tables=1 | sudo tee /etc/sysctl.d/90-wssp-bridge-nf.conf
Install the conntrack package (conntrack on Debian/Ubuntu, conntrack-tools on Fedora/RHEL). Without it, the egress guard quarantines the host with conntrack_unavailable.
3. Incus user, project, and shared lock directory
- The unprivileged user running
wssp host runmust have Incus admin access (typically membership in theincus-admingroup). - By default, the daemon auto-provisions a dedicated
wsspIncus project (features.profiles=false,features.images=false) so VMs stay isolated while sharing thedefaultproject’s profiles and image aliases. Override with--incus-projectorWSSP_INCUS_PROJECT. - The
defaultprofile must contain only a root disk and oneeth0NIC with no extraconfigkeys; anything else fails preflight. - Provision the shared Incus lock directory once as root, granting group access to the daemon user’s group:
sudo install -d -m 2770 -o root -g <daemon-users-group> /var/lib/wssp/incus-daemon-locks
4. One daemon per Incus server
Only one wssp daemon may drive a given Incus server so bridge names (wsn-<id>) and cached image fingerprints never collide. The daemon maintains a numbered profile lease (wssp-daemon-lease-<n>-<id>) in the default project renewed every 15 seconds (60-second TTL) and refuses to start if another live daemon holds it.
[!NOTE] Release binaries for Linux link musl statically and resolve users via
/etc/passwdrather than glibc NSS modules (LDAP/SSSD). Ensure the daemon’s local user and group entries exist in/etc/passwdand/etc/group.
Installing and enrolling a host
Install the wssp binary matching your server’s exact version as the unprivileged daemon user:
curl --proto '=https' --tlsv1.2 -fsSL --max-time 120 https://wssp.example.com/install.sh | sh
The installer verifies the release archive against sha256.sum and installs ~/.local/bin/wssp.
Device enrollment (recommended)
wssp host enroll --slug desk-01 --server https://wssp.example.com
wssp host enroll prints a verification URL and user code without opening a browser or reading stdin. Open the link in a browser signed in to your dashboard (verified email and 2FA required) and approve it. Approving a new slug creates the host and stores a long-lived wssp_device_… credential outside config.toml under ~/.local/share/wssp/device-auth.json (mode 0600, directory 0700).
Dashboard host token (alternative)
Mint a wssp_host_… token on Settings → Host credentials for an existing host, export it in an environment variable matching ^WSSP_[A-Z0-9_]{1,64}$, and bind the variable name (the secret itself is never saved to config):
export WSSP_HOST_TOKEN=wssp_host_...
wssp host enroll --token-env WSSP_HOST_TOKEN
wssp host run --server https://wssp.example.com --host-id <host-id>
Private CA trust
When your server uses an internal certificate authority, pass --ca-file <path> (or set WSSP_CA_FILE per run). Certificates are added to the default webpki roots; chain, expiry, and hostname verification remain strictly enforced with no insecure bypass.
wssp host enroll --slug desk-01 --server https://wssp.internal --ca-file /etc/wssp/root-ca.pem
wssp host config set-ca-file /etc/wssp/root-ca.pem
On Unix, the CA file and its immediate parent directory must be owned by your user or root and must not be group- or world-writable (0644 or 0600).
Install the egress guard and run the daemon
Install the root-owned wssp-guard service once (add --configure-ufw or --configure-firewalld if the host runs a default-drop firewall):
sudo "$(command -v wssp)" host guard install --daemon-user "$USER"
wssp host run
For production hosts, run wssp host run as a systemd user service (wssp-host.service) with Restart=always and LimitCORE=0 (especially if the host runs CLI-login sandboxes).
[!IMPORTANT] Always connect hosts using the exact canonical origin configured in the server’s
BETTER_AUTH_URL(including scheme and non-default port). Connecting via an alias such as127.0.0.1whenBETTER_AUTH_URLuseslocalhostfails the journal-key binding check and refuses environment-bearing operations.
Outbound relay and durable receipts
wssp host run speaks relay protocol 1.0 (ws-sandbox-proxy.relay.v1) over wss://<origin>/ws/sandbox-host and never follows HTTP redirects with credentials.
- Durable receipt journal: Private receipts and lease checkpoints are stored under
WSSP_DATA_DIR/relay/<host-id SHA-256>(mode0700/0600with file and directory fsync, protected by an exclusive directory lock). Never delete this directory to “retry” operations—losing local receipts leaves previously dispatched work inUNKNOWN_OUTCOME. - Memory-only journal HMAC key: On connect, the server installs a derived journal HMAC key held only in daemon RAM. After a reconnect, receipts replay one at a time, followed by a paginated
sandbox.inventorycensus of managed instances and leases. - Reconnection & backoff: Once a session has been established, dropped connections reconnect automatically (fast 1 s retries for 60 s while carrying active work, then exponential backoff up to 30 s). Credential revocation (
4003close) exits with code4and does not reconnect, while continuing to enforce already-accepted local leases. - Targeted UNKNOWN attestation: For allocations stuck in
UNKNOWN_OUTCOME, the server performs an in-session targeted check against the host’s journal and Incus state. If the host proves the VM was never created, the server releases capacity and settles the operation asFAILED(host_effect_not_issued).
Capacity, storage pools, and drain
Automatic detection and TOML overrides
A bare wssp host run inspects Incus /1.0/resources to derive default commitments:
- RAM budget: Total host RAM minus
max(2048 MiB, 25%), aligned down to 256 MiB. Each live VM is chargedmemoryMiB + 256 MiBhost overhead. - Aggregate vCPU budget:
host_threads * 2. - Per-VM CPU cap:
min(32, host_threads). - Root disk commitment:
diskGiB + 1 GiB(default root disk 32 GiB), retained acrossSTOPPEDandUNKNOWNstates until proven deleted.
Inspect effective values and sources without touching Incus:
wssp host config show --json
To override budgets or expose explicit Incus storage pools (up to 16), edit ~/.config/wssp/config.toml (wssp host config path) and restart the daemon:
sandbox_memory_mib = 95232
sandbox_vcpu_budget = 64
max_sandbox_cpu_count = 32
[[storage_pools]]
name = "default"
capacity_gib = 96
draining = false
[[storage_pools]]
name = "nvme-sandboxes"
capacity_gib = 64
draining = false
--sandbox-memory-mib, --sandbox-vcpu-budget, and --max-sandbox-cpu-count flags also override TOML per run; storage pool lists are TOML-only. Shrinking a budget never resizes or evicts existing VMs.
Drain and undrain
Drain prevents new sandbox creates, cold starts, and template captures on a host while allowing existing running sandboxes to finish:
wssp host drain --json
wssp host drain --offload # also triggers background offload of stopped disks to S3
wssp host undrain --json
drained: true means zero live reservations (including pending and uncertain holds). Stopped disks or unfinished operations can still block host deletion until cleared.
Host pools and placement scheduling
Pools group enrolled hosts for automatic placement. A host may belong to multiple pools, including pools owned by other users.
Placement algorithm
When creating a sandbox with poolId, the scheduler evaluates only enabled, online, non-draining, guard-healthy members visible to the calling key that jointly fit CPU, charged RAM, vCPU, root disk, per-VM caps, and storage pool health:
- Image availability: Hosts that already have the exact verified template revision cached rank ahead of hosts that must fetch it.
- Own-host tier: When the pool’s Prefer own hosts setting is enabled (default), the requester’s own hosts rank in a higher tier than contributed foreign hosts (a sort tier, never a hard filter).
- Lowest dominant share: Within a tier, the host with the lowest post-placement dominant share—
max(ramShare, vcpuShare, storageShare)—wins. Ties break by lower RAM share, then host ID. - Storage pool selection: Within the chosen host, healthy non-draining storage pools rank by free committed GiB descending.
Pool capacity can be inspected ahead of time via GET /v1/pools/{id}/capacity (or wssp.pools.capacity()), which returns aggregate free resources, fits count, largest feasible per-dimension values, lease limits, and queue depth.
Waiting for capacity (FIFO queue)
Pool creates may pass waitForCapacityMs (1000–2073600000 ms, or "unlimited" if permitted by policy) to wait in the pool’s FIFO queue instead of immediately returning 409 sandbox.pool_full.
- The sandbox enters
WAITING_FOR_CAPACITYwith no host, disk, or lease consumed; its lease starts only when placed (or atREADY). - Smaller requests behind the queue head can bypass it up to 8 times on hosts the head could use; after 8 bypasses, those hosts are reserved exclusively for the head (
sandbox.pool_fullwithreason: "reserved"for non-waiting creates). - Direct (
sandboxHostId) creates never queue.
Sharing pools and foreign-host policy
Pool owners can invite other users with independent Use and Contribute permissions, optional RAM/vCPU/disk share caps, and a disconnect grace promise (0–30 days, default 3 days) protecting stopped disks if access is lost.
Because templates remain per-account and foreign sandboxes run on the contributor’s network and hardware, each host owner controls four local opt-in settings:
| Host config key | CLI command | Default |
|---|---|---|
accept_foreign_images |
Edit config.toml and restart |
false |
accept_foreign_builds |
wssp host config set-accept-foreign-builds on |
false |
allow_open_egress_for_others |
wssp host config set-open-egress-for-others on |
false |
allow_guest_sudo_for_others |
wssp host config set-allow-guest-sudo-for-others on |
true |
[!WARNING] Trust the node owner. The daemon user on an Incus host can inspect every VM on that machine, including other users’ shared-pool sandboxes. Disabling host terminals or restricting API keys does not isolate a guest from the physical machine’s local Incus administrator.
Fake runtime testing flags
For local development and integration testing without KVM or Incus, run wssp host run --runtime fake (or WSSP_RUNTIME=fake). The fake runtime advertises 4096 MiB RAM, 4 host threads, and 8 total vCPU.
| Environment variable | Purpose |
|---|---|
WSSP_RUNTIME=fake |
Select the in-process fake runtime (launches no VMs) |
WSSP_FAKE_ENFORCE_EGRESS=1 |
Advertise egress enforcement so creates succeed on local stacks (no real firewalling) |
WSSP_FAKE_FAIL_CREATE_FILE=<path> |
Cause all new creates to fail while <path> exists on disk |
Both WSSP_FAKE_* flags are rejected at startup if --runtime incus is used.