rented carrier: supply SSHes with the guest-trust key before the box is ever taught to trust it #692
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#692
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
Journey leg
supplyred on20260823T054045Z(sigcdebd4257a3d):The stand-up log (
state/founding-state.json) showsconnectsucceeded ("connected to root@209.38.18.27 — the rented gateway is reachable") several stages beforesupplyfailed with a publickey refusal against the SAME host. Two different SSH identities are in play, and only one of them is ever authorized on the box.Root cause
internal/founding/rentedpath.go'srunRented:connect(line ~160) useso.rentedCarrier, wired inapp/helper/cmd/helper/wiring_prod.go:471-477withIdentity: rentOperatorKeyDir()/id_ed25519— the key DigitalOcean injected at provision. This is the box's ONLY trusted key at this point (fresh image, no takeover).supply(rentedpath.go:200-208) callso.guestSupply.Seed(ctx, ip, ownVPSSSHPort).guestSupplyis a single shared instance wired inwiring_prod.go:512-517withIdentity: guestTrustDir()/id_ed25519— a DIFFERENT, freshly-minted key (o.guestTrust.Ensure(ctx)at rentedpath.go:195, called just before supply).authorized_keysinsideinstallRented(rentedpath.go:273,AuthorizedKeys: appendGuestTrust(facts.RootAuthorizedKeys, guestTrust)), which is theconfigurestep — andconfigureruns strictly AFTERsupplyin this path (rentedpath.go's own leg-order comment at the top of the file: "supply — the fleet software, landed FIRST (before the configure)").So the code mints the guest-trust key and immediately SSHes with it to a box that has never been told to trust it. The comment right above the mint call (rentedpath.go:190-194) claims the public half is "fed into the box's trust... before use", but that feed only happens in the LATER configure step — the comment describes the own-VPS path's shape (where
installprecedessupplyand does the sameappendGuestTrust), not this path's actual (flipped) order.This ordering is not accidental slop I can just swap back:
internal/founding/rentedpath_test.gohasTestRentedJourney_SupplyRunsBeforeEnroll(line 245) that explicitly locks in supply-before-configure ("the box is already NixOS, so supply lands FIRST... before the VMMode configure") — reversing the order to fix the key-trust bug would break an intentional, tested invariant, and could reintroduce whatever original problem (unit-start-before-binary-exists?) motivated flipping it in the first place. Untangling that requires knowing why the order was chosen, which I can't verify from this checkout or a real droplet.Suspected layer / fix directions
This needs the rented carrier's trust-bootstrap fixed, not the leg order. Two real options, either of which is a genuine design call rather than a mechanical edit:
connect.WithRentedCarriergives the rented path its OWN carrier instance keyed on the rent-operator identity, separate fromWithOwnVPSCarrier's ambient one.supplyneeds the same treatment: a secondGuestSupply-shaped instance (or an identity override on the existing one) keyed on the rent-operator identity for the rented path's initial supply call, with the shared guest-trust-keyed instance still used post-configure and for the private/own-VPS paths.connect, over the rent-operator identity (a small explicitssh ... >> /root/.ssh/authorized_keysstep, reusing the line formatappendGuestTrustalready builds) — beforesupplyruns at all.Either also has a knock-on question worth checking while this is being designed:
installRented(rentedpath.go:269) setsAmbientSSH: trueon theconfigureclan.Enrollcall, with a comment claiming this reaches the box "over the app's own key (the key DO injected at provision)" — butAmbientSSH: truemakesclan.enrollment.identity()(internal/clan/enrollment.go:1131-1140) return""(no-iat all), i.e. plain ssh-agent/default-key resolution. The rent-operator private key lives at the app's own state dir (rentOperatorKeyDir()), not in the operator's ambient~/.sshor agent, soconfigurelooks like it would ALSO fail publickey oncesupplyis fixed — it just hasn't been reached yet in this drive. Worth confirming/fixing in the same pass so the next rented drive doesn't just move the red leg fromsupplytoconfigure.Evidence
test-results/drive-rented/20260823T054045Z/artifacts/journey.rented-rented-gate-014d4--on-a-broker-rented-droplet/error-context.md— the JourneyFailure and page snapshot.test-results/drive-rented/20260823T054045Z/state/founding-state.json— thestandup.eventslog showingconnectsucceeding thensupplyfailing against the same IP.internal/founding/rentedpath.go:150-213(leg order + the supply call),:190-198(guest-trust mint + its now-inaccurate comment),:269-273(AmbientSSH: true+appendGuestTrustininstallRented).app/helper/cmd/helper/wiring_prod.go:454-477(rented carrier's own rent-operator identity) vs:512-517(the single shared guest-trust-keyedguest-supply).internal/founding/rentedpath_test.go:243-276(TestRentedJourney_SupplyRunsBeforeEnroll, the invariant that rules out a simple reorder).internal/clan/enrollment.go:1131-1140(identity():AmbientSSH→ no-iat all).drive
20260823T054045Zred atpair:journey leg "supply" went red: founding: seed the fleet software onto the rented server: fleetwire: prepare the guest dirs: fleetwire: ssh: exit status 255 — root@209.38.18.27: Permission denied (puevidence:
test-results/…/20260823T054045Z/on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)Ruled by agent under ADR 0174 — veto anytime. This is a two-way door: revertible by commit, provable by unit test — a code fix to the rented carrier's leg-order/identity wiring, no personal credentials, no security-posture widening (if anything it tightens which identity a fresh box is dialled over), no member-facing trust accept, no data destruction. Ruling: fix landed, not routed to
ready-for-human.What landed (
af942243):guestTrust.Ensureonly mints the guest-trust keypair; the box isn't taught to trust its public half until the laterconfigurestep (installRented'sappendGuestTrust), but the rented path landssupplybeforeconfigure. The stale comment claiming the trust-feed already happened by supply time is fixed (it described the own-VPS shape, not this path's actual flipped order).supplynow dials its own rent-operator-keyed seam (WithRentedSupply, a secondfleetwire.Supplyinstance) instead of the shared guest-trust-keyedguestSupply— mirrors DDR 0191's carrier split exactly as suggested.configure/AmbientSSHquestion the ticket flagged as unconfirmed-but-worth-checking:AmbientSSH: trueresolved to the operator's ambient key/agent, which never holds the app-minted rent-operator key (it lives in the app's own state dir) — soconfigurewould have gone red the same way the momentsupplywas fixed. Fixed by adding an explicitclan.EnrollRequest.Identityoverride (a third identity caseAmbientSSHcan't express), sourced from a newRentPubKey.IdentityFile()method. This required a small, additive change tointernal/clan'sEnrollRequest/enrollSnapshot— confirmed safe against the package's single-writerConfigRepoinvariant (no secondAdapter/repo handle created; same shared adapter, per-call identity override only).installRented's stale comments corrected to match reality throughout.Proof:
go build ./...,go vet ./...,gofmt -l .all clean. Full suite green (go test ./..., 56/56 packages, exit 0). New targeted tests:internal/clan.TestEnroll_ExplicitIdentityOverridesConfiguredIdentity;internal/founding'sTestRentedJourney_SupplyDialsRentedSupplyNeverGuestSupply(provessupplynow dials the rent-operator-keyed seam and never the guest-trust one, with two distinct fakes),TestRentedJourney_UnwiredRentedSupplyFailsLoud,TestRentedJourney_UnwiredRentPubKeyFailsLoud(ADR 0100 fail-loud guards), plus updatedTestRentedJourney_RowsNeverIncludeInstallPhases/TestRentedJourney_SupplyRunsBeforeEnrollfor the new identity shape.Not proven: a real rented droplet — this checkout has none running (matching the same limitation the original diagnosis noted). Unit-test proof only, same evidentiary bar #691 closed on. The next rented rehearsal drive is the live proof; if it reds again the fix is one revert away.
docs/GOTCHAS.md#61 records the hazard class (minting an identity ≠ the target trusting it) so it doesn't recur elsewhere.STATUS.mdupdated in the same commit.Closing — advances #692.