unkernel-rs Quickstart: Rootless Linux Sandboxes in WebAssembly
Single-binary Linux 7.3.4+ (aarch64) sandboxes hosted directly on wasmtime across Linux, macOS, and Windows — completely rootless, zero /dev/kvm, zero WSL2, zero Docker, zero Node.js (NJannasch/unkernel-rs).
1. Build or Grab a Prebuilt Release Binary
# Option A: Linux / macOS tarball (v0.5.0)
curl -fsSLO https://github.com/NJannasch/unkernel-rs/releases/download/v0.5.0/unkernel-rs-v0.5.0-x86_64-unknown-linux-gnu.tar.gz
tar -xzf unkernel-rs-v0.5.0-x86_64-unknown-linux-gnu.tar.gz
cd unkernel-rs-v0.5.0-x86_64-unknown-linux-gnu
# Option B: Build from source (Rust 1.95+)
git clone https://github.com/NJannasch/unkernel-rs && cd unkernel-rs
cargo build --release
Windows (PowerShell — zero WSL2 / zero Hyper-V):
Invoke-WebRequest -Uri https://github.com/NJannasch/unkernel-rs/releases/download/v0.5.0/unkernel-rs-v0.5.0-x86_64-pc-windows-msvc.zip -OutFile unkernel-rs.zip
Expand-Archive unkernel-rs.zip -DestinationPath .
cd unkernel-rs-v0.5.0-x86_64-pc-windows-msvc
.\unkernel-rs.exe fetch
.\unkernel-rs.exe exec -m C:\work:/workspace:cow --show-diff -- sh -c "uname -a && ls /workspace"
2. Fetch Kernel & Precompile .cwasm AOT Cache
Downloads and SHA-256-verifies the pinned unkernel bundle + Alpine rootfs (~5 ms cached load afterward):
./unkernel-rs fetch
3. Air-Gapped, Landlock-Sandboxed Exec & Fake Root
# Disposable air-gapped Linux command (no network, no host FS)
./unkernel-rs exec --sandbox -- uname -a
# Fake root inside the guest without root on the host
./unkernel-rs exec --sandbox -u root -- id
# Scoped 9P2000.L host mount (canonical root confinement; append :ro for read-only)
./unkernel-rs exec --sandbox -m ./work:/workspace:ro -- ls -la /workspace
4. Persistent ext4 Disk + Immutable COW Snapshot
Install packages once into a sparse 4 GiB ext4 overlay, then boot clean air-gapped copies forever:
# Install jq with domain-allowlisted NAT (LAN/loopback blocked by default)
./unkernel-rs exec --sandbox --net --allow-host alpinelinux.org \
--disk ./tools.ext4 -u root -- apk add --no-cache jq
# Reuse air-gapped in-memory COW mode (host tools.ext4 stays byte-for-byte untouched)
./unkernel-rs exec --sandbox --offline \
--disk ./tools.ext4 --disk-snapshot -- jq --version
5. Forensic Inspection (Process VMI, Zero-CA TLS 1.3 Decryption & Freeze-on-Ask)
Stream untamperable JSONL telemetry (proc.exec, DNS, TLS SNI, decrypted HTTPS payloads + Wireshark SSLKEYLOGFILE, 9P FS with process attribution) and freeze the entire guest Linux kernel + clock before .env/key reads, file writes, or outbound TCP connects:
# Interactive freeze-on-ask + Copy-on-Write (:cow) workspace staging (zero host mutation)
./unkernel-rs exec --sandbox \
-m ./untrusted-repo:/workspace:cow --show-diff \
--audit --audit-file ./audit.jsonl \
--ask-net --ask-fs-write --ask-sensitive --freeze-on-ask \
-- sh -c 'cat /workspace/.env; wget -qO- https://example.com'
# Zero-CA HTTPS decryption straight from SharedMemory (works for OpenSSL & Go) + Wireshark keylog
./unkernel-rs exec --sandbox --vmi-tls --tls-keylog ./sslkeylog.txt --audit \
-- wget -qO- https://example.com
# Transparent host TLS MITM proxy with ephemeral per-VM lab CA (forces HTTP/1.1)
./unkernel-rs exec --sandbox --mitm-tls --audit \
-- wget -qO- https://example.com
6. Long-Lived NDJSON Daemon (for AI Agents & External Controllers)
./unkernel-rs serve --sandbox --audit \
--ask-net --ask-fs-write --ask-sensitive --freeze-on-ask \
-m ./work:/workspace:rw
Send concurrent control commands on stdin while exec requests run in worker threads:
{"id":1,"cmd":"cat /workspace/.env","cwd":"/workspace"}
{"id":"a1","approve":1,"decision":"deny_once"}
{"id":"p1","pause":true}
{"id":"ps1","procs":true}
{"id":"p2","resume":true}
{"id":"d1","diff":"/workspace"}
{"id":"s1","snapshot":"cp1"}
{"id":"r1","restore":"cp1"}
{"shutdown":true}
7. Multi-VM Virtual L2 Switch Lab (switch0 + Cable-Cut Chaos + Wireshark PCAPng)
Boot multiple isolated Linux VMs connected over an in-process learning Layer-2 Ethernet switch (inspired by unlab.run):
# Scripted 2-node lab with cable cut, recovery, MAC table & Wireshark PCAPng capture
./unkernel-rs lab --node web --node client --pcap ./lab.pcapng \
--run "client:ping -c 2 -W 2 web" \
--run "cut:web" \
--run "client:ping -c 1 -W 1 web" \
--run "reconnect:web" \
--run "macs"
# Interactive / NDJSON control loop (type: exec, cut, reconnect, drop, delay, stats, macs, quit)
./unkernel-rs lab --nodes 3 --pcap ./cluster.pcapng
8. Launch the “Catch Me If You Can” Red-vs-Blue WebUI
# Solo split-screen demo at http://127.0.0.1:8787/
cargo run --release --example catch_me_if_you_can
# Two-player LAN mode (/red vs token-protected /blue?token=...)
cargo run --release --example catch_me_if_you_can -- --bind 0.0.0.0:8787