self-hosted full-install: SeedAmbient refuses on the box's post-takeover SSH host key — RotateHostKey never runs (mirrors #438) #633

Closed
opened 2026-08-21 05:27:14 +00:00 by matou-build-agent · 2 comments

Failure

Drive 20260821T051631Z, leg deploy-takeover, red:

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.]

founding-state.log's failure detail (the real cause, under the honest no-rollback headline):

fleetwire: prepare the guest dirs: fleetwire: ssh: exit status 255 — @@@...@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
...
Host key verification failed.

Root cause

The self-hosted "machine at your place" full-install path never rotates the box's pinned SSH host key across the takeover reboot, unlike the own-VPS carrier path which already solved this exact class of bug for #438.

Sequence:

  1. internal/fleetwire/relay.go:125-137 (RelayForwarder.Open) opens an ssh -N -R forward to the box over accept-new against the shared known-hosts file (ownVPSKnownHostsPath(), wired at app/helper/cmd/helper/wiring_prod.go:497-500). It's held open across the whole device-driven pairing ceremony (agent-install → consent → pair), pinning the box's pre-takeover Ubuntu SSH host key. All these legs were green in this run.
  2. internal/founding/deploy.go:336-344 calls composeSelfHostedGateway, which drives clan.Enroll's FullInstall takeover (kexec/disko/install/reboot — also all green: "install complete", "reboot complete", "the overwritten host came back a clan member"). The takeover wipes the disk; fresh NixOS mints a new SSH host key. The install phases pass --host-key-check none (internal/clan/enrollment.go installArgs), so they never notice the key changed.
  3. internal/founding/deploy.go:362-368 then calls o.guestSupply.SeedAmbient(ctx, st.GatewayIP, selfHostedSSHPort) → internal/fleetwire/supply.go:60-92 (prepare the guest dirs ssh step) — the FIRST pinned-posture reconnect after the reboot, over RemoteTarget's StrictHostKeyChecking=accept-new against the SAME known-hosts file the relay already pinned. accept-new only trusts a host with no prior entry, so it correctly refuses the now-different key as a possible MITM — reproducing verbatim in the evidence above.

The existing fix pattern (#438) not reused here

internal/founding/ownvpspath.go:381-397: right after its own FullInstall takeover, the own-VPS carrier path calls o.ownVPSCarrier.RotateHostKey(ctx, ip), which does ssh-keygen -R <ip> -f <knownHosts> then re-connects accept-new to re-pin the fresh key (internal/fleetwire/carrier.go:122-148). The self-hosted path (internal/founding/selfhostedpath.go, deploy.go) has no equivalent call between the takeover completing and SeedAmbient running.

o.ownVPSCarrier (the OwnVPSCarrier interface, which exposes RotateHostKey) is unconditionally wired in production (wiring_prod.go:416-419) regardless of which founding path is taken, so it's reachable from the self-hosted deploy code — this isn't a wiring gap, just a missing call.

Suspected layer / what plugging it needs

internal/founding/deploy.go's runDeploy, self-hosted branch (around line 344-368): after composeSelfHostedGateway succeeds (takeover done) and before guestSupply.SeedAmbient runs, call something equivalent to o.ownVPSCarrier.RotateHostKey(ctx, st.GatewayIP), with a resumable fault on failure (mirroring ownvpspath.go:390-396's wording: "the box came back with a new identity; wait for the reboot to finish, then re-drive").

This is NOT a same-day self-fix: it requires new fault-handling in deploy.go, and breaks all six existing tests in internal/founding/selfhostedpath_test.go (TestSelfHosted_DeployComposesGatewayWithClaimSecretApexAndBaseline, TestSelfHosted_OwnDomainComposesWithoutClaimSecret, TestSelfHosted_SeedsTheCommunityFlakeAndBootstrapsTheOperatorBeforeComposing, TestSelfHosted_RedriveDoesNotRecompose, TestSelfHosted_SupplyFailureRedsTheDeploy, TestSelfHosted_ResumeAfterSupplyFaultRelandsTheBinary), none of which currently wire WithOwnVPSCarrier — each needs a fake carrier wired and possibly new assertions. That's a multi-file, judgment-laden change, not a mechanical one-liner.

Worth checking during the fix: whether RotateHostKey's ssh-keygen -R should be scoped to only fire when a self-hosted relay forward actually ran (it's "always wired" per the wiring comment, so may be a safe unconditional call), and whether the resume/idempotency story matches — a resume after a supply fault should re-rotate cleanly (rotating an already-rotated pin is a no-op per carrier.go:135-136's own comment).

Evidence

  • test-results/drive-selfhosted/20260821T051631Z/logs/founding-state.log — full failure detail + event log (install/reboot green, supply red)
  • test-results/drive-selfhosted/20260821T051631Z/state/own-vps/known_hosts — the single stale pinned entry
  • Signature: 800a2936720b

drive 20260821T051631Z red at deploy-takeover: 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/…/20260821T051631Z/ on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)

## Failure Drive `20260821T051631Z`, leg `deploy-takeover`, red: ``` 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.] ``` `founding-state.log`'s failure detail (the real cause, under the honest no-rollback headline): ``` fleetwire: prepare the guest dirs: fleetwire: ssh: exit status 255 — @@@...@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ ... Host key verification failed. ``` ## Root cause The self-hosted "machine at your place" full-install path never rotates the box's pinned SSH host key across the takeover reboot, unlike the own-VPS carrier path which already solved this exact class of bug for #438. Sequence: 1. `internal/fleetwire/relay.go:125-137` (`RelayForwarder.Open`) opens an `ssh -N -R` forward to the box over `accept-new` against the shared known-hosts file (`ownVPSKnownHostsPath()`, wired at `app/helper/cmd/helper/wiring_prod.go:497-500`). It's held open across the whole device-driven pairing ceremony (agent-install → consent → pair), pinning the box's **pre-takeover** Ubuntu SSH host key. All these legs were green in this run. 2. `internal/founding/deploy.go:336-344` calls `composeSelfHostedGateway`, which drives `clan.Enroll`'s FullInstall takeover (kexec/disko/install/reboot — also all green: "install complete", "reboot complete", "the overwritten host came back a clan member"). The takeover wipes the disk; fresh NixOS mints a **new** SSH host key. The install phases pass `--host-key-check none` (`internal/clan/enrollment.go` `installArgs`), so they never notice the key changed. 3. `internal/founding/deploy.go:362-368` then calls `o.guestSupply.SeedAmbient(ctx, st.GatewayIP, selfHostedSSHPort)` → `internal/fleetwire/supply.go:60-92` (`prepare the guest dirs` ssh step) — the FIRST pinned-posture reconnect after the reboot, over `RemoteTarget`'s `StrictHostKeyChecking=accept-new` against the SAME known-hosts file the relay already pinned. `accept-new` only trusts a host with no prior entry, so it correctly refuses the now-different key as a possible MITM — reproducing verbatim in the evidence above. ## The existing fix pattern (#438) not reused here `internal/founding/ownvpspath.go:381-397`: right after its own FullInstall takeover, the own-VPS carrier path calls `o.ownVPSCarrier.RotateHostKey(ctx, ip)`, which does `ssh-keygen -R <ip> -f <knownHosts>` then re-connects `accept-new` to re-pin the fresh key (`internal/fleetwire/carrier.go:122-148`). The self-hosted path (`internal/founding/selfhostedpath.go`, `deploy.go`) has no equivalent call between the takeover completing and `SeedAmbient` running. `o.ownVPSCarrier` (the `OwnVPSCarrier` interface, which exposes `RotateHostKey`) is unconditionally wired in production (`wiring_prod.go:416-419`) regardless of which founding path is taken, so it's reachable from the self-hosted deploy code — this isn't a wiring gap, just a missing call. ## Suspected layer / what plugging it needs `internal/founding/deploy.go`'s `runDeploy`, self-hosted branch (around line 344-368): after `composeSelfHostedGateway` succeeds (takeover done) and before `guestSupply.SeedAmbient` runs, call something equivalent to `o.ownVPSCarrier.RotateHostKey(ctx, st.GatewayIP)`, with a resumable fault on failure (mirroring `ownvpspath.go:390-396`'s wording: "the box came back with a new identity; wait for the reboot to finish, then re-drive"). This is NOT a same-day self-fix: it requires new fault-handling in `deploy.go`, and breaks all six existing tests in `internal/founding/selfhostedpath_test.go` (`TestSelfHosted_DeployComposesGatewayWithClaimSecretApexAndBaseline`, `TestSelfHosted_OwnDomainComposesWithoutClaimSecret`, `TestSelfHosted_SeedsTheCommunityFlakeAndBootstrapsTheOperatorBeforeComposing`, `TestSelfHosted_RedriveDoesNotRecompose`, `TestSelfHosted_SupplyFailureRedsTheDeploy`, `TestSelfHosted_ResumeAfterSupplyFaultRelandsTheBinary`), none of which currently wire `WithOwnVPSCarrier` — each needs a fake carrier wired and possibly new assertions. That's a multi-file, judgment-laden change, not a mechanical one-liner. Worth checking during the fix: whether `RotateHostKey`'s `ssh-keygen -R` should be scoped to only fire when a self-hosted relay forward actually ran (it's "always wired" per the wiring comment, so may be a safe unconditional call), and whether the resume/idempotency story matches — a resume after a supply fault should re-rotate cleanly (rotating an already-rotated pin is a no-op per `carrier.go:135-136`'s own comment). ## Evidence - `test-results/drive-selfhosted/20260821T051631Z/logs/founding-state.log` — full failure detail + event log (install/reboot green, supply red) - `test-results/drive-selfhosted/20260821T051631Z/state/own-vps/known_hosts` — the single stale pinned entry - Signature: `800a2936720b` drive `20260821T051631Z` red at `deploy-takeover`: `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/…/20260821T051631Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596) <!-- rehearsal-sig: 800a2936720b -->
Author
Member

swarm-claim host=matou-dev-server-01 run=8328
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=8328 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #633 — status success

✅ close-report gates passed — every claim verified against main; closing.

envelope
{
  "issue": 633,
  "status": "success",
  "commits": [
    "8faf9191bd7dabb23563fe8328dfcf30f909f7ed"
  ],
  "changed_files": [
    "STATUS.md",
    "internal/founding/deploy.go",
    "internal/founding/selfhostedpath_test.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/founding/",
      "exit_code": 0
    },
    {
      "command": "go test ./internal/fleetwire/",
      "exit_code": 0
    },
    {
      "command": "go build ./...",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/founding/ ./internal/fleetwire/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "After composeSelfHostedGateway's takeover and before SeedAmbient, the self-hosted deploy rotates the box's pinned SSH host key": "internal/founding/deploy.go runDeploy: new selfHostedFullInstall branch calls o.ownVPSCarrier.RotateHostKey(ctx, st.GatewayIP) between the compose block and the supply block; proven by TestSelfHosted_DeployComposesGatewayWithClaimSecretApexAndBaseline asserting carrier.Rotated == [198.51.100.7] and that supply ran after",
    "Reuses the existing #438 fix pattern (RotateHostKey) rather than inventing a new surface": "deploy.go calls the SAME founding.OwnVPSCarrier.RotateHostKey the own-VPS path uses (ownvpspath.go:390); the carrier is unconditionally wired in production (wiring_prod.go:416)",
    "A rotate failure is a resumable deploy fault, not a silent sail-on": "deploy.go builds a clan.Failure + buildDeployFailure (full-install offers DeployResume) and commitStandup; proven by TestSelfHosted_RotateFailureRedsTheDeploy (DeployFailed, supply.AmbientHosts empty, ClanNode still gateway)",
    "A resume after a fault re-rotates cleanly (idempotent, unguarded by st.ClanNode)": "the rotate block is unguarded by st.ClanNode; proven by TestSelfHosted_ResumeAfterRotateFaultRotatesAndGoesLive (rotate re-fires, deploy goes live) and TestSelfHosted_ResumeAfterSupplyFaultRelandsTheBinary still passing",
    "All six existing selfhostedpath tests still pass with the new carrier wired": "go test ./internal/founding/ exit 0 — selfHostedDeploy now wires WithOwnVPSCarrier and all six existing tests plus two new ones pass"
  },
  "summary": "The self-hosted full-install deploy now rotates the box's pinned SSH host key across the takeover reboot before SeedAmbient reconnects, reusing the own-VPS carrier's #438 RotateHostKey fix.",
  "blockers": []
}
**close-report** for #633 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; closing. <details><summary>envelope</summary> ```json { "issue": 633, "status": "success", "commits": [ "8faf9191bd7dabb23563fe8328dfcf30f909f7ed" ], "changed_files": [ "STATUS.md", "internal/founding/deploy.go", "internal/founding/selfhostedpath_test.go" ], "tests": [ { "command": "go test ./internal/founding/", "exit_code": 0 }, { "command": "go test ./internal/fleetwire/", "exit_code": 0 }, { "command": "go build ./...", "exit_code": 0 }, { "command": "go vet ./internal/founding/ ./internal/fleetwire/", "exit_code": 0 } ], "criteria": { "After composeSelfHostedGateway's takeover and before SeedAmbient, the self-hosted deploy rotates the box's pinned SSH host key": "internal/founding/deploy.go runDeploy: new selfHostedFullInstall branch calls o.ownVPSCarrier.RotateHostKey(ctx, st.GatewayIP) between the compose block and the supply block; proven by TestSelfHosted_DeployComposesGatewayWithClaimSecretApexAndBaseline asserting carrier.Rotated == [198.51.100.7] and that supply ran after", "Reuses the existing #438 fix pattern (RotateHostKey) rather than inventing a new surface": "deploy.go calls the SAME founding.OwnVPSCarrier.RotateHostKey the own-VPS path uses (ownvpspath.go:390); the carrier is unconditionally wired in production (wiring_prod.go:416)", "A rotate failure is a resumable deploy fault, not a silent sail-on": "deploy.go builds a clan.Failure + buildDeployFailure (full-install offers DeployResume) and commitStandup; proven by TestSelfHosted_RotateFailureRedsTheDeploy (DeployFailed, supply.AmbientHosts empty, ClanNode still gateway)", "A resume after a fault re-rotates cleanly (idempotent, unguarded by st.ClanNode)": "the rotate block is unguarded by st.ClanNode; proven by TestSelfHosted_ResumeAfterRotateFaultRotatesAndGoesLive (rotate re-fires, deploy goes live) and TestSelfHosted_ResumeAfterSupplyFaultRelandsTheBinary still passing", "All six existing selfhostedpath tests still pass with the new carrier wired": "go test ./internal/founding/ exit 0 — selfHostedDeploy now wires WithOwnVPSCarrier and all six existing tests plus two new ones pass" }, "summary": "The self-hosted full-install deploy now rotates the box's pinned SSH host key across the takeover reboot before SeedAmbient reconnects, reusing the own-VPS carrier's #438 RotateHostKey fix.", "blockers": [] } ``` </details>
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#633
No description provided.