clan's second sops upload drops the SSH identity — control-plane row dies with Permission denied against a healthy guest #558

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

Symptom

Fresh tier-1 drives fail the control-plane deploy row with

[gateway] root@127.0.0.1: Permission denied (publickey,keyboard-interactive).
-- 'bash -c ...tar -C "$0" -xzf -' /var/lib/sops-nix 700

while the guest's door is demonstrably fine (the guest-trust key was Accepted 10+ times in the same boot, and manual ssh with that key succeeds before and after).

Evidence — the process capture (2026-08-15 drive, live ps capture of clan's ssh spawns)

The pinned clan CLI runs the sops secrets upload twice. The first invocation carries the identity; the second does not:

# phase 1 — succeeded
ssh root@127.0.0.1 -p 46595 -o IdentityFile=/home/benz/.config/Electron/guest-trust/id_ed25519 \
  -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
  -o ControlMaster=auto -o ControlPersist=1m -o ControlPath=/tmp/clan-ssh2xyvfnlq/socket \
  -- bash -c 'exec "$@"' -- bash -c 'install -d -m "$1" "$0" && ... tar -C "$0" -xzf -' /var/lib/sops-nix 700

# phase 2 — NO IdentityFile, fresh control socket → only the operator agent's key is offered → denied
ssh root@127.0.0.1 -p 46595 \
  -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
  -o ControlMaster=auto -o ControlPersist=1m -o ControlPath=/tmp/clan-sshk948rt4a/socket \
  -- bash -c 'exec "$@"' -- bash -c 'install -d -m "$1" "$0" && ... tar -C "$0" -xzf -' /var/lib/sops-nix 700

Every other spawn in the flow (fleetwire seeding, nix copy master + nix-daemon --stdio, resolver warmup, remote build, both systemd-run switch invocations) carried the identity correctly.

Cause (hypothesis to verify at the pinned rev)

ADR 0126's research verdict: machines update has no --identity-file, so the identity rides the --target-host URI's IdentityFile query parameter. The capture shows a later phase constructing its ssh from a DIFFERENT target-host resolution that lacks the query — most plausibly the machine's inventory/vars targetHost (seeded by the helper as a bare ssh://root@127.0.0.1:PORT) taking over from the CLI-passed target after the switch. Verify against clan-core rev d098fa2e which upload path builds the second call.

Rule / fix directions

Whichever resolution wins, it must carry the same identity. Helper-side (in our control): seed the gateway machine's targetHost WITH the IdentityFile query parameter (and consider IdentitiesOnly=yes — the phase-2 call also inherits whatever the operator's agent offers first). Alternatively pin the identity via a scoped ssh config for the deploy invocation. The misleading part to also fix: the operator sees "Permission denied" against their own VM with zero hint that a second, identity-less upload phase exists.

Proof

A fresh tier-1 drive's control-plane row completes: BOTH sops uploads authenticate (process capture shows the identity on each), and the drive proceeds to dashboard/brand/admin.

Chain context: this is the real cause behind the 2026-08-14/15 Permission-denied failures previously half-attributed to the post-activation door (#550 covers the genuine post-activation retry wall; #549 fixed the masked-exit false positive; #553 the earlyoom kill).

## Symptom Fresh tier-1 drives fail the **control-plane** deploy row with ``` [gateway] root@127.0.0.1: Permission denied (publickey,keyboard-interactive). -- 'bash -c ...tar -C "$0" -xzf -' /var/lib/sops-nix 700 ``` while the guest's door is demonstrably fine (the guest-trust key was Accepted 10+ times in the same boot, and manual ssh with that key succeeds before and after). ## Evidence — the process capture (2026-08-15 drive, live ps capture of clan's ssh spawns) The pinned clan CLI runs the sops secrets upload **twice**. The first invocation carries the identity; the second does not: ``` # phase 1 — succeeded ssh root@127.0.0.1 -p 46595 -o IdentityFile=/home/benz/.config/Electron/guest-trust/id_ed25519 \ -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ -o ControlMaster=auto -o ControlPersist=1m -o ControlPath=/tmp/clan-ssh2xyvfnlq/socket \ -- bash -c 'exec "$@"' -- bash -c 'install -d -m "$1" "$0" && ... tar -C "$0" -xzf -' /var/lib/sops-nix 700 # phase 2 — NO IdentityFile, fresh control socket → only the operator agent's key is offered → denied ssh root@127.0.0.1 -p 46595 \ -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ -o ControlMaster=auto -o ControlPersist=1m -o ControlPath=/tmp/clan-sshk948rt4a/socket \ -- bash -c 'exec "$@"' -- bash -c 'install -d -m "$1" "$0" && ... tar -C "$0" -xzf -' /var/lib/sops-nix 700 ``` Every other spawn in the flow (fleetwire seeding, nix copy master + `nix-daemon --stdio`, resolver warmup, remote build, both `systemd-run` switch invocations) carried the identity correctly. ## Cause (hypothesis to verify at the pinned rev) ADR 0126's research verdict: `machines update` has no `--identity-file`, so the identity rides the `--target-host` URI's `IdentityFile` query parameter. The capture shows a later phase constructing its ssh from a DIFFERENT target-host resolution that lacks the query — most plausibly the machine's inventory/vars `targetHost` (seeded by the helper as a bare `ssh://root@127.0.0.1:PORT`) taking over from the CLI-passed target after the switch. Verify against clan-core rev `d098fa2e` which upload path builds the second call. ## Rule / fix directions Whichever resolution wins, it must carry the same identity. Helper-side (in our control): seed the gateway machine's `targetHost` WITH the `IdentityFile` query parameter (and consider `IdentitiesOnly=yes` — the phase-2 call also inherits whatever the operator's agent offers first). Alternatively pin the identity via a scoped ssh config for the deploy invocation. The misleading part to also fix: the operator sees "Permission denied" against their own VM with zero hint that a second, identity-less upload phase exists. ## Proof A fresh tier-1 drive's control-plane row completes: BOTH sops uploads authenticate (process capture shows the identity on each), and the drive proceeds to dashboard/brand/admin. Chain context: this is the real cause behind the 2026-08-14/15 Permission-denied failures previously half-attributed to the post-activation door (#550 covers the genuine post-activation retry wall; #549 fixed the masked-exit false positive; #553 the earlyoom kill).
Author
Owner

swarm-claim host=elitebook-distributed-server-03 run=6565
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=6565 (automated multi-host claim — lowest live claim id works this ticket)
Author
Owner

close-report for #558 — status success

✅ close-report gates passed — every claim verified against main; closing.

envelope
{
  "issue": 558,
  "status": "success",
  "commits": [
    "b45c66a"
  ],
  "changed_files": [
    "internal/clan/render.go",
    "internal/clan/enrollment.go",
    "internal/clan/inventory.go",
    "internal/clan/render_test.go",
    "internal/clan/enrollment_test.go",
    "STATUS.md",
    "docs/GOTCHAS.md"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci -c go test ./internal/clan/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go build ./...",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go vet ./internal/clan/...",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c golangci-lint run ./internal/clan/...",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go test ./...",
      "exit_code": 0
    }
  ],
  "criteria": {
    "A fresh tier-1 drive's control-plane row completes: BOTH sops uploads authenticate (process capture shows the identity on each)": "The founding guest-trust identity now rides clan's native inventory deploy.targetHost as an ssh://<target>?IdentityFile=<key>&IdentitiesOnly=yes query (render.go deployTargetHostURI, fed writeNodeConfig's transient inventory.deployIdentity), so clan's second, inventory-resolved sops upload carries the same key its first (CLI --target-host) upload does. IdentitiesOnly=yes forces the guest-trust key to be the only one offered so the operator's agent keys can no longer be denied first. Proven at the render/inventory seam by TestRender_DeployIdentitySeedsClanTargetHostButModelStaysBare and the updated TestEnroll_TargetHostCarriesIdentityAtBothCallSitesButPersistsBare, which asserts the identity IS in clan's inventory.json ON DISK.",
    "Whichever resolution wins carries the same identity, without persisting the machine-local path into the replicated repo (ADR 0126)": "The OurCloud model's stored TargetHost stays bare — the identity is folded in only at the clan-file render and stripped straight back off on read (render.go bareTarget), asserted by both new tests loading the model bare. Every raw-ssh consumer (UnitActive, Supply) keeps reading the bare user@host:port. The bare-seed path (own-VPS ambient, general fleet) renders unchanged (TestEnroll_AmbientSSHRendersBareTargetDespiteConfiguredIdentity, TestEnroll_TargetHostBareWithoutConfiguredIdentity, TestRender_NoDeployIdentityRendersBareTargetHost)."
  },
  "summary": "The founding guest-trust identity now rides clan's inventory deploy.targetHost too, so clan's second (inventory-resolved) sops upload authenticates instead of dying Permission denied against a healthy guest.",
  "blockers": []
}
**close-report** for #558 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; closing. <details><summary>envelope</summary> ```json { "issue": 558, "status": "success", "commits": [ "b45c66a" ], "changed_files": [ "internal/clan/render.go", "internal/clan/enrollment.go", "internal/clan/inventory.go", "internal/clan/render_test.go", "internal/clan/enrollment_test.go", "STATUS.md", "docs/GOTCHAS.md" ], "tests": [ { "command": "nix develop .#go-ci -c go test ./internal/clan/", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go build ./...", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go vet ./internal/clan/...", "exit_code": 0 }, { "command": "nix develop .#go-ci -c golangci-lint run ./internal/clan/...", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go test ./...", "exit_code": 0 } ], "criteria": { "A fresh tier-1 drive's control-plane row completes: BOTH sops uploads authenticate (process capture shows the identity on each)": "The founding guest-trust identity now rides clan's native inventory deploy.targetHost as an ssh://<target>?IdentityFile=<key>&IdentitiesOnly=yes query (render.go deployTargetHostURI, fed writeNodeConfig's transient inventory.deployIdentity), so clan's second, inventory-resolved sops upload carries the same key its first (CLI --target-host) upload does. IdentitiesOnly=yes forces the guest-trust key to be the only one offered so the operator's agent keys can no longer be denied first. Proven at the render/inventory seam by TestRender_DeployIdentitySeedsClanTargetHostButModelStaysBare and the updated TestEnroll_TargetHostCarriesIdentityAtBothCallSitesButPersistsBare, which asserts the identity IS in clan's inventory.json ON DISK.", "Whichever resolution wins carries the same identity, without persisting the machine-local path into the replicated repo (ADR 0126)": "The OurCloud model's stored TargetHost stays bare — the identity is folded in only at the clan-file render and stripped straight back off on read (render.go bareTarget), asserted by both new tests loading the model bare. Every raw-ssh consumer (UnitActive, Supply) keeps reading the bare user@host:port. The bare-seed path (own-VPS ambient, general fleet) renders unchanged (TestEnroll_AmbientSSHRendersBareTargetDespiteConfiguredIdentity, TestEnroll_TargetHostBareWithoutConfiguredIdentity, TestRender_NoDeployIdentityRendersBareTargetHost)." }, "summary": "The founding guest-trust identity now rides clan's inventory deploy.targetHost too, so clan's second (inventory-resolved) sops upload authenticates instead of dying Permission denied against a healthy guest.", "blockers": [] } ``` </details>
ben closed this issue 2026-08-15 02:53:13 +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.

Dependencies

No dependencies set.

Reference
Matou/idss#558
No description provided.