void-box logoVoid-Box
Wire Protocol

Host-Guest Communication

Host and guest communicate over AF_VSOCK (port 1234) using the void-box-protocol crate. The protocol uses a simple length-prefixed binary framing with JSON payloads.

Frame Format

Binary frame layout
+---------------+-----------+--------------------+
| length (4 B)  | type (1B) | payload (N bytes)  |
+---------------+-----------+--------------------+
FieldSizeDescription
length4 bytesu32 little-endian, payload size only (excludes the 5-byte header)
type1 byteMessage type discriminant
payloadN bytesJSON-encoded body

Message Types

Type ByteDirectionMessageDescription
0x01host → guestExecRequestExecute a command (program, args, env, timeout)
0x02guest → hostExecResponseCommand result (stdout, stderr, exit_code)
0x03bothPingSession authentication handshake
0x04guest → hostPongAuthentication reply with protocol version
0x05host → guestShutdownRequest guest shutdown
0x0Ahost → guestSubscribeTelemetryStart telemetry stream
0x0Bhost → guestWriteFileWrite file to guest filesystem
0x0Cguest → hostWriteFileResponseWrite file acknowledgement
0x0Dhost → guestMkdirPCreate directory tree
0x0Eguest → hostMkdirPResponseMkdir acknowledgement
0x0Fguest → hostExecOutputChunkStreaming output chunk (stream, data, seq)
0x10host → guestExecOutputAckFlow control ack (optional)
0x11bothSnapshotReadyGuest signals readiness for live snapshot

Security

MAX_MESSAGE_SIZE

64 MB — prevents OOM from untrusted length fields. Messages exceeding this limit are rejected before allocation.

Session Secret

32-byte hex token injected as voidbox.secret=<hex> in kernel cmdline. The guest-agent reads it from /proc/cmdline at boot and requires it in every ExecRequest.

ExecRequest Debug Redaction

The Debug impl for ExecRequest redacts environment variables matching KEY, SECRET, TOKEN, PASSWORD patterns — preventing accidental credential exposure in logs.

Network Layout (SLIRP)

VoidBox uses smoltcp-based usermode networking (SLIRP) — no root, no TAP devices, no bridge configuration.

Network topology
Guest VM                                    Host
+---------------------+                    +------------------+
| eth0: 10.0.2.15/24  |                    |                  |
| gw:   10.0.2.2      |-- virtio-net ------| SLIRP stack      |
| dns:  10.0.2.3      |   (MMIO)           | (smoltcp)        |
+---------------------+                    |                  |
                                           | 10.0.2.2 -> NAT  |
                                           |   -> 127.0.0.1   |
                                           +------------------+

Guest/Host IP Details

EndpointAddressDescription
Guest IP10.0.2.15/24Static IP assigned to guest eth0
Gateway10.0.2.2Mapped to host 127.0.0.1 — guest reaches host services via this address
DNS10.0.2.3Forwarded to host resolver

Outbound TCP/UDP is NATed through the host. The guest reaches host services (e.g. Ollama on :11434) via 10.0.2.2.