Firecracker gateway CA is not persisted across rebuilds — breaks running bottles (issue #450, firecracker half) #510
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Rebuilding/restarting the Firecracker gateway mints a brand-new mitmproxy CA, breaking every already-running bottle with
SSL certificate verification failedon egress.The #450 fix ("the gateway CA must survive recreation") was only implemented for the Docker backend, via the persistent
host_gateway_ca_dir()bind-mount. The Firecracker gateway had no equivalent: its CA lived only in the ephemeral per-bootrootfs.ext4, so every rebuild regenerated it.Evidence (observed)
66:63:6F:06:94:…66:63:6F:06:94:…✅C6:B1:80:C0:22:…❌agent-3 → rebuilt gateway bumps TLS with a leaf signed by
66:63:6F…→ agent-3's trust store only hasC6:B1:80…→ handshake fails.Root cause
backend/firecracker/gateway.pybooted the VM viainfra_vm.boot_vm(...)with nodata_drive— contrast the orchestrator VM, which getsdata_drive=self._ensure_registry_volume()(persistent/dev/vdb)./home/mitmproxy/.mitmproxy/inside the rootfs, whichboot_vmre-materializes fresh each boot.launch.py→egress/gateway-ca/gateway-ca.pem); it is never re-synced when the gateway rotates.Fix
Give the Firecracker gateway a persistent CA volume, mirroring the orchestrator's registry volume: boot the gateway VM with a small ext4
data_driveand mount it at mitmproxy's confdir in the gateway guest init, so the CA is reused across rebuilds.Operational caveat
The first gateway restart after the fix still mints one final CA (into the new, initially-empty volume); it persists from then on. To avoid that one-time break, seed the volume with the current gateway's CA material before restarting.
Related / out of scope
bot-bottle-orch-gatewayis attached to a stale CI CA volume (bot-bottle-ci-ca-<run>) because CI reuses the production gateway singleton name — separate latent issue.orchestrator/rotate_ca.pyis docker-only.