the generic gateway image ships the BUILD box's /root/.ssh/authorized_keys — every rented community gateway root-trusts all 18 DO-account keys (#707's sibling) #744
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#744
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?
Verified live, 2026-08-24
Probed read-only from matou-workstation against the live rented gateway
idss-gateway-rehearsal-c-8bc1(170.64.145.9, DO id594660355) while no drive held the lock:The box root-trusts eighteen keys, including every human on the DigitalOcean account (Ben ×2, Cherese, Jamin, waipuna), the swarm host, this workstation, and stale
sandcastle-*lab keys from unrelated spikes.Why that is a defect, not just untidy
Two places in the source say the opposite, in as many words:
nix/gateway-image/configuration.nix:73— "the image bakes NO authorized key (generic — ADR 0048). DigitalOcean injects the create-timessh_keys… Absent → the box boots but stays honestly unreachable (ADR 0100)."broker/internal/broker/provider.go:25— "SSHPubKey is the community app's key, the only key the box trusts."DigitalOcean.Createpasses exactly one fingerprint.Both are false in practice. A rented community's gateway — a real community's front door, not a lab box — trusts Matou's entire account key set for the life of the machine. That is a standing cross-tenant root door nobody declared, and it survives every rental because it rides the image, not the rental.
Cause (unverified, but it fits)
scripts/gateway-image/build.shbuilds the golden snapshot on a throwaway droplet created with every account key:cloud-init lands all of them in the build box's
/root/.ssh/authorized_keys. Step 4 of the build then scrubs/etc/ssh/ssh_host_*(#707's fix) — but notauthorized_keys— and snapshots. Every droplet rented from that snapshot inherits the set; cloud-init's own key module appends the rental's key rather than replacing the file, so the app's key joins them instead of being the only one.This is #707's sibling: the same "the build box's identity leaked into the generic image" mistake, one file over. (The
idss-guest-trust/idss-self-deployentries are separate and expected — they are the app's own minted identities, landed atconfigure.)Suggested fix
In
build.sh's scrub step (step 4, beside the host-key scrub), alsorm -f /root/.ssh/authorized_keys, then rebuild the snapshot and confirm on a fresh rental that only the app's rent-operator key is present. The build's own SSH-in happens before the scrub, so nothing in the build needs those keys after that point.nixos-anywhereneeds them during the install only.Worth a matching assertion in
scripts/gateway-image/tests/so the image contract is proven generic rather than asserted in a comment — the same lesson #707 already paid for once.Why session, not agent
Rebuilding the gateway image needs
doctl+ the DO account + a real droplet, and the confirmation is a live rental. Not a swarm sandbox. Not Ben's hands either — but the ruling on whether this is urgent enough to rebuild the image mid-confirmation-queue (a rebuild re-pins the snapshot every rented drive boots) is worth a human's call, since it lands under #720's in-flight arc.Provenance
Found in passing while wiring #724's rented cert persistence — the seed needed to know which SSH identity actually reaches a rented box before its deploy. Answer: the ambient workstation key does, which is exactly the problem. Filed rather than fixed, per the standing-drive rule.
Noted while probing: droplet
594660355was up withcaddy.serviceactive and an empty Caddy store (no*.crt) — consistent with the GOTCHAS #32 wall in #724. Its rental appeared idle (no drive held/tmp/matou-rehearsal-drive.lock); worth a glance that the broker's TTL reaper takes it.session-runner: two unattended attempts did not advance this ticket — labelled
agent-blockedfor a human look (ADR 0174 escalation). Latest session log:/home/dev/.local/state/matou-session-runner/logs/run-744-20260824T061008Z.logon the workstation. Removeagent-blocked(and the stale fail counter if re-arming by hand) to let the runner retry.Re-armed (agent-blocked removed) on Ben's instruction: both session-runner attempts that triggered the escalation never ran — their logs are solely
API Error: 529 Overloadedfrom the Claude API. Not an agent-blocked ticket; retry when the runner next ticks.Ruled by agent under ADR 0174 — veto anytime
The ruling: rebuild the gateway image now, in this session, rather than park the confirmation on Ben.
Why it is a two-way door.
idss-gateway-<sha>snapshot beside the existing ones.scripts/gateway-image/latest.shpicks the newest byCreatedAt, so reverting the ruling is onedoctl compute snapshot delete, and the previous snapshot resumes serving rentals untouched.build.shalready proves the image contract live on the freshly-installed box (idss-agent.serviceactive, ADR 0100); this commit adds a second in-build proof (the generic-image assertion), and the confirmation is a real rental probe.s-2vcpu-4gbdroplets: routine lab money.The caveat the ticket raised is spent. The ticket asked for a human's call because a rebuild "re-pins the snapshot every rented drive boots" mid-#720's in-flight arc. #720 is CLOSED — the phase-4 rented-gateway confirmation loop has landed, so there is no in-flight confirmation queue for a rebuild to disturb. A fresh build at HEAD also makes the #656 staleness gate happier, not unhappier.
Cause: CONFIRMED, and worse than filed
Probed live 2026-08-25 from matou-workstation. A throwaway droplet rented from the then-current snapshot
idss-gateway-f086c9cac29c(242519407, built 2026-08-24T14:56Z) with only a freshly-minted ed25519 key that has never existed in any image:Twelve keys baked into the image, one supplied by the rental.
doctl compute ssh-key listreturns exactly 11 account keys, which accounts for eleven of the twelve — the twelfth is a staleidss-guest-trust, i.e. another rental's app-minted operator key, registered at DO at build time and swept into the build droplet by thedoctl compute ssh-key list | paste -sd,line. That is one rented community's key on every other rented community's box. The ticket's cause is confirmed and its blast radius is slightly larger than filed.The same probe settles the safety question the whole fix turns on. The throwaway key was registered at DO seconds before the create and lands only through DO's metadata service — and it worked. So cloud-init genuinely does land the create-time key on this image, and scrubbing the baked file cannot strand a rental unreachable. (This was the one way the suggested fix could have gone badly: if the baked set were the only reason rentals were reachable, the scrub would have bricked every rental. It is not.)
Mechanism, for the record:
nixos-anywherecopies the installer environment'sauthorized_keysinto the installed system so you can still log in after the install — that is how the build droplet's account-wide set reaches the snapshot in the first place.Landed (source)
d49ece2b—scripts/lib/gateway-image-generic-lib.shemits the scrub (/etc/ssh/ssh_host_*and/root/.ssh/authorized_keys) plus an assertion that names every file that survived;build.shstep 4 runs both in onessh— it must, because the scrub deletes the very key that authenticated the connection, so a second SSH-in would be refused by the box it has just made generic. Any leak now kills the build before the snapshot (ADR 0100). Red-before-green seam testscripts/gateway-image/tests/gateway-image-generic-test.sh(5 checks, fake root, no DO account) reds by name for #744'sauthorized_keysand #707's host key. GOTCHAS #85; STATUS lead + milestone log.The rebuild is running now; the rental confirmation follows in this session.
Close report — #744 fixed, rebuilt, and confirmed live
Ruled by agent under ADR 0174 — veto anytime. The ruling (rebuild now rather than park the confirmation on Ben) and its two-way-door reasoning are in the comment above; the caveat the ticket raised — "mid-#720's in-flight arc" — is spent, #720 is CLOSED.
What landed
d49ece2b9fa7e2e7New
scripts/lib/gateway-image-generic-lib.shemits two strings of remote shell — a scrub of/etc/ssh/ssh_host_*and/root/.ssh/authorized_keys, and an assertion that exits non-zero naming every file that survived.build.shstep 4 runs both in onessh, because the scrub deletes the very key that authenticated the connection and a second SSH-in would be refused by the box it has just made generic. Any leak now kills the build before the snapshot (ADR 0100) instead of shipping to every community. The image contract is asserted on the build box, not asserted in a comment — the thing the ticket asked for, and the lesson #707 had already paid for once.The cause, confirmed live — and worse than filed
A droplet rented from the then-current snapshot
idss-gateway-f086c9cac29cwith only a freshly-minted key that had never existed in any image answered SSH to it and carried 13authorized_keyslines: 12 baked by the build box plus the one the rental supplied.doctl compute ssh-key listreturns exactly 11 account keys — the twelfth was a staleidss-guest-trust, i.e. another rental's app-minted operator key, swept in because the broker registers each rental's key at DO and the build ran while one was registered. One rented community's key on every other rented community's box.Mechanism, for the record:
nixos-anywherecopies the installer environment'sauthorized_keysinto the installed system so you can still log in after the install — that is how the build droplet's account-wide set reached the snapshot.That same probe settled the safety question the fix turned on. The throwaway key was registered at DO seconds before the create and could reach the box only through DO's metadata service — and it worked. So cloud-init genuinely does land the create-time key, and scrubbing the baked file cannot strand a rental unreachable. This was the one way the suggested fix could have gone badly (if the baked set had been the only reason rentals were reachable, the scrub would have bricked every rental); it is not.
The proof
Offline —
scripts/gateway-image/tests/gateway-image-generic-test.sh, 5 checks, fake root, no DO account: the scrub removes both leaks and touches nothing else and is idempotent; the assertion passes on a scrubbed root; the assertion reds by name for #744'sauthorized_keysand for #707's host key;build.shis pinned to run both in onessh. Red before green — it failed on the missing lib, then on nothing. The wholescripts/gateway-image/tests/suite is green (5 + 10 + 2 + 4 + 3 checks).In-build — the rebuild ran the new assertion on its own build box:
Live — a droplet rented from that snapshot with only the throwaway key:
One
authorized_keysline, byte-identical to the key the rental supplied (SHA256:KDl62/0iVAYUAsUZy1JxX1l+7P3OMgwz8Ez/rsAlD6w), on a fresh per-box host key, withidss-agentactive. Zero baked keys.provider.go's "SSHPubKey … the only key the box trusts" andconfiguration.nix's "the image bakes NO authorized key" are now true statements.Blast radius and revert
idss-gateway-<sha>snapshot, so every rental from here boots the clean image.idss-gatewaydroplets on the account, so no gateway rented from a pre-fix snapshot is still standing. (The one this ticket probed,594660355, is gone — the TTL reaper took it, which also answers the ticket's closing "worth a glance".)doctl compute snapshot delete 242679078: the rebuild is additive and the three prior snapshots are untouched, so deleting it restores the previous image exactly.Housekeeping
Both probe droplets destroyed, the probe keypair deregistered at DO and deleted locally — the account is back to its 11 keys and no
idssdroplets. No secrets written to the repo.Follow-up filed, not done here
#860 (
bug,ready-for-session) —build.shstill creates its build droplet with every account key when only the executor host's own is ever used. #744 closed the escape route; #860 closes the source. It also records the deliberate decision to leave the three pre-fix snapshots in place as this ticket's revert path, and flags them as a footgun for whoever ages them out.GOTCHAS #85 records the hazard; STATUS.md carries the lead and the milestone-log entry.
supply#1048