device-add: nothing teaches a joining device to trust the gateway's deploy key — every takeover deploy is refused publickey #1007
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.
Blocks
Reference
Matou/idss#1007
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
Drive
20260829T232735Z(run dirtest-results/drive-device/20260829T232735Z) red at legdeploy-takeover, signature800a2936720b, 26 legs green before it:(
artifacts/legs.json, last entry;artifacts/verdict.jsonfirstRedLeg: deploy-takeover.)This is not a routing or liveness fault. The device answers:
logs/device-units.txtshows sshd on0.0.0.0:22and the mesh address100.107.208.101bound by netbird;logs/device-journal.txt:1450records the gateway's own attempt reaching preauth —sshd[10335]: Connection closed by authenticating user root 100.107.93.51 port 58778 [preauth](100.107.93.51is the gateway's wt0 address,logs/gateway-units.txt). It is purely an authentication failure: the key the gateway offers is not in the device's/root/.ssh/authorized_keys.Evidence — the key is never conveyed, and never installed
The gateway offers its loopback self-deploy key. The control plane's clan adapter is built with no
WithSSHIdentityFile(the only production caller is the operator app's helper,app/helper/cmd/helper/wiring_prod.go:103), soenrollment.identity()returns""(internal/clan/enrollment.go:1397-1405) andAdapter.reachablerunssshwith no-i(internal/clan/adapter.go:286-302). Root's default identity on the gateway is the keyidss-self-trustmints for the loopback self-deploy:internal/clan/vmguest.go:668-681(ssh-keygen ... -C idss-self-deploy, then appended to the gateway's own authorized_keys). Nothing ever ships its public half anywhere else.The device installs no SSH trust at landing. The agent's whole write surface at join is four files: the community CA at
/usr/local/share/ca-certificates/idss-community.crt(agent/internal/trust/trust.go:56— x509 trust, not SSH), andcontract.json/node/stagedunder/var/lib/idss/takeover(agent/internal/stage/stage.go:54-63).agent/internal/meshup/meshup.gotouches no SSH at all. The✓ community trust installedline (internal/join/cli.go:268) is the CA install — it does not authorize anyone for root.The grant carries no deploy key to install.
IdentityGrant.ClanTrustis{CAPubKey, Principals}(internal/enroll/enroll.go:315-329), filled with the raw community root ed25519 pubkey and the node name (internal/enroll/community_ca.go:146-151). There is no field for the gateway's SSH deploy key, and the device's sshd is never configured withTrustedUserCAKeys, so the CA-cert route is not wired either. Netbird's own SSH is off (logs/gateway-journal.txt:SSH server is locally allowed but disabled by management server).idss-enroll-trustdoes not cover member devices. It is the gateway shape's fw_cfg unit and explicitly never runs on a real droplet (internal/clan/vmguest.go:466-492).Second face of the same gap — the post-takeover device would be bricked
internal/provision/takeover.go:150-159builds the device'sEnrollRequestwithDevice/Node/Role/Install/NetworkandTargetonly — noAuthorizedKeys. That field feedsNodeConfig.RootAuthorizedKeys(internal/clan/enrollment.go:375), whichwriteNodeConfigrenders into the member'saccess.nix(internal/clan/enrollment.go:521). With it empty,renderAccessemitsusers.users.root.openssh.authorizedKeys.keys = [ ];(internal/clan/enrollment.go:611-629). Its own doc comment names the consequence — "the takeover 'succeeds' and the box is then unreachable forever (#414)" — and asserts the case is unreachable because "the connect leg refuses a box with no root key before this is ever reached". That guard is the founding connect leg; the device-add path has no equivalent, so it reaches renderAccess with an empty list.So fixing only the pre-takeover reachability would be worse than the current red: the wipe would run and the paid droplet would come back permanently unreachable. Both faces must land together.
Suspected layer
A missing mechanism, not a broken line: member-device SSH trust between the gateway control plane and a landed device. It spans
internal/enroll(the grant/landing payload),agent/internal/trust(the device-side install), andinternal/provision/takeover.go(the post-takeover bake). No existing code path can be pointed at as "wrong" — the path was never built.What plugging it needs
Follow the precedent already in the tree for the rented gateway (#709/#414): a bare deploy public key seeded into root's authorized_keys, both live and baked.
/root/.ssh/id_ed25519.pub, minted byidss-self-trust,internal/clan/vmguest.go:668-676) on the approval payload the device receives — e.g. aDeployAuthorizedKeys []stringonenroll.ClanTrust(internal/enroll/enroll.go:315), populated whereCommunityCA.Grantbuilds it (internal/enroll/community_ca.go:146-151) or atLedger.Approvealongside the mesh admission, from a new read-the-plane's-own-pubkey port. Note the key is minted by a systemd unit at boot, so the control plane must read it at approval time, not bake it at render time.agent/internal/trust/trust.go, add an idempotent append to/root/.ssh/authorized_keys(mkdir 0700 / touch 0600 /grep -qxFguard — mirrorgatewaySelfTrustUnit's own script,internal/clan/vmguest.go:668-681) beforeUp. This is what makes the reachability preflight pass. Empty key ⇒ refuse loudly rather than install hollow trust, matchingInstallCerts' existing posture (ADR 0100).req.AuthorizedKeysininternal/provision/takeover.go:150-159from the same key, sorenderAccessemits a non-empty list and the re-imaged device answers the enroll-activate reconnect. Consider an explicit refusal inrenderAccess/writeNodeConfigwhen a member full-install would bake an empty key list — the guardrenderAccess' comment assumes exists.Design note for the implementer: an alternative is the SSH-CA route —
ClanTrustalready carries{CAPubKey, Principals}, which reads like it was meant forTrustedUserCAKeysplus a community-signed user cert for the control plane. That is cleaner (no per-device key distribution, revocable) but needs a user-cert minting path that does not exist yet, andCAPubKeytoday is a raw 32-byte ed25519 key written to a.crt(agent/internal/trust/trust.go:56) — not an OpenSSH CA key. Recommend the bare-key route for this fix and record the CA route as the follow-on, unless a maintainer rules otherwise.Testing: the seam tests here are unit-level (
internal/clan/enrollment_test.gocoversrenderAccess/access.nix;agent/internal/trust/trust_test.gocovers the trust adapter;internal/provision/takeover_test.gocovers the EnrollRequest shape). The real proof is a re-drive ofdrive-devicepastdeploy-takeover— a paid event, so land all three parts before re-arming.Not this
Healer commit
ccee5984self-fixed this same signature by exportingHOME=/rootin the control-plane unit (internal/clan/vmguest.go, drive20260829T182130Z). That fix is real and still in place — it cleared nixos-anywhere'sHOME: unbound variableand let the run get as far as the reachability preflight, which is where this defect lives. The signature repeating does not mean that fix regressed.drive
20260829T232735Zred atdeploy-takeover:deploy failed (rescue): clan: unreachable on node-req-0003: the takeover's deploy target root@100.107.208.101 is not reachable from this host — no SSH session could be established before the installevidence:
/home/swarm/swarm/Matou/idss/test-results/drive-device/20260829T232735Zon matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was capturedswarm-claim host=elitebook-distributed-server-03 run=14150
(automated multi-host claim — lowest live claim id works this ticket)
close-report for #1007 — status
success⛔ close-report gates REFUSED this close — the following claims did not verify:
8165443e2dis not reachable from origin/main (not landed)envelope
close-report for #1007 — status
success✅ close-report gates passed — every claim verified against main; issue closed.
envelope
node node-req-0003 has no deploy target(drive 20260903T223815Z) #1206