guest-trust rotation: restart on trust-file change, and a post-converge rotation story (ADR 0126 follow-up) #274
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#274
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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?
The ADR 0126 arc landed guest-trust delivery as a one-shot: sshkey.Ensure mints once, the VM manager writes the trust file and hands it to the guest via fw_cfg, and the guest's mint service installs it at boot. The final whole-branch review traced a rotation dead end across three pieces:
sshkey.Ensure's mismatch error says "delete both to re-mint" — but if an operator does that, the new trust file is written whileupgradeUnit(internal/vm/manager.go) compares only the UNIT rendering: identical unit → no restart → the running guest keeps the OLD fw_cfg blob. Every subsequent verify fails auth as a resumable block whose remedy text cannot fix it.boot.kernelModules = ["qemu_fw_cfg"], so fw_cfg delivery is one-shot per guest lifecycle — after the firstmachines update, a re-minted key can never land via fw_cfg at all.Wanted: a rotation story. Cheap partial fix:
upgradeUnitalso diffs the trust file and restarts when it changed (covers pre-converge rotation). The post-converge path needs a design ruling (keep the mint service in the baked baseline? rotate over SSH while the old key still works?).Found by the ADR 0126 final review (branch adr-0126-vm-standup); not on the fresh-founding happy path — founding mints once and reuses.
Triage Notes
What we've established so far:
adr-0126-vm-standup, and three code sites:sshkey.Ensure's mismatch error, anupgradeUnitfunction ininternal/vm/manager.go, and a baked-VM baseline ininternal/clan/vmguest.gothat drops the mint service +boot.kernelModules = ["qemu_fw_cfg"].docs/adr/tops out at0125-private-path-host-toolchain-is-app-managed.md(no 0126, anywhere in git history on any branch). Nosshkeypackage exists anywhere (closest analog isinternal/devicekey/devicekey.go, a different concern with a different message).internal/vm/manager.goexists but has noupgradeUnit— its only methods areCreate/Remove/Exists/Health, andCreateis already idempotent and no-ops on a second call (pinned byTestCreateIdempotent,manager_test.go:146).internal/clan/vmguest.godoes not exist. No fw_cfg/trust-file/mint-service delivery pipeline exists anywhere underinternal/.boot.kernelModules = ["qemu_fw_cfg"]does exist, but innix/guest/configuration.nix:66(unconditional guest config), not conditionally dropped by anything ininternal/clan.git fetch --all --prune) — noadr-0126-vm-standupbranch exists locally or onorigin, and no commit in this repo's full history mentions "0126" or "guest-trust".What we still need from you (@ben):
adr-0126-vm-standuppushed to a different remote, merged and then reverted, or is this describing work from a different checkout/repo that hasn't reachedMatou/ourcloudyet?git fetchrecipe) would let us re-run the verification and turn this into a proper agent brief for the "cheap partial fix" (diff the trust file in the restart-decision path, not just the rendered unit).Labelled
needs-infopending the above; re-triage once the branch/commit is identified.Triage Notes (correction)
What we've established so far:
mainand all remotes fetched at the time, found nosshkeypackage, noupgradeUnitininternal/vm/manager.go, and nointernal/clan/vmguest.go, and concluded the report didn't match anything in this repository.origin/private-standup-polish— not reconciled by the prior pass — which carries the ADR 0126 guest-trust delivery work this report describes.internal/sshkey/sshkey.go'sEnsuredoes return a "delete both to re-mint" error on a mismatch;(*Manager).upgradeUnit(internal/vm/manager.go) re-renders the guest unit but only diffs the rendered unit file, not the trust file carried via fw_cfg — so a re-minted key written after a manual delete-both won't trigger a restart; andinternal/clan/vmguest.gobakes the post-converge guest baseline. The rotation dead-end described is real on that branch.What needs deciding:
private-standup-polishhas commits from another contributor as recently as today. Whether to land a fix on that in-flight branch now, or hold until it merges tomain, needs a call.Routing to
ready-for-human(previouslyneeds-info) — the underlying gap is now confirmed in code; both the branch-coordination question and the post-converge design ruling need a human call.Ruled by Ben 2026-08-08 (decision sweep): the full rotation story. Pre-converge:
upgradeUnitalso diffs the trust file and restarts the guest when it changed. Post-converge: rotation happens over SSH while the old key still works (an authorized_keys swap) — the baked baseline keeps dropping the mint service and fw_cfg module. Fix the "delete both to re-mint" error text to describe the real procedure, and close the review's test gaps (keyless Create rendering; repeat-Create-with-key as a true no-op). →ready-for-agent.Landed the full rotation story per Ben's 2026-08-08 ruling (commit
c4b2ba9, onorigin/main).Pre-converge (the cheap partial fix):
(*Manager).Createnow reads the on-disk trust file before overwriting it and passes atrustChangedflag toupgradeUnit, which restarts the guest on a pure trust rotation (a restart re-execs qemu-system, re-reading the fw_cfg file — the only path a re-minted key reaches a pre-converge guest) as well as on a unit-rendering change. A re-mint afterdelete bothnow actually lands on the running guest instead of leaving it stuck on the OLD fw_cfg blob.internal/vm/manager.go.Post-converge: per the ruling, rotation is over SSH (authorized_keys swap) while the old key still works, so the baked baseline keeps dropping the mint service +
qemu_fw_cfgmodule BY DESIGN — recorded ininternal/clan/vmguest.go's header; no baseline behaviour change.Error text: both mismatch errors in
internal/sshkey/sshkey.gonow describe the real procedure (delete both + re-drive stand-up pre-converge; SSH rotation once converged), keeping theexists but … missingshape.Test gaps closed (red-first,
internal/vm/manager_test.go): keyless Create renders no fw_cfg + writes no trust file; repeat-Create-with-key is a true no-op; a rotated trust restarts the guest under a byte-identical unit with the SSH port preserved.go test/go vet/gofmtgreen across vm, sshkey, clan; the whole-tree pre-push gate passed. STATUS.md updated (header + milestone log).