banger/internal/cli
Thales Maciel 6b543cb17f
firecracker: adopt firecracker-jailer for VM launch (Phase B)
Each VM's firecracker now runs inside a per-VM chroot dropped to the
registered owner UID via firecracker-jailer. Closes the broad ambient-
sudo escalation surface that survived Phase A: the helper still needs
caps for tap/bridge/dm/loop/iptables, but the VMM itself no longer
runs as root in the host root filesystem.

The host helper stages each chroot up front: hard-links the kernel
and (optional) initrd, mknods block-device drives + /dev/vhost-vsock,
copies in the firecracker binary (jailer opens it O_RDWR so a ro bind
fails with EROFS), and bind-mounts /usr/lib + /lib trees read-only so
the dynamic linker can resolve. Self-binds the chroot first so the
findmnt-guarded cleanup can recurse safely.

AF_UNIX sun_path is 108 bytes; the chroot path easily blows past that.
Daemon-side launch pre-symlinks the short request socket path to the
long chroot socket before Machine.Start so the SDK's poll/connect
sees the short path while the kernel resolves to the chroot socket.
--new-pid-ns is intentionally disabled — jailer's PID-namespace fork
makes the SDK see the parent exit and tear the API socket down too
early.

CapabilityBoundingSet for the helper expands to add CAP_FOWNER,
CAP_KILL, CAP_MKNOD, CAP_SETGID, CAP_SETUID, CAP_SYS_CHROOT alongside
the existing CAP_CHOWN/CAP_DAC_OVERRIDE/CAP_NET_ADMIN/CAP_NET_RAW/
CAP_SYS_ADMIN.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 14:38:07 -03:00
..
style cli: maturity polish — color, error translation, tabwriter consistency 2026-04-26 22:27:07 -03:00
aliases_test.go remove vm session feature 2026-04-20 12:47:58 -03:00
banger.go cli: rewrite help text for AI-driven discovery 2026-04-26 15:02:08 -03:00
bangerd.go daemon: split owner daemon from root helper 2026-04-26 12:43:17 -03:00
cli_test.go cli: maturity polish — color, error translation, tabwriter consistency 2026-04-26 22:27:07 -03:00
commands_daemon.go daemon: split owner daemon from root helper 2026-04-26 12:43:17 -03:00
commands_image.go images: remove the docker field 2026-04-26 20:28:40 -03:00
commands_internal.go cli + daemon: move test seams off package globals onto injected structs 2026-04-19 19:03:55 -03:00
commands_kernel.go cli: rewrite help text for AI-driven discovery 2026-04-26 15:02:08 -03:00
commands_ssh_config.go cli: rewrite help text for AI-driven discovery 2026-04-26 15:02:08 -03:00
commands_system.go firecracker: adopt firecracker-jailer for VM launch (Phase B) 2026-04-28 14:38:07 -03:00
commands_vm.go feat(vm): add vm exec command with workspace dirty detection 2026-04-26 23:53:45 -03:00
completion.go daemon: split owner daemon from root helper 2026-04-26 12:43:17 -03:00
completion_test.go remove vm session feature 2026-04-20 12:47:58 -03:00
daemon_lifecycle.go cli: wait for the daemon socket to answer ping after install/restart 2026-04-26 21:22:31 -03:00
daemon_lifecycle_test.go firecracker: adopt firecracker-jailer for VM launch (Phase B) 2026-04-28 14:38:07 -03:00
deps.go seams: move the last four package globals onto instance fields 2026-04-22 12:07:14 -03:00
errors.go cli: maturity polish — color, error translation, tabwriter consistency 2026-04-26 22:27:07 -03:00
errors_test.go cli: maturity polish — color, error translation, tabwriter consistency 2026-04-26 22:27:07 -03:00
formatters_test.go remove vm session feature 2026-04-20 12:47:58 -03:00
known_hosts.go daemon: split owner daemon from root helper 2026-04-26 12:43:17 -03:00
make_bundle_test.go banger internal make-bundle: build image bundles from flat rootfs tars 2026-04-17 15:17:50 -03:00
printers.go feat(vm): add vm exec command with workspace dirty detection 2026-04-26 23:53:45 -03:00
prune_test.go cli + daemon: move test seams off package globals onto injected structs 2026-04-19 19:03:55 -03:00
ssh.go smoke: five more scenarios + fix exit-code propagation bug the new ones caught 2026-04-22 19:37:07 -03:00
vm_create.go cli: maturity polish — color, error translation, tabwriter consistency 2026-04-26 22:27:07 -03:00
vm_exec.go feat(vm): add vm exec command with workspace dirty detection 2026-04-26 23:53:45 -03:00
vm_run.go daemon: split owner daemon from root helper 2026-04-26 12:43:17 -03:00
vm_spec_test.go vm defaults: host-aware sizing + spec line on spawn + doctor check 2026-04-19 13:06:51 -03:00
workspace_preview.go noteUntrackedSkipped: fix subdir underreport + be best-effort everywhere 2026-04-22 12:42:33 -03:00
workspace_preview_test.go noteUntrackedSkipped: fix subdir underreport + be best-effort everywhere 2026-04-22 12:42:33 -03:00