Linux verification lab
Containers share a host kernel and do not prove nftables, WireGuard, or systemd cgroup isolation. Knock ships a reproducible four-guest QEMU/KVM lab under deploy/lab/ to verify real Linux kernel behavior end to end.
Prerequisites
Section titled “Prerequisites”- Linux host with writable
/dev/kvm qemu-system-x86_64,qemu-img,xorriso, OpenSSH, and Python 3- The pinned Ubuntu 24.04 amd64 cloud image dated
2026-10-17(SHA-256: 04e8f2461a16a44e78a370284471f29616cdd9baf1893df25807b71f985b6c94) from Ubuntu cloud images
Guest topology
Section titled “Guest topology”deploy/lab/start.sh creates a disposable 0700 lab directory, generates a temporary admin SSH key, disables sleep/suspend targets on each guest, and boots four isolated VMs:
| Guest | Memory | Role in verification |
|---|---|---|
door |
2048 MiB | Runs knockd, WireGuard, nftables, per-session sshd, and the private HTTP service across isolated point-to-point links (198.18.0.1, .5, .9). |
requester |
1024 MiB | Primary authorized requester connected to link 1 (198.18.0.2). |
outsider |
1024 MiB | Unauthenticated external machine on link 2 (198.18.0.6) verifying pre-admission and post-expiry drops. |
requester2 |
1024 MiB | Second independent requester on link 3 (198.18.0.10) proving per-session isolation. |
Run the lab probe
Section titled “Run the lab probe”Start the guests, run the kernel and SSH containment probe, and shut down cleanly:
deploy/lab/start.sh noble-server-cloudimg-amd64.img /tmp/knock-labdeploy/lab/probe.sh /tmp/knock-labdeploy/lab/stop.sh /tmp/knock-labKeep the lab directory path under 75 characters so QEMU monitor and stream Unix socket paths fit within Linux sun_path limits.
What probe.sh verifies
Section titled “What probe.sh verifies”- Pre-admission isolation: verifies TCP port
2222on the Door is unreachable from bothrequesterandoutsiderbefore an nftables timed permit exists. - Certificate and principal enforcement: verifies OpenSSH accepts the host-signed certificate with the exact expected principal (
knock-fixture) while rejecting a wrong principal and raw uncertified public key. - Kernel expiry independent of sshd: starts a long-running workload (
setsiddetached child) inside the session’ssystemd-rununit, confirms the WireGuard handshake succeeds, then waits for the kernel nftables timed set to expire and verifies traffic stops whilesshdis still running. - Cgroup descendant cleanup: waits for
RuntimeMaxSec(KillMode=control-group) to terminate the session unit and verifies both the detachedsetsidworkload PID and its systemd cgroup directory are completely gone.