rented gateway deploy: control-plane probe hard-refuses on a changed SSH host key the rented (VMMode) path's own design says can never change #707
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.
Reference
Matou/idss#707
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?
Failure
Drive
20260823T132050Z, legactivation, signature4c82deb1e678. The journey'sthrowOnDeployFailurefired on a real, honestly-surfaced deploy failure (not a hang/journey-fault — #700 already fixed that presentation bug):logs/founding-state.log'sstandup.deploy.failure.tailcarries the real transport error fromprobeControlPlaneActive(internal/founding/deploy.go:1105-1143, called atdeploy.go:527):The droplet was unreachable by the time evidence-gather ran post-drive (
logs/droplet-journal.txt:ssh: connect ... Connection timed out), so live re-inspection of the box is not possible from this evidence alone.Why this should not be possible on the rented path
The rented carrier is explicitly documented as never rotating the box's host key:
internal/founding/rentedpath.go:31-35: "minus the takeover... nothing to install and nothing to overwrite", "no RotateHostKey (no reboot — the box keeps the host key connect learned)".internal/founding/standuprented.go:15-22: "no host-key rotation across a reboot ... 'Rent a server' IS the consent (a fresh...)".internal/founding/deploy.go:346-388callsRotateHostKeyspecifically because itsFullInstalltakeover reboots into a fresh NixOS with a new identity.Yet this run's
known_hosts(state/own-vps/known_hosts, 1 entry — the key pinned at theconnectleg) is exactly what the laterdeployleg'sUnitActiveprobe checked and hard-refused against, perinternal/clan/adapter.go:66-73's own comment:sshKnownHostsFilepinsUnitActive's host-key check so it isn't fooled by "a stale ~/.ssh/known_hosts entry for a DigitalOcean-reused IP, whose changed key StrictHostKeyChecking=accept-new HARD-refuses as a false MITM alarm" — the exact symptom seen here, just ~21 minutes into the SAME drive rather than across drives/IP-reuse.Between
connect(host key learned, pinned) and thedeployleg's post-activation probe,enroll-configurelogs "machine vars generated (clan-core generators, unsandboxed — pinned code, ADR 0126)" andenroll-build/enroll-copy/enroll-activateapply the composed gateway config viaclan machines update ... --host-key-check none(internal/clan/enrollment.go:917) — activation deliberately does NOT check the host key going IN. The leading theory: something in the composed gateway config or clan-core's machine-vars generators manages/regenerates the box's SSH host key as a side effect of applying community config (aservices.openssh.hostKeysdeclaration or a clan-core generator that mints a fresh host identity), silently violating the rented path's "box keeps the key connect learned" guarantee. The alternative — a genuine one-off DigitalOcean-side event (droplet rebuild/migration) — is possible but doesn't explain whydeploy.go:536-537already carries a comment naming a PRIOR rented drive (#700) that hit this identical class of failure ("the rented #700 drive" — REMOTE HOST IDENTIFICATION HAS CHANGED on the rented path), suggesting this is reproducible, not a one-off.What plugging it needs
/etc/ssh/ssh_host_ed25519_key.pubright afterconnectpins it, then again afterenroll-activatecompletes, to confirm the key actually changes during config convergence (not at boot).enroll-configure"machine vars generated" step) touches SSH host keys, and either (a) make the composed config preserve the golden image's pre-existing host key, or (b) give the rented path its own post-activation host-key re-learn/re-pin step (parallel to own-VPS'sRotateHostKey,deploy.go:346-388) that updatesstate/own-vps/known_hostsbeforeprobeControlPlaneActiveruns. Option (b) is a real design call (the rented path's whole pitch is "no rotation needed") — likely ADR-worthy, same as #700's ADR-0174 two-way-door ruling.buildDeployFailure(internal/founding/deploy.go:979-999) branches only onmode == enroll.ModeVMvs else, so a rented-path failure (which also carriesenroll.ModeFull, same as own-VPS/self-hosted) gets the own-VPS/self-hosted copy verbatim — "this machine was taken over for the community", "no old operating system to roll back to" — even though the rented path's own S9 card explicitly says the opposite ("no takeover — a fresh server has nothing to erase", visible in this run'serror-context.mdFACTS line). This directly contradicts the app's own copy elsewhere and should key offDraft.Access.Kind(mirroringselfHostedFullInstall,internal/founding/selfhostedpath.go:86-88) rather thanModealone — worth fixing alongside item 2, but on its own it would not have turned this drive green.Suspected layer: clan-core machine-vars generation / composed gateway NixOS config (SSH host key management), surfaced through
internal/founding/deploy.go's control-plane probe andinternal/clan/adapter.go's known-hosts pin.drive
20260823T132050Zred atactivation:the gateway deploy failed — The gateway deploy failed. [There is no old operating system to roll back to — this machine was taken over for the community.]evidence:
test-results/…/20260823T132050Z/on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)Close report — root cause found, reproduced live, fixed, and the fix proven live
Ruled by agent under ADR 0174 — veto anytime. Two-way door: two revertible source changes, proven by Go contract tests, a real
nix evalof the composed image, and a live before/after on rented droplets. No security-posture widening — the posture TIGHTENS (from one shared host identity across every community to one unique per box).What actually happened
The ticket's leading theory was the composed gateway config or a clan-core machine-vars generator minting a host identity. That is not it — I checked: nothing in this repo declares
services.openssh.hostKeys, and clan-core's only host-key generators live in thesshdandadminclanServices, neither of which the inventory attaches.It is the image, and two defects compound. Reproduced live on two droplets rented from snapshot
idss-gateway-01eedc890405:scripts/gateway-image/build.shsnapshotted the build droplet with/etc/ssh/ssh_host_*_keyin place. The "generic" image (ADR 0048) therefore carried an SSH identity. Both probe droplets served the byte-identical ed25519 key…RDQpZNx— every community's rented gateway presents the same host key, and that is the keyconnectpins and the pair record carries.cloud-init's
sshconfig module defaultsssh_deletekeys: true— it deletes/etc/ssh/ssh_host_*and mints fresh ones. That module is load-bearing here (it is what lands DO's create-timessh_keysin/root/.ssh/authorized_keys), but nixpkgs orderscloud-config.serviceagainst nothingsshd.servicewaits on: onlycloud-init.serviceisbeforesshd, and thesshmodule does not run in that stage.The measurement
So the box served an identity that no longer existed on disk for the whole drive.
connectpinned the orphan. Then:The first thing to restart sshd is
enroll-activate'sswitch-to-configuration switch. The box flips identity there, and the deploy stage's pinnedprobeControlPlaneActivecorrectly screams MITM. Deterministic, not a one-off — which is why #700, #704 and this drive all wear the same signature.The fix (commit
d62a7252)nix/gateway-image/configuration.nixpinsservices.cloud-init.settings.ssh_deletekeys = false— cloud-init generates only MISSING keys, so the key sshd mints in its ownExecStartPre(sshd-pre-start, immediately before it binds) is the box's permanent identity. Thesshmodule still runs, so DO key injection is untouched.scripts/gateway-image/build.shscrubs/etc/ssh/ssh_host_*off the build droplet before the snapshot (new step 4), so that boot-minted key is unique per droplet rather than shared.Proof
nix evalof the composed image — the generated/etc/cloud/cloud.cfgnow carriesssh_deletekeys: falsewithsshstill incloud_config_modules.internal/clan/gateway_image_hostkey_test.goguards both halves (red before / green after).gofmt,go vetand the fullinternal/...suite green. Both lab droplets destroyed (zeroidss-707-probedroplets remain).Ticket item 3 — also fixed
buildDeployFailure(internal/founding/deploy.go) branched onModealone, so a rented failure (alsoenroll.ModeFull) got the own-VPS/self-hosted copy verbatim. The no-rollback sentence now keys offDraft.Access.Kind, mirroringselfHostedFullInstall: a rented failure says the server was rented fresh for the community, so nothing of yours was overwritten; a self-hosted one still names the takeover it really made. Two new seam tests, red before / green after.Deliberately NOT done — ticket item 2 option (b)
I did not add a rented-path
RotateHostKeyre-learn. It would have turned the drive green by auto-accepting whatever key the box presents — laundering a real host-identity change into a silent accept, on the one path whose whole pitch is "no rotation needed". With the cause removed there is nothing to re-learn, and the refusal stays honest. This is recorded as a corollary in GOTCHAS #63, so a future session does not reach for it.Left open / filed elsewhere
Connection timed out) is not explained by this — a changed host key is a refusal, not a timeout. That remains #703, and GOTCHAS #62 still stands for it. This fix removes one of the two confounded symptoms, which should make #703's next drive much easier to read.idss-gateway-rehearsal-rentfail-*keys on the account, name prefix doubled. Found during this diagnosis, out of scope here.rehearsal-cycle.sh's auto-rebuild loop (#661) does on the next cycle. The next rented drive pastenroll-activateis the tightening evidence.GOTCHAS #63 added;
STATUS.mdheader updated in the same commit.supply#1048