gateway image: the agent's durable device identity (/var/lib/idss/device.key) is BAKED into the golden snapshot — every rented gateway boots with the same device key #1346
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#1346
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?
Seen on the Whakatohea rented gateway (209.38.86.8, booted 2026-09-09 00:09 UTC from the current golden image):
The key predates the box by eight days — it is the image build date.
scripts/gateway-image/build.shboots the build droplet withidss-agent.serviceenabled (nix/gateway-image/configuration.nix:116, byte-for-byte the install unit), the agent's first run mints the device key (devicekey.Loadmints on absence, agent/cmd/agent/main.go ~112), and step 5 snapshots the disk with/var/lib/idssintact. Every rental from that snapshot therefore starts with the SAME device identity;installer-base-cache(Sep 1 07:30) confirms/var/lib/idssis deliberately carried (#1048's warm closure).Why it matters: the device key is "the machine's durable device identity … the private half never leaves the machine" (#207). A key shared by every rented gateway means (a) two rentals are indistinguishable at the device-identity layer, (b) the private half has left the machine — it lives in a DO snapshot, and (c) the founding pairing binds a node identity to a key any other rental also holds. The gateway's node identity (
node-req-0001) is minted at pairing so the community-level identity is still per-community — but the machine-level one is not, and anything that later leans on the device key (fleet removal guard #1219, the self-remove teardown #937, a future device-signed beat) inherits the collision.Fix (image build): before the snapshot, clear the minted runtime identity so first boot mints its own —
rm -f /var/lib/idss/device.key /var/lib/idss/resume.lease /var/lib/idss/enroll.json(keepinstaller-base-cache+agent-cache, which are content, not identity). Or stop the agent unit from starting during the build boot at all (a build-timesystemd.services.idss-agent.enable = falseoverlay) if nothing else in the build needs it. Add a build-time assertion: the snapshot's/var/lib/idsscarries nodevice.key. Audit the other snapshot-carried state under/var/lib(ssh host keys — sshd's ExecStartPre regenerates them per the build script header, so those are fine; anything else agent-minted).Drive impact: every rented/device/device-vm drive since the image gained the agent unit has run on the shared key — no drive asserts device-key uniqueness, so nothing went red. Worth a leg: two rentals from one image carry different device keys.
Agent Brief
Category: bug
Summary: The build boot mints the agent's device identity (
/var/lib/idss/device.key) and the genericness scrub never clears it, so every rented gateway boots from the golden snapshot carrying the same device key — the private half has left the machine and lives in a DO snapshot.Current behavior:
During the golden-image build the
idss-agentunit is enabled and starts on the build droplet's first boot;devicekey.Loadmints/var/lib/idss/device.keyon absence. The image build then scrubs only the build box's SSH identity —/etc/ssh/ssh_host_*and/root/.ssh/authorized_keys— before snapshotting, and the genericness assertion checks only those two./var/lib/idssis deliberately carried into the snapshot (the #1048 warm closure), so the minteddevice.key(plus any other agent-minted runtime identity such asenroll.json/resume.lease) rides into the snapshot and every rental boots with it. Confirmed by inspection: the scrub command emitted byoc_gateway_image_scrub_cmdremoves only the two SSH artefacts, andoc_gateway_image_generic_cmdasserts only their absence.Desired behavior:
The golden snapshot must carry no agent-minted machine identity, so each rented gateway mints its own unique
device.keyon its own first boot (matching how each rental already mints a unique SSH host key). The genericness contract must fail loud — refusing to snapshot, naming the file — if agent-minted identity survived, exactly as it already does for a leaked host key (#707) orauthorized_keys(#744).The scrub must be precise: it removes the agent's minted identity (
device.key, and the minted runtime state that binds to it —enroll.json,resume.lease) but must NOT touch the content the image legitimately carries and depends on for a warm founding —installer-base-cache,agent-cache, and the existingagent-statefixture the offline test already guards.Key interfaces:
oc_gateway_image_scrub_cmd/oc_gateway_image_generic_cmdpair, path-prefixed so the same strings run against a fake root offline and against/on the build box). Extend the scrub to remove the agent-minted identity under/var/lib/idss; extend the assertion to fail-by-name whendevice.keysurvives.devicekey.Loadmints on absence and the private half must never leave the machine (#207). The fix restores that invariant by ensuring absence at snapshot time.idss-agentduring the build boot (a build-timesystemd.services.idss-agent.enable = falseoverlay) so nothing mints identity in the first place — acceptable only if nothing else in the build depends on the agent having run. The scrub-before-snapshot path is preferred because it is a positive assertion the contract test can pin regardless of what runs during the build.Acceptance criteria:
scripts/gateway-image/tests/gateway-image-generic-test.sh) is extended: the scrub removes/var/lib/idss/device.key(andenroll.json/resume.lease) from a fake root, and leavesinstaller-base-cache/agent-cache/agent-state-class content untouched.device.keysurvives on the fake root (a new case alongside the existing #707/#744 cases C/D), and PASSES on a scrubbed root.device.key-absent root is rc=0), matching the existing SSH-scrub behavior.bash scripts/gateway-image/tests/gateway-image-generic-test.shpasses offline (no DO account, no droplet).device.keyvalues (the reporter notes no current drive asserts device-key uniqueness, which is why this went red-free).Out of scope:
/var/lib/idsslegitimately carries for the warm closure (#1048) — content stays; only minted identity is scrubbed.Ruled by agent under ADR 0174 — veto anytime. Considered
ready-for-humanand ruledready-for-agent. This is a two-way door: (a) revertible by a single commit to unprotected paths (scripts/lib/gateway-image-generic-lib.shand its offline test — neither is a.sandcastle/.forgejoprotected path); (b) provable offline by the existinggateway-image-generic-test.shharness, which already path-prefixes the scrub/assert pair against a fake root and already models a legitimately-carried/var/lib/idss/agent-state. It is not on the one-way-door list: it is a security tightening (removing a shared secret), not a widening; the device key is a machine-minted runtime artefact, not a personal credential; and clearing a build-time key that regenerates on first boot is not data destruction. The fix lives in snapshot-baking paths (scripts/gateway-image/**), so once merged the executor will swap it tosnapshot-pendingfor the #661 auto-rebuild rail to verify against a real image — the offline test is the agent's acceptance gate, not a live build.swarm-claim host=matou-dev-server-01 run=20418
(automated multi-host claim — lowest live claim id works this ticket)
close-report for #1346 — status
success✅ close-report gates passed — every claim verified against main; issue closed.
envelope