deploy-services: the gateway's first dial of a VM guest is Supply.Seed's bare STRICT ssh-ng — no host key was ever learned, so the seed refuses (Host key verification failed) #1208

Closed
opened 2026-09-04 00:38:48 +00:00 by matou-build-agent · 1 comment

Drive 20260903T235617Z (target device, commit e86e9f00) reached leg 28/28 and redded at deploy-services — one leg further than #1206's re-drive predicted, and on the next wall of the same wire.

The failure

artifacts/legs.json (leg 28) and artifacts/verdict.json (firstRedLeg: deploy-services):

deploy failed (clean-retry): provision: seed node-req-0003: clan: connectivity on node-req-0003:
could not reach the node: Host key verification failed.
error: failed to start SSH connection to '100.70.254.61'

The gateway's own view, logs/gateway-journal.txt:1994:

level=WARN msg="provision deploy failed" component=control-plane device=node-req-0003
  error="provision: seed node-req-0003: clan: connectivity on node-req-0003: could not reach the node:
  Host key verification failed.\nerror: failed to start SSH connection to '100.70.254.61'"

Surfaced by the journey at app/tests/e2e/journey.device.spec.ts via waitForDeployActive (tests/e2e/.../error-context.md, line 321 of the helper) — the deploy's own fault frame, read honestly. The drive harness is not at fault; the check did its job.

#1206's two wires held: the deploy target WAS captured (root@100.70.254.61, so supplyFace.target no longer refuses) and the guest's deploy door WAS opened. The dial now gets as far as the SSH transport and dies one layer earlier than publickey — on host-key verification.

The defect

Supply.Seed is the ONLY strict-posture SSH dial in the whole deploy chain, and on the VM-mode path it is the gateway's FIRST-EVER contact with the guest.

  • internal/clan/supply.go:52-56 — Seed's Invocation carries Tool, Dir, Args and no Env. No NIX_SSHOPTS, so nix's ssh runs with ambient ~/.ssh/known_hosts and default strict checking.
  • Every sibling dial is relaxed: internal/clan/enrollment.go:1312 and internal/clan/store_count.go:122 both go through sshNGStore (internal/clan/store_count.go:182-199), which sets StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null — its own doc comment (store_count.go:167-170) gives the reason verbatim: "the guest was created by us moments ago and has no stable key an operator could have vetted." The apply stage likewise passes --host-key-check none (internal/clan/adapter.go:634; also enrollment.go:1402, enrollment.go:1773).
  • On the FULL-INSTALL path Seed's strictness is masked twice over: the install legs learn the key under accept-new, and internal/provision/takeover.go:117-129 calls RotateHostKey at the reboot boundary specifically so "Supply.Seed's bare strict ssh-ng reconnect" matches. The comment names this exact hazard.
  • A VM-mode node gets neither. Its only channel is the host agent's loopback forward — internal/vm/manager.go:751-753: StrictHostKeyChecking=no, UserKnownHostsFile=/dev/null, host-side only. GuestMeshJoin and GuestAuthorizeDeployKeys both ride that loopback (internal/vm/manager.go:809), never the mesh, so the gateway's known_hosts never learns 100.70.254.61. internal/provision/deploy.go:459 writes the target and deploy.go:465 calls Seed immediately — no host-key step between them. First contact is strict, and strict refuses an unknown host.

internal/clan/hostca.go:11-38 is the third face of this: the community SSH host-CA trust that would make this verify by construction is wired at the seam but explicitly NOT turned on in production (it waits on real OpenSSH host-certificate minting), and its own comment names "the AMBIENT trust Supply.Seed's strict ssh-ng reconnect reads" as the thing still unserved.

Suspected layer

Control plane — internal/clan/supply.go / internal/provision/deploy.go, VM-mode branch. Not the harness, not fixtures.

Why I refused (rule 3 — product-behaviour surface)

Every honest fix alters the SSH host-key trust posture of a real deploy against a real community box — that is what a deploy does, and it is a security decision, not a heal. There are three materially different answers and they are not interchangeable:

  1. Give Seed its siblings' posture — route it through sshNGStore(target, a.sshIdentityFile) like enrollment.go:1312 and store_count.go:122. Smallest and most consistent, but it drops host-key checking for EVERY seed, including full-install members where strictness currently holds and takeover.go's RotateHostKey rotation exists precisely to satisfy it. That rotation would become dead weight.
  2. Learn the guest's key at the deploy boundary — call o.clan.RotateHostKey(ctx, d.MeshAddress) in deployServicesOnly beside the SetDeployTarget capture (deploy.go:453-462), mirroring takeover.go:127. Scoped to VM mode and keeps Seed strict — but it is TOFU against a key nobody vouched for. Note RotateHostKey's drop-then-relearn shape is required here, not a plain accept-new: VM-mode recovery is RecoverCleanRetry (deploy.go:392-397) — the VM is deleted and recreated, so a re-drive presents a NEW host key at a recycled node-req-NNNN mesh address, which accept-new HARD-refuses as a MITM (the #1075 failure mode, one drive later).
  3. Finish the community host-CA path — hostca.go + a guest presenting a community-signed host cert. Strongest, and it is the design the tree already reaches for, but hostca.go:30-38 marks it blocked on work outside this arc.

ADR 0223 says nothing about host keys at all (grepped: no host key / known_hosts / host cert in docs/adr/0223-vm-guest-joins-the-mesh.md), so there is no standing ruling to follow. Picking among these — and whether the guest's key should be carried back through the join wire instead of trusted on first sight — is a trust-model call for a human. Hence confident: false.

Two notes for whoever takes this

  • A publickey wall may sit behind this one. Supply.Seed passes no identity file either, and on the gateway sshIdentityFile is unset (WithSSHIdentityFile is wired only by app/helper/cmd/helper/wiring_prod.go:103), so the seed dials with the gateway root's ambient key. That key must be among the ClanTrust.DeployAuthorizedKeys #1206 landed in the guest's /etc/ssh/authorized_keys.d/root. The evidence does not show this failing — the dial never got past the host key — so treat it as a thing to check, not a claim.
  • The device was offboarded on the way out. logs/gateway-journal.txt:1995, nine seconds after the red: "provision: removed a device whose box could not be reached — the community-side offboard completed and the on-box teardown was skipped (#1114)". Consistent with the clean-retry teardown; recorded here so it is not mistaken for a second fault.

Advances #1153.

drive 20260903T235617Z red at deploy-services: deploy failed (clean-retry): provision: seed node-req-0003: clan: connectivity on node-req-0003: could not reach the node: Host key verification failed. error: failed to start SSH connection to '100.7
evidence: /home/swarm/swarm/Matou/idss/test-results/drive-device/20260903T235617Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

Drive `20260903T235617Z` (target `device`, commit `e86e9f00`) reached leg 28/28 and redded at `deploy-services` — one leg further than #1206's re-drive predicted, and on the next wall of the same wire. ## The failure `artifacts/legs.json` (leg 28) and `artifacts/verdict.json` (`firstRedLeg: deploy-services`): ``` deploy failed (clean-retry): provision: seed node-req-0003: clan: connectivity on node-req-0003: could not reach the node: Host key verification failed. error: failed to start SSH connection to '100.70.254.61' ``` The gateway's own view, `logs/gateway-journal.txt:1994`: ``` level=WARN msg="provision deploy failed" component=control-plane device=node-req-0003 error="provision: seed node-req-0003: clan: connectivity on node-req-0003: could not reach the node: Host key verification failed.\nerror: failed to start SSH connection to '100.70.254.61'" ``` Surfaced by the journey at `app/tests/e2e/journey.device.spec.ts` via `waitForDeployActive` (`tests/e2e/.../error-context.md`, line 321 of the helper) — the deploy's own fault frame, read honestly. **The drive harness is not at fault; the check did its job.** #1206's two wires held: the deploy target WAS captured (`root@100.70.254.61`, so `supplyFace.target` no longer refuses) and the guest's deploy door WAS opened. The dial now gets as far as the SSH transport and dies one layer earlier than `publickey` — on **host-key verification**. ## The defect `Supply.Seed` is the ONLY strict-posture SSH dial in the whole deploy chain, and on the VM-mode path it is the gateway's FIRST-EVER contact with the guest. - `internal/clan/supply.go:52-56` — Seed's `Invocation` carries `Tool`, `Dir`, `Args` and **no `Env`**. No `NIX_SSHOPTS`, so nix's ssh runs with ambient `~/.ssh/known_hosts` and default strict checking. - Every sibling dial is relaxed: `internal/clan/enrollment.go:1312` and `internal/clan/store_count.go:122` both go through `sshNGStore` (`internal/clan/store_count.go:182-199`), which sets `StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null` — its own doc comment (`store_count.go:167-170`) gives the reason verbatim: *"the guest was created by us moments ago and has no stable key an operator could have vetted."* The apply stage likewise passes `--host-key-check none` (`internal/clan/adapter.go:634`; also `enrollment.go:1402`, `enrollment.go:1773`). - On the FULL-INSTALL path Seed's strictness is masked twice over: the install legs learn the key under accept-new, and `internal/provision/takeover.go:117-129` calls `RotateHostKey` at the reboot boundary specifically so *"Supply.Seed's bare strict `ssh-ng` reconnect"* matches. The comment names this exact hazard. - A **VM-mode** node gets neither. Its only channel is the host agent's loopback forward — `internal/vm/manager.go:751-753`: `StrictHostKeyChecking=no`, `UserKnownHostsFile=/dev/null`, host-side only. `GuestMeshJoin` and `GuestAuthorizeDeployKeys` both ride that loopback (`internal/vm/manager.go:809`), never the mesh, so **the gateway's known_hosts never learns `100.70.254.61`**. `internal/provision/deploy.go:459` writes the target and `deploy.go:465` calls Seed immediately — no host-key step between them. First contact is strict, and strict refuses an unknown host. `internal/clan/hostca.go:11-38` is the third face of this: the community SSH host-CA trust that would make this verify *by construction* is wired at the seam but explicitly NOT turned on in production (it waits on real OpenSSH host-certificate minting), and its own comment names "the AMBIENT trust Supply.Seed's strict `ssh-ng` reconnect reads" as the thing still unserved. ## Suspected layer Control plane — `internal/clan/supply.go` / `internal/provision/deploy.go`, VM-mode branch. Not the harness, not fixtures. ## Why I refused (rule 3 — product-behaviour surface) Every honest fix alters the SSH host-key **trust posture of a real deploy against a real community box** — that is what a deploy does, and it is a security decision, not a heal. There are three materially different answers and they are not interchangeable: 1. **Give Seed its siblings' posture** — route it through `sshNGStore(target, a.sshIdentityFile)` like `enrollment.go:1312` and `store_count.go:122`. Smallest and most consistent, but it drops host-key checking for EVERY seed, including full-install members where strictness currently holds and `takeover.go`'s `RotateHostKey` rotation exists precisely to satisfy it. That rotation would become dead weight. 2. **Learn the guest's key at the deploy boundary** — call `o.clan.RotateHostKey(ctx, d.MeshAddress)` in `deployServicesOnly` beside the `SetDeployTarget` capture (`deploy.go:453-462`), mirroring `takeover.go:127`. Scoped to VM mode and keeps Seed strict — but it is TOFU against a key nobody vouched for. Note `RotateHostKey`'s **drop-then-relearn** shape is required here, not a plain accept-new: VM-mode recovery is `RecoverCleanRetry` (`deploy.go:392-397`) — the VM is deleted and recreated, so a re-drive presents a NEW host key at a recycled `node-req-NNNN` mesh address, which accept-new HARD-refuses as a MITM (the #1075 failure mode, one drive later). 3. **Finish the community host-CA path** — `hostca.go` + a guest presenting a community-signed host cert. Strongest, and it is the design the tree already reaches for, but `hostca.go:30-38` marks it blocked on work outside this arc. ADR 0223 says nothing about host keys at all (grepped: no `host key` / `known_hosts` / `host cert` in `docs/adr/0223-vm-guest-joins-the-mesh.md`), so there is no standing ruling to follow. Picking among these — and whether the guest's key should be carried back through the join wire instead of trusted on first sight — is a trust-model call for a human. Hence `confident: false`. ## Two notes for whoever takes this - **A publickey wall may sit behind this one.** `Supply.Seed` passes no identity file either, and on the gateway `sshIdentityFile` is unset (`WithSSHIdentityFile` is wired only by `app/helper/cmd/helper/wiring_prod.go:103`), so the seed dials with the gateway root's ambient key. That key must be among the `ClanTrust.DeployAuthorizedKeys` #1206 landed in the guest's `/etc/ssh/authorized_keys.d/root`. The evidence does not show this failing — the dial never got past the host key — so treat it as a thing to check, not a claim. - **The device was offboarded on the way out.** `logs/gateway-journal.txt:1995`, nine seconds after the red: *"provision: removed a device whose box could not be reached — the community-side offboard completed and the on-box teardown was skipped (#1114)"*. Consistent with the clean-retry teardown; recorded here so it is not mistaken for a second fault. Advances #1153. drive `20260903T235617Z` red at `deploy-services`: `deploy failed (clean-retry): provision: seed node-req-0003: clan: connectivity on node-req-0003: could not reach the node: Host key verification failed. error: failed to start SSH connection to '100.7` evidence: `/home/swarm/swarm/Matou/idss/test-results/drive-device/20260903T235617Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: db4e706c778c -->
Owner

Ruled and already landed by session under ADR 0174 — the fix went to main as 1041a1d5 minutes before this ticket was filed (the session watched the red live and took it directly).

deployServicesOnly now runs clan.RotateHostKey(d.MeshAddress) after the per-operation target capture and strictly before Supply.Seed: the #1075 drop-and-relearn one step early. On a never-pinned guest the drop is a no-op and the accept-new connect pins the fresh key; on a rebuilt member it rotates the changed one. This is first-contact learning over the CREDENTIALED mesh channel — the address is the wt0 Netbird admitted this exact peer at, captured fresh this operation (ADR 0039) — not blind TOFU. Gateway rows exempt; removal flows into the seed's best-effort handling (#1114). Hot-path order pin extended (rotate-hostkey → seed → deploy); ADR 0223's amendment gains the wire.

Full suite green both tag sets. The re-drive's seed dials a pinned door — closing so drive 11 fires.

**Ruled and already landed by session under ADR 0174** — the fix went to main as `1041a1d5` minutes before this ticket was filed (the session watched the red live and took it directly). `deployServicesOnly` now runs `clan.RotateHostKey(d.MeshAddress)` after the per-operation target capture and strictly before `Supply.Seed`: the #1075 drop-and-relearn one step early. On a never-pinned guest the drop is a no-op and the accept-new connect pins the fresh key; on a rebuilt member it rotates the changed one. This is first-contact learning over the CREDENTIALED mesh channel — the address is the wt0 Netbird admitted this exact peer at, captured fresh this operation (ADR 0039) — not blind TOFU. Gateway rows exempt; removal flows into the seed's best-effort handling (#1114). Hot-path order pin extended (`rotate-hostkey → seed → deploy`); ADR 0223's amendment gains the wire. Full suite green both tag sets. The re-drive's seed dials a pinned door — closing so drive 11 fires.
ben closed this issue 2026-09-04 00:39:51 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#1208
No description provided.