own-VPS supply/fleet/enrolment stay wired to LoopbackTarget — SSH goes to the workstation, not the droplet #436

Closed
opened 2026-08-11 15:20:37 +00:00 by ben · 2 comments
Owner

Failure

Drive 20260811T145107Z (droplet journey, own-VPS) never reached the leg registry — artifacts/legs.json is [], so the reporter synthesized the generic wizard red. The REAL failure is in state/founding-state.json (mirrored in logs/founding-state.log:131-137): the journey ran clean through connect/point/seed/enroll-configure/enroll-activate, then went red on supply:

founding: seed the fleet software onto the server: fleetwire: prepare the guest dirs: fleetwire: ssh: exit status 255 — root@127.0.0.1: Permission denied (publickey).

state/founding-state.json's draft.access confirms the operator's real box is 209.38.85.200 — the supply leg tried 127.0.0.1 instead, which on the rehearsal workstation is the workstation's own sshd, so any key is refused.

Root cause

app/helper/cmd/helper/wiring_prod.go:378-382 wires guest-supply (and identically challenge-source at :360-365, fleet at :383-391, enrolment at :392-403) with fleetwire.LoopbackTarget() unconditionally, at process-start wiring time. That's correct for the private path (a local qemu guest reached over a loopback SSH forward) but wrong for the own-VPS path, which must land on the operator's real box.

The code's own comments say this should already be fixed: wiring_prod.go:377 — "the private path is the loopback target (ADR 0126); the own-VPS carrier (T2) passes the remote one" — and internal/founding/ownvpspath.go:135-139 — "The app helper's fleetwire.Supply is wired with the RemoteTarget posture for the same box, so the two agree on the destination." Neither is true in the actual wiring: all four ports are still hardcoded to LoopbackTarget().

This is a second-order bug behind the one #432 (commit e7a21d7) just fixed. #432's own commit message describes the SAME symptom (root@127.0.0.1: Permission denied (publickey)) but with an additional Identity file ... not accessible clause — #432 fixed the missing guest-trust key. This run's error has no missing-identity clause, confirming the identity now exists and is baked into the box's access.nix, but the destination host is still wrong.

What plugging it needs

internal/fleetwire.Supply (and Fleet/Enrolment/ChallengeSource) fix their Target at construction (internal/fleetwire/supply.go:43-48) rather than accepting one per call, so wiring_prod.go cannot select loopback vs. remote per active journey path — the operator's IP is only known once the wizard runs, long after these ports are wired.

The existing pattern to follow is internal/fleetwire/carrier.go's OwnVPSCarrier.Connect(ctx, ip): it takes the IP as a call-time argument and builds RemoteTarget(ip, cfg.KnownHosts) per call, rather than baking a target in at wiring time. GuestSupply.Seed/Fleet/Enrolment/ChallengeSource's founding-package interfaces would need the same shape (an IP or Target argument at call time, threaded from wherever the own-VPS path holds the connected box's address — draft.access.ip per founding-state.json), with internal/founding/ownvpspath.go:302 (and the equivalent fleet/enrolment/pair call sites) passing it through, and wiring_prod.go updated to stop hardcoding LoopbackTarget() for all four ports.

This spans an interface-signature change across internal/founding, internal/fleetwire, and app/helper/cmd/helper/wiring_prod.go/wiring_dev.go, plus new plumbing to carry the box's IP from the connect leg through to four call sites — not a mechanical one-line fix, so filing rather than self-fixing.

Suspected layer

internal/fleetwire (Target construction/lifetime) + internal/founding (own-VPS orchestrator call sites) + app/helper/cmd/helper (production wiring).

drive 20260811T145107Z red at wizard: drive red at wizard — the wizard died before any leg ran
evidence: test-results/…/20260811T145107Z/ on matou-workstation (legs.json, droplet-journal.txt, trace)

## Failure Drive `20260811T145107Z` (droplet journey, own-VPS) never reached the leg registry — `artifacts/legs.json` is `[]`, so the reporter synthesized the generic `wizard` red. The REAL failure is in `state/founding-state.json` (mirrored in `logs/founding-state.log:131-137`): the journey ran clean through connect/point/seed/enroll-configure/enroll-activate, then went red on `supply`: ``` founding: seed the fleet software onto the server: fleetwire: prepare the guest dirs: fleetwire: ssh: exit status 255 — root@127.0.0.1: Permission denied (publickey). ``` `state/founding-state.json`'s `draft.access` confirms the operator's real box is `209.38.85.200` — the supply leg tried `127.0.0.1` instead, which on the rehearsal workstation is the workstation's own sshd, so any key is refused. ## Root cause `app/helper/cmd/helper/wiring_prod.go:378-382` wires `guest-supply` (and identically `challenge-source` at :360-365, `fleet` at :383-391, `enrolment` at :392-403) with `fleetwire.LoopbackTarget()` unconditionally, at process-start wiring time. That's correct for the private path (a local qemu guest reached over a loopback SSH forward) but wrong for the own-VPS path, which must land on the operator's real box. The code's own comments say this should already be fixed: `wiring_prod.go:377` — "the private path is the loopback target (ADR 0126); the own-VPS carrier (T2) passes the remote one" — and `internal/founding/ownvpspath.go:135-139` — "The app helper's fleetwire.Supply is wired with the RemoteTarget posture for the same box, so the two agree on the destination." Neither is true in the actual wiring: all four ports are still hardcoded to `LoopbackTarget()`. This is a second-order bug behind the one #432 (commit e7a21d7) just fixed. #432's own commit message describes the SAME symptom (`root@127.0.0.1: Permission denied (publickey)`) but with an additional `Identity file ... not accessible` clause — #432 fixed the missing guest-trust key. This run's error has no missing-identity clause, confirming the identity now exists and is baked into the box's `access.nix`, but the destination host is still wrong. ## What plugging it needs `internal/fleetwire.Supply` (and `Fleet`/`Enrolment`/`ChallengeSource`) fix their `Target` at construction (`internal/fleetwire/supply.go:43-48`) rather than accepting one per call, so `wiring_prod.go` cannot select loopback vs. remote per active journey path — the operator's IP is only known once the wizard runs, long after these ports are wired. The existing pattern to follow is `internal/fleetwire/carrier.go`'s `OwnVPSCarrier.Connect(ctx, ip)`: it takes the IP as a call-time argument and builds `RemoteTarget(ip, cfg.KnownHosts)` per call, rather than baking a target in at wiring time. `GuestSupply.Seed`/`Fleet`/`Enrolment`/`ChallengeSource`'s founding-package interfaces would need the same shape (an IP or Target argument at call time, threaded from wherever the own-VPS path holds the connected box's address — `draft.access.ip` per `founding-state.json`), with `internal/founding/ownvpspath.go:302` (and the equivalent fleet/enrolment/pair call sites) passing it through, and `wiring_prod.go` updated to stop hardcoding `LoopbackTarget()` for all four ports. This spans an interface-signature change across `internal/founding`, `internal/fleetwire`, and `app/helper/cmd/helper/wiring_prod.go`/`wiring_dev.go`, plus new plumbing to carry the box's IP from the connect leg through to four call sites — not a mechanical one-line fix, so filing rather than self-fixing. ## Suspected layer `internal/fleetwire` (Target construction/lifetime) + `internal/founding` (own-VPS orchestrator call sites) + `app/helper/cmd/helper` (production wiring). drive `20260811T145107Z` red at `wizard`: `drive red at wizard — the wizard died before any leg ran` evidence: `test-results/…/20260811T145107Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) <!-- rehearsal-sig: dcf630511b50 -->
Author
Owner

Done this iteration — the reproduced supply red is fixed (commit 8dabf03, on main)

The supply leg now lands on the operator's real box, not the workstation's loopback sshd:

  • founding.GuestSupply.Seed takes the destination host per call — Seed(ctx, host, sshPort). The own-VPS worker threads draft.access.ip (internal/founding/ownvpspath.go); the private path passes "" (byte-identical loopback, ADR 0126, internal/founding/privatepath.go).
  • fleetwire.Supply builds RemoteTarget(host, ownVPSKnownHosts) when a host is named (accept-new + pinned own-VPS known-hosts, ADR 0152), otherwise the loopback default. NewSupply gains the own-VPS known-hosts path; wiring_prod.go passes ownVPSKnownHostsPath().
  • FakeSupply now records SeededHosts, so the seam catches a wrong destination (the old fake only recorded the port, which is why this hid behind #432).

This is the second-order bug behind #432: the guest-trust key now exists and is baked onto the box, but the destination host was still 127.0.0.1. New seam tests: TestSupplySeed_OwnVPSHostDrivesTheRealBox (fleetwire) + the own-VPS AC-1 supply.SeededHosts assertion. go build ./..., go vet ./... and the full pre-push suite are green.

Handed back for a decision — the other three ports need more than a Target swap

The issue's framing assumes threading an IP/Target fixes Fleet/Enrolment/ChallengeSource too, but that is not sufficient for them, so I did not churn their signatures:

  • Fleet / Enrolment do not just SSH — they poll the gateway over the loopback SSH forward: Fleet.pollUntil hits http://127.0.0.1:<APIPort> and Enrolment.liveIDP builds a kanidm client against https://localhost:<KanidmPort>, and both resolve their ports via newGuestVM().SSHPort/APIPort/KanidmPort — the private VM's forwards, which do not exist on an own-VPS drive. The gateway binds kanidm/control-plane on loopback on the box (publicKanidmLoopbackPort=8443, gateURL=127.0.0.1:8080), so they are not reachable on the public IP either. Making these work on own-VPS needs SSH-tunnel plumbing to the box (a larger, separate change), not a destination host.
  • ChallengeSource is not reached on the own-VPS founding path at all — the own-VPS point leg writes the A + wildcard alone (pointOwnVPSName passes fulldomain="") and the gateway heartbeat re-points the challenge later (ADR 0136).

These legs are downstream of supply/pair/deploy and have never been reached on a real own-VPS drive. Recommendation: split the Fleet/Enrolment own-VPS work into its own ticket scoped as "stand up an SSH forward to the own-VPS box so the guest-facing HTTP/kanidm polls resolve" — the next own-VPS drive that gets past supply will red there with concrete evidence. Re-add ready-for-agent if you'd rather I attempt that tunnel plumbing directly.

## Done this iteration — the reproduced `supply` red is fixed (commit `8dabf03`, on `main`) The `supply` leg now lands on the operator's **real box**, not the workstation's loopback sshd: - `founding.GuestSupply.Seed` takes the destination host per call — `Seed(ctx, host, sshPort)`. The own-VPS worker threads `draft.access.ip` (`internal/founding/ownvpspath.go`); the private path passes `""` (byte-identical loopback, ADR 0126, `internal/founding/privatepath.go`). - `fleetwire.Supply` builds `RemoteTarget(host, ownVPSKnownHosts)` when a host is named (accept-new + pinned own-VPS known-hosts, ADR 0152), otherwise the loopback default. `NewSupply` gains the own-VPS known-hosts path; `wiring_prod.go` passes `ownVPSKnownHostsPath()`. - `FakeSupply` now records `SeededHosts`, so the seam catches a wrong destination (the old fake only recorded the port, which is why this hid behind #432). This is the second-order bug behind #432: the guest-trust key now exists and is baked onto the box, but the destination **host** was still `127.0.0.1`. New seam tests: `TestSupplySeed_OwnVPSHostDrivesTheRealBox` (fleetwire) + the own-VPS AC-1 `supply.SeededHosts` assertion. `go build ./...`, `go vet ./...` and the full pre-push suite are green. ## Handed back for a decision — the other three ports need more than a Target swap The issue's framing assumes threading an IP/Target fixes `Fleet`/`Enrolment`/`ChallengeSource` too, but that is **not sufficient** for them, so I did not churn their signatures: - **`Fleet` / `Enrolment`** do not just SSH — they poll the gateway over the loopback **SSH forward**: `Fleet.pollUntil` hits `http://127.0.0.1:<APIPort>` and `Enrolment.liveIDP` builds a kanidm client against `https://localhost:<KanidmPort>`, and both resolve their ports via `newGuestVM().SSHPort/APIPort/KanidmPort` — the **private VM's** forwards, which do not exist on an own-VPS drive. The gateway binds kanidm/control-plane on loopback on the box (`publicKanidmLoopbackPort=8443`, `gateURL=127.0.0.1:8080`), so they are not reachable on the public IP either. Making these work on own-VPS needs **SSH-tunnel plumbing to the box** (a larger, separate change), not a destination host. - **`ChallengeSource`** is not reached on the own-VPS founding path at all — the own-VPS point leg writes the A + wildcard alone (`pointOwnVPSName` passes `fulldomain=""`) and the gateway heartbeat re-points the challenge later (ADR 0136). These legs are downstream of `supply`/`pair`/`deploy` and have never been reached on a real own-VPS drive. **Recommendation:** split the `Fleet`/`Enrolment` own-VPS work into its own ticket scoped as *"stand up an SSH forward to the own-VPS box so the guest-facing HTTP/kanidm polls resolve"* — the next own-VPS drive that gets past `supply` will red there with concrete evidence. Re-add `ready-for-agent` if you'd rather I attempt that tunnel plumbing directly.
Author
Owner

Ruled (Ben): supply half delivered by 8dabf03 — closing. The Fleet/Enrolment forward plumbing is split to its own ticket (#437, ready-for-agent, wired to #378) scoped to preserve the 127.0.0.1 contract via -L forwards over the carrier connection, per this hand-back's own analysis. Thanks for the clean split — the SeededHosts fake upgrade is exactly the class-closer.

Ruled (Ben): supply half delivered by `8dabf03` — closing. The Fleet/Enrolment forward plumbing is split to its own ticket (#437, ready-for-agent, wired to #378) scoped to preserve the 127.0.0.1 contract via -L forwards over the carrier connection, per this hand-back's own analysis. Thanks for the clean split — the SeededHosts fake upgrade is exactly the class-closer.
ben closed this issue 2026-08-11 15:45:03 +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#436
No description provided.