own-VPS: the takeover mints a new host identity but the carrier's pinned known-hosts never rotates — supply refuses with a correct MITM warning #438

Closed
opened 2026-08-11 17:24:32 +00:00 by ben · 1 comment
Owner

Drive 20260811T165115Z (post-#432/#437): activation + clan membership green, supply reconnects to the real box (8dabf03) with the pinned own-VPS known-hosts posture — and hits a HARD host-key refusal:

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
Offending ED25519 key in …/state/own-vps/known_hosts:1
Host key for <droplet-ip> has changed and you have requested strict checking.

Why — the takeover changes the box's SSH identity and the pin never rotates

  • At connect the carrier pins Ubuntu's host key (accept-new, ADR 0152 — "the box's real SSH host key, learned at connect").
  • nixos-anywhere wipes the box; the fresh NixOS generates a new host key. The install legs pass --host-key-check none, so they never notice.
  • Supply is the first pinned-posture reconnect after the identity change → correct MITM refusal, missing rotation step. Fleet/enrolment's #437 tunnels ride the same pin and will refuse identically.

Fix — rotate the pin at the reboot boundary

At install · reboot: reboot complete (a moment authenticated by the continuity of the install the carrier itself just performed), drop the old pin for the IP (ssh-keygen -R on the own-VPS known_hosts file, or rewrite the entry) and re-learn the new key on the first post-reboot connect (accept-new against the now-empty entry). Everything downstream (supply, #437's -L forwards, enrolment) then rides the NixOS pin. ADR 0152's "host key rides the pair record" should carry the post-takeover key — amend the pair record write accordingly (the pre-takeover key stops being meaningful the moment disko runs).

Seam test: fake carrier records the known-hosts entry across the reboot boundary; a supply/fleet connect that still sees the pre-takeover pin is a red.

Note the sibling class already fixed harness-side in #393 (recycled DO IPs vs the WORKSTATION's known_hosts) — this is the same truth on the product side: an own-VPS takeover ALWAYS changes the host identity, for every real operator.

Blocks the standing drive issue #378 via native dependency. Pre-filed with the run's signature so the reporter appends future evidence here (the healed-path re-drive would otherwise red identically).

drive 20260811T165115Z red at wizard: host key verification failed at supply after takeover
evidence: test-results/…/20260811T165115Z/ on matou-workstation (founding-state fault carries the full ssh warning)

Drive `20260811T165115Z` (post-#432/#437): activation + clan membership green, supply reconnects to the real box (`8dabf03`) with the pinned own-VPS known-hosts posture — and hits a HARD host-key refusal: ``` WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! Offending ED25519 key in …/state/own-vps/known_hosts:1 Host key for <droplet-ip> has changed and you have requested strict checking. ``` ## Why — the takeover changes the box's SSH identity and the pin never rotates - At connect the carrier pins **Ubuntu's** host key (accept-new, ADR 0152 — "the box's real SSH host key, learned at connect"). - nixos-anywhere wipes the box; the fresh NixOS generates a **new** host key. The install legs pass `--host-key-check none`, so they never notice. - Supply is the first pinned-posture reconnect after the identity change → correct MITM refusal, missing rotation step. Fleet/enrolment's #437 tunnels ride the same pin and will refuse identically. ## Fix — rotate the pin at the reboot boundary At `install · reboot: reboot complete` (a moment authenticated by the continuity of the install the carrier itself just performed), drop the old pin for the IP (`ssh-keygen -R` on the own-VPS known_hosts file, or rewrite the entry) and re-learn the new key on the first post-reboot connect (accept-new against the now-empty entry). Everything downstream (supply, #437's `-L` forwards, enrolment) then rides the NixOS pin. ADR 0152's "host key rides the pair record" should carry the **post-takeover** key — amend the pair record write accordingly (the pre-takeover key stops being meaningful the moment disko runs). Seam test: fake carrier records the known-hosts entry across the reboot boundary; a supply/fleet connect that still sees the pre-takeover pin is a red. Note the sibling class already fixed harness-side in #393 (recycled DO IPs vs the WORKSTATION's known_hosts) — this is the same truth on the product side: an own-VPS takeover ALWAYS changes the host identity, for every real operator. Blocks the standing drive issue #378 via native dependency. Pre-filed with the run's signature so the reporter appends future evidence here (the healed-path re-drive would otherwise red identically). drive `20260811T165115Z` red at `wizard`: `host key verification failed at supply after takeover` evidence: `test-results/…/20260811T165115Z/` on matou-workstation (founding-state fault carries the full ssh warning) <!-- rehearsal-sig: dcf630511b50 -->
Author
Owner

Fixed in 14e7b5c (on origin/main).

Root cause confirmed: the connect leg pins Ubuntu's host key (accept-new, ADR 0152); nixos-anywhere then wipes the box and the fresh NixOS mints a NEW host key, and the install legs pass --host-key-check none, so the pin never rotated. Supply — the first pinned-posture reconnect — refused with the correct MITM warning.

Fix: a new founding.OwnVPSCarrier.RotateHostKey(ctx, ip) seam runs at the reboot boundary, before supply. The real adapter (fleetwire.OwnVPSCarrier) drops the stale pin (ssh-keygen -R on the own-VPS known-hosts) and re-learns the box's fresh key against the now-empty accept-new entry, returning it in wire form. runOwnVPSJourney calls it after the install completes and before supply, overwriting facts.SSHHostKey so the pair record carries the POST-takeover key (ADR 0152 amended). Everything downstream (supply, #437's -L forwards, enrolment) then rides the NixOS pin. A rotate red is a resumable fault, never a stale-pin supply.

Tests (red→green):

  • internal/fleetwire/carrier_test.go — RotateHostKey drops the stale pin + re-learns over the remote accept-new/ambient-key posture and returns the fresh key; no-key-reported and drop-failure paths fail loud.
  • internal/founding/ownvpspath_test.go — the pin is rotated for the box before supply (a supply reconnect still seeing the pre-takeover pin is a modelled red), the pair record carries the post-takeover key, and a rotate failure is a resumable fault that never drives supply.

Verified via nix develop .#go-ci (build/vet/test; the pre-push gate ran the full suite green). Unblocks #378's next drive past supply.

Fixed in `14e7b5c` (on `origin/main`). **Root cause confirmed:** the connect leg pins Ubuntu's host key (accept-new, ADR 0152); nixos-anywhere then wipes the box and the fresh NixOS mints a NEW host key, and the install legs pass `--host-key-check none`, so the pin never rotated. Supply — the first pinned-posture reconnect — refused with the correct MITM warning. **Fix:** a new `founding.OwnVPSCarrier.RotateHostKey(ctx, ip)` seam runs at the reboot boundary, before supply. The real adapter (`fleetwire.OwnVPSCarrier`) drops the stale pin (`ssh-keygen -R` on the own-VPS known-hosts) and re-learns the box's fresh key against the now-empty accept-new entry, returning it in wire form. `runOwnVPSJourney` calls it after the install completes and before supply, overwriting `facts.SSHHostKey` so the pair record carries the POST-takeover key (ADR 0152 amended). Everything downstream (supply, #437's `-L` forwards, enrolment) then rides the NixOS pin. A rotate red is a resumable fault, never a stale-pin supply. **Tests (red→green):** - `internal/fleetwire/carrier_test.go` — RotateHostKey drops the stale pin + re-learns over the remote accept-new/ambient-key posture and returns the fresh key; no-key-reported and drop-failure paths fail loud. - `internal/founding/ownvpspath_test.go` — the pin is rotated for the box before supply (a supply reconnect still seeing the pre-takeover pin is a modelled red), the pair record carries the post-takeover key, and a rotate failure is a resumable fault that never drives supply. Verified via `nix develop .#go-ci` (build/vet/test; the pre-push gate ran the full suite green). Unblocks #378's next drive past supply.
ben closed this issue 2026-08-11 17:54:35 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#438
No description provided.