my-homelab-configs/docs/network-sandbox.md

4.8 KiB

Isolated network sandbox

./jeannie network-sandbox plan reports the intended guest identities and host prerequisites. prepare creates the isolated VLAN-aware vmbr9 and SSD-backed jeannie-sandbox storage after running the sandbox unit checks. The bridge is transient and the storage definition persists across reboot.

./jeannie network-sandbox provision creates OpenWrt VM 9100 and Alpine ARM64 containers 9110 and 9111 on VLANs 10 and 20. It requires an empty, marked vmbr9, the expected writable SSD, the sandbox storage definition, available guest IDs, KVM, and an SSH public key. It verifies downloaded images against checksums retrieved from the official distribution servers. It never adopts or overwrites existing guest IDs, and preserves partially created resources on failure for inspection.

Guests are created stopped and the OpenWrt WAN virtual link is disconnected. network-sandbox start starts only the dedicated sandbox guests after verifying their identity, isolation and host routes; stop stops only those guests. network-sandbox verify checks running guests, the disconnected WAN setting, live bridge VLAN assignments, client addresses, cross-VLAN ICMP replies, and TCP connections to temporary listeners in both directions. Each TCP probe requires a successful connection from the listener's own namespace first. The listeners are removed when verification finishes. These selected probes do not prove complete isolation or establish readiness to enable WAN access. These lifecycle commands are independent of K3s. The cluster runtime guard checks declared control-plane and worker VM IDs and Pimox cluster VM names; it does not depend on sandbox guests, bridge, storage, or health. Keep custom cluster guests declared in the inventory or VM ID overrides so that the guard recognizes them. The WAN stays disconnected by default.

./jeannie network-sandbox wan-probe runs verification, then temporarily connects the router WAN to test TCP internet access from each client. Before connecting, it installs a temporary host-side tc guard on the sandbox WAN tap, using tc or, if unavailable, dedicated ebtables filter chains. The bridge fallback also drops frames addressed to the host. The guard blocks private, link-local and Tailscale IPv4 destination ranges, permits other IPv4 and ARP, and drops other Ethernet protocols. It checks that each client can reach 1.1.1.1:443 and cannot reach the hypervisor's SSH port, for which it first establishes a host-side positive control. These sampled checks do not prove every service, protocol, or firewall rule works. The probe requires a supported tc or legacy ebtables bridge filter, QEMU QMP access and host SSH listening on vmbr0; it refuses to proceed if it cannot install its guard. A detached watchdog brings the sandbox WAN tap down after two minutes if the probe is interrupted. The persistent VM configuration remains disconnected. If cleanup fails, run ./jeannie network-sandbox wan-reset to isolate the tap and remove the owned guard before retrying. This test does not enable permanent internet access.

./jeannie network-sandbox isolation-tests runs the verification and WAN probe together with additional learning exercises. It checks each VLAN's gateway DNS service, reports ICMP separately (the default firewall rejects it), and sends UDP between temporary client listeners in both directions, after proving each listener works locally. A peer UDP response is a failure; a timeout is only an observation, and a failed local control is inconclusive. The final stage temporarily enables WAN using the same guarded probe described above, then disconnects it. The command stops on a failed or inconclusive stage; it does not exhaustively prove isolation against every protocol.

./jeannie network-sandbox capture vlan10 captures traffic while the full isolation suite runs. Choose vlan10, vlan20, trunk, or wan; the WAN choice observes only the sandbox router tap. The Orange Pi must have tshark installed. Captures stop after the suite, 180 seconds, or approximately 20 MiB, whichever comes first; reaching a limit before the suite ends is reported as an incomplete capture. Jeannie reports the paths to traffic.pcapng, a text summary with protocol, IPv4 conversation, DNS and TCP retransmission sections, and capture diagnostics. They are stored in a root-only directory on the sandbox SSD under /data/jeannie/network-sandbox/captures/. Open the capture in Wireshark after copying it securely if detailed inspection is needed. Packet captures and reports can contain sensitive traffic: keep them private and do not commit them. A missing response alone does not identify the firewall rule that handled a packet. The existing cluster bridge, host addresses, and existing VM disks are not modified by this workflow. Download and disk-import staging files remain under /data/jeannie/network-sandbox after provisioning.