Skip to content

feat(ui): add, check and remove a Secure VM from the Fleet page - #911

Closed
Amigadelasmigas wants to merge 12 commits into
GeiserX:mainfrom
Amigadelasmigas:feat/secure-vm-fleet
Closed

Amigadelasmigas wants to merge 12 commits into
GeiserX:mainfrom
Amigadelasmigas:feat/secure-vm-fleet

Conversation

@Amigadelasmigas

@Amigadelasmigas Amigadelasmigas commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A Secure VM can only be added, checked or removed from a root shell on the host. The Fleet page showed that a host has KVM, but not how to use it, and it showed a Secure VM's worker as a plain worker.

A host with KVM now gets a Secure VM panel. Without a VM, the panel shows the one install command, pinned to the release tag and the script's SHA-256. The command has this UI's address and the host's name filled in. The fleet key is never in it, because the installer asks for it. With a VM, the panel shows its fence and its last self-test, a Run the self-test button, and the status, verify and remove commands. The button waits 5 minutes after a result, because the host's guard drops a request that comes sooner. The VM's own worker gets a "Secure VM on " flag. A host without KVM says so, and a phone or a Desktop gets no panel.

This PR holds the commits of #894 and #910 until they merge. Its own commit is the last one. Merge it after #910 and #896: the button calls the route that #896 adds.

Desktop needs nothing: no catalog, deploy form, deploy validation or guide fact changes.

Screenshot: a local run of this branch with demo workers. The top host has no VM. The middle host has one, and the VM's worker is the last row.

secure-vm-fleet-panel

Type of Change

  • Feature

Checklist

  • ruff check app/ passes
  • ruff format --check app/ passes
  • No credentials or secrets committed
  • CashPilot-Desktop follow-up linked, or the Summary says why Desktop needs nothing

…cales

The web UI is English only. This adds what the 20 languages need and
changes nothing visible yet: only English ships, so the picker stays
hidden until a second locale file exists.

- app/i18n: one JSON file per locale; translations carry the hash of
  their English source and fall back to English when stale or missing.
- Language order: saved choice, cp-lang cookie, Accept-Language, English.
- t() in templates and the browser, one ICU subset on both sides; server
  plural rules checked against Node's Intl.
- Picker in the avatar menu and the sign-in bar; user_preferences.language
  with a migration; <html lang dir> on every page.
…ort what each host can give

The runtime choice was env-only, so an owner could not pick gVisor for one
earner from the UI, and the UI could not show which earners really got it.

- The heartbeat reports system_info.layers: the runtimes Docker registered and
  which are gVisor (judged by the binary, not the name), KVM from sysfs, and
  what CASHPILOT_CONTAINER_RUNTIME and its overrides pin. Unread values are
  null, so an older or blind worker reads as unknown, not absent.
- Each container entry carries its runtime and network.
- A deploy takes runtime_choice, runc or gvisor. gVisor becomes the
  --network=host variant Docker's DNS needs on our bridge, plus --net-raw for
  an earner whose catalog declares NET_RAW (Bitping).
- A choice that the catalog (Mysterium needs runc) or an env pin overrules is
  refused with the reason before the running container is touched. The env
  still wins over the UI; nothing is swapped silently.
- No choice means Docker's default, as before.
…h a red/green check

Installing gVisor needs root on the host, which the worker does not have and
must not get, and a runtime's name proves nothing: runsc-hostnet can point at
runc.

- scripts/cashpilot-gvisor (install, status, undo) pins gVisor release
  20261123.1 by sha512, installs it apart from any runsc the owner has, backs
  up daemon.json and registers runsc-hostnet and runsc-hostnet-raw with
  runsc's own installer. It reloads Docker, so running containers keep
  running; a restart is offered only if the reload is not enough, and always
  asked for, even with --yes. It refuses on Unraid (pointing to a VM), Docker
  Desktop, rootless and snap Docker.
- undo refuses while a container still uses our runtimes, restores daemon.json
  byte for byte (or removes only our runtimes after a later edit), deletes the
  binaries and its state, and checks that nothing is left.
- POST /api/layers/gvisor-check runs one probe per gVisor runtime an earner
  would get, on the earners' network: green needs gVisor's kernel and a
  working name lookup. The heartbeat carries the last answer.
…er from the Fleet page

The Fleet page gets a Security layers row per worker: the socket proxy, the
LAN fence, gVisor and KVM for the Secure VM, then per earner whether it is
fenced and whether it runs under Standard (runc) or gVisor. The owner picks
the runtime per earner or as the worker's default for new earners. A choice
the catalog, an env pin or the worker cannot honour is locked with the
reason. A running earner is redeployed after a confirm.

The row also shows the pinned install and undo commands for cashpilot-gvisor
and runs the worker's red/green gVisor check. The dashboard row carries a
compact fenced/runtime badge per copy.
…ntime choice that a named runtime or a routed copy cannot honour
…eep its runtime through a restore or a later env pin
…e command

An earner that escapes its container lands on the host today. scripts/cashpilot-vm
installs one QEMU/KVM guest per computer, an opt-in layer: Debian 13 pinned by
SHA-512, Docker, gVisor as the earners' runtime, and a CashPilot worker that
enrols with the fleet key. The guest's only link is in a network namespace of its
own, fenced so it reaches the UI and the internet and nothing else. A guard checks
the fence every 60 s and at boot, cuts the link on any drift and reconnects only
on an exact match. `verify` probes from the guest with live controls; `remove`
stops the guest worker, asks the UI to forget it, deletes everything and proves
nothing is left. Works on systemd hosts and on Unraid.
A host with KVM gets a Secure VM panel with the one command that installs it,
pinned to the release tag and the script's SHA-256, with the UI's address and
the host's name filled in. The fleet key is never in it: the installer asks.
A host with a Secure VM shows the VM's fence and last self-test, a button that
asks the host for a new self-test, and the status, verify and remove commands.
The VM's own worker is flagged "Secure VM on <host>".
@coderabbitai

coderabbitai Bot commented Nov 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 53 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between fd093f6 and 6d77939.

Files selected for processing: 53

  • .dockerignore
  • .github/workflows/lint.yml
  • .github/workflows/test.yml
  • Dockerfile
  • Dockerfile.worker
  • app/catalog.py
  • app/database.py
  • app/deps.py
  • app/gvisor_check.py
  • app/i18n/__init__.py
  • app/i18n/en.json
  • app/layer_scripts.py
  • app/layers.py
  • app/layers_ui.py
  • app/main.py
  • app/orchestrator.py
  • app/routers/layers.py
  • app/routers/pages.py
  • app/routers/secure_vm.py
  • app/static/css/style.css
  • app/static/js/app.js
  • app/static/js/i18n.js
  • app/templates/_i18n_scripts.html
  • app/templates/_language_picker.html
  • app/templates/_secure_vm.html
  • app/templates/auth.html
  • app/templates/base.html
  • app/templates/fleet.html
  • app/templates/onboarding.html
  • app/worker_api.py
  • docs/secure-vm.md
  • pyproject.toml
  • scripts/cashpilot-gvisor
  • scripts/cashpilot-vm
  • scripts/dashboard_row_check.mjs
  • scripts/fleet_staleness_check.mjs
  • scripts/i18n_format_check.mjs
  • services/_schema.yml
  • services/bandwidth/mysterium.yml
  • services/mining/kryptex-pearl.yml
  • services/mining/srbminer-multi.yml
  • tests/conftest.py
  • tests/fixtures/i18n_format_cases.json
  • tests/fixtures/i18n_plural_cldr.json
  • tests/test_beads_batch_3.py
  • tests/test_cashpilot_vm.py
  • tests/test_gvisor_check.py
  • tests/test_i18n.py
  • tests/test_layers.py
  • tests/test_layers_ui.py
  • tests/test_route_at_deploy.py
  • tests/test_secure_vm_ui.py
  • zensical.toml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@Amigadelasmigas

Copy link
Copy Markdown
Collaborator Author

Replaced by #920, the same work restacked on #916.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants