Skip to content

fresh-install: a runner checked from inside, through a host shell, before the removal - #127

Merged
aledbf merged 1 commit into
mainfrom
fresh-install-host-check
Nov 17, 2026
Merged

aledbf merged 1 commit into
mainfrom
fresh-install-host-check

Conversation

@aledbf

@aledbf aledbf commented Nov 17, 2026

Copy link
Copy Markdown
Member

Closes #123

Host check, the last check of a run (after Posture, or after the upgrade's): it creates a workspace, picks the connected runner holding it, and opens spin admin shell open <runner> --incident --minutes 10 with hack/host-check.sh on stdin. Opening without draining keeps the machine running. The shell retires the runner afterwards, and the run removes everything next.

On the runner, as root:

  • Each qemu-system-* process: uid in the machine range (≥ 0x70000000), CapEff 0, a root other than /, an empty environment, a network namespace with only lo, and no TCP connection to 169.254.169.254:80 from it. NoNewPrivs and Seccomp are printed as INFO, not asserted: nothing in spin promises their values.
  • The egress namespace (spin-egress) cannot connect to the metadata service, which is spin#1269's output chain. If the namespace is missing, the check fails rather than passing on a refused connection.
  • The host's own root gets an IMDSv2 token, so every "cannot" above is about who's asking, not a service that's down.
  • /run/credstore is 700 root. The systemd-analyze security score of spin-runner.service and spin-boot.service is printed.

Different from the issue: it asked for a host-namespace check that a machine-range uid can't get a token. spin#1261 ended up an egress-namespace rule instead, since a machine's QEMU is already in an empty namespace and a non-root runner is never placed on in production (hostmgr.Unfit). So that check is the egress one here.

Transport: a terminal's line discipline caps a line at 4096 bytes and echoes typed input as it arrives. So the script goes over as base64 in 1000-character lines appended to /run/host-check.b64, then decoded and run. It holds its results until the end and prints them at once after a pause, so the echo can't split a line. HOST-CHECK-END last means the session finished. Simulated locally through a real pty (script -c 'bash -i'): every line arrives whole, with the two failures a laptop should give (no IMDS, no QEMU).

Not run against an account: the next scheduled fresh install is its first real run. The egress check holds even on a release without spin#1269, since the hop limit refuses the reply. It's the outcome being checked, not the rule.

task lint green: shellcheck on both scripts, actionlint, taskgate.

🤖 Generated with Claude Code

…fore the removal

The last check of a run opens an incident's root shell on the runner
holding a workspace and runs hack/host-check.sh there: each machine's
QEMU runs as a machine's uid, with no capability, a root of its own,
no environment, a namespace with only lo and no way to the metadata
service; the egress namespace cannot reach it either; the host's own
root can, so none of that is a service that is down. The script goes
over the terminal as base64 lines and says its results at once at the
end, after the terminal's echo of what was typed is done.

Closes #123

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aledbf
aledbf merged commit cf184fd into main Nov 17, 2026
1 check passed
@aledbf
aledbf deleted the fresh-install-host-check branch November 17, 2026 11:24
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.

fresh-install: a runner checked from inside, through a host shell, before the removal

1 participant