deploy-takeover: kanidm post-start cannot read root-owned files-oidc-secret (0400) #1097
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.
Blocks
Reference
Matou/idss#1097
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?
The failure
deploy-takeoveris the only red leg (26/27 green;verdict.json→"firstRedLeg": "deploy-takeover",skip: 0). This is not the known own-VPS pairing frontier —pairis green (157 ms) andlegs.jsoncarries no skip reasons at all.The takeover deploy adds the
nextcloudOAuth2 client to kanidm (ADR 0210, files off-gateway). kanidm'sExecStartPostprovisioner (kanidm-provision) creates the client, then dies reading the shared basic secret. That killskanidm.service→files-idp-client.servicethen burns its whole 5-minute settle budget against a dead kanidm →switch-to-configurationexits 4 → the drive's masked-exit detector fires.Evidence
Root cause,
logs/gateway-journal.txt:1354-1404(repeats identically at:1733-1757):kanidm dies on that control process (
gateway-journal.txt:1414-1419):The named
files-idp-clientfailure in the drive's own error string is downstream — it retries a dead listener for exactly 5 min, twice (gateway-journal.txt:1421,:1590-1618,:1964-1967):And the switch itself (
gateway-journal.txtat 02:33:35 and 02:38:39):End state on the box (
logs/gateway-units.txt), which is exactly the two units and no kanidm listener on127.0.0.1:8443:A/B control in the same journal. At founding (02:07:43) the identical provisioner ran green because the only client then was
gate-oidc, whose var does carry the kanidm read bit (internal/clan/vmguest.go:570-579—files.secret = { owner = "kanidm"; group = "kanidm"; mode = "0400"; };):Same binary, same code path, same user — succeeds on the owner-annotated var,
Permission deniedonfiles-oidc-secret.Suspected layer: product (gateway nix rendering)
The defect is a two-line disagreement inside
internal/clan/files_idp_gateway.go(the Go renderer that emitsmachines/<gateway>/files-idp.nix; this is the surface commit8bb9987d"#1088 — files-idp: impose the shared OAuth2 secret DECLARATIVELY (basicSecretFile)" touched):files_idp_gateway.go:190—fmt.Fprintf(&b, " basicSecretFile = %s;\n", cfg.SecretVar)hands the path to kanidm, which reads it as the non-rootkanidmuser (nixpkgsservices.kanidmsetsUser=kanidm, andkanidm-provisionruns asExecStartPostunder it).files_idp_gateway.go:158—renderFilesOIDCSecretGenerator(&b, "")passes an empty owner, sofiles.go:984emitsfiles.secret = { };→ clan's default root:root 0400.The empty owner is deliberate and commented (
files_idp_gateway.go:153-157: "kanidm split has no idss-idp bridge, so the file stays root-owned (clan's default) for its root-run consumers") — that reasoning was written for the root-runfiles-idp-clientconsumer and was not revisited whenbasicSecretFileadded a second, non-root consumer.files-oidc-secretis now the only kanidm-read var in the repo withoutowner = "kanidm";kanidm-tls,kanidm-adminsandgate-oidcall declare it.Not harness, not infra: the harness classified this correctly (it saw through clan's masked success to the exit-4 switch and named the real unit), and the box had 3.4 G RAM free / 63 G disk free with no network fault (
logs/gateway-stall.txt).What plugging it needs
Give the gateway's
files-oidc-secretfile the kanidm read bit — the same annotationgate-oidcalready carries — while keeping the device-side render root-owned (its consumer is root-runocc). SincerenderFilesOIDCSecretGeneratorcurrently takes one owner argument shared by both call sites, andshare = trueshares the secret's value but not its file mode, the two sides need to diverge: the gateway call atfiles_idp_gateway.go:158should renderfiles.secret = { owner = "kanidm"; group = "kanidm"; mode = "0400"; };, the device call atfiles.go:906should keep its current behaviour. The seam test atinternal/clan/files_idp_gateway_test.go:44already pins the renderedbasicSecretFileline and is the natural place to pin the owner line beside it. Re-drive to confirm; a second-order check is thatfiles-idp-clientshould then finish well inside its 60×5 s budget rather than exhausting it.Evidence that is absent
logs/droplet-journal.txtunder that name; the droplet journals harvested arelogs/gateway-journal.txt(671 KB, complete through 02:41) andlogs/device-journal.txt.logs/device-units.txt,device-journal.txt,device-caddy.txtall readroot@170.64.215.234: Permission denied (publickey,password,keyboard-interactive)withnote: device unit-state harvest failed (device unreachable?). This does not affect the diagnosis — the failure is entirely on the gateway.logs/broker-journal.txtis empty by design (off admin mesh, ADR 0208, #681);logs/guest-*.logreportthe guest was never created(this drive is DO-backed,host.jsonshowsqemu: exit ENOENT);logs/helper.logis 0 bytes.artifacts/journey.jsonandartifacts/verdict.jsonboth exist and agree withlegs.json.drive
20260901T005009Zred atdeploy-takeover:deploy failed (rescue): provision: deploy gateway: clan: deploy failed on 1 node(s): gateway: clan: masked_exit on gateway: clan reported success but the log shows a real failure: the remote switch dievidence:
/home/swarm/swarm/Matou/idss/test-results/drive-device/20260901T005009Zon matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was capturedAlready fixed — closing as a duplicate of #1095, which the watching session filed and landed while this report was being written.
The diagnosis here matches exactly (kanidm-provision runs as kanidm.service's post-start as the non-root
kanidmuser; the sharedfiles-oidc-secretvar was clan-default root:root 0400; the post-start's failure fails kanidm itself, and the namedfiles-idp-clientfailure is downstream against a dead listener). Thank you for the far better evidence trail —gateway-journal.txt:1354-1404and thestatus=4/NOPERMISSIONswitch line are the clean citations; the session read it live off the surviving droplet before the artifacts finished gathering.Fixed in
9d414e84—renderFilesOIDCSecretGenerator(&b, "kanidm")on the gateway side of the split, the gate client's long-standing shape for the identical reader (gate-oidc,internal/clan/vmguest.go:570-575: "kanidm reads it as the non-root kanidm user (basicSecretFile)"). Ownership stays per-machine —share = trueshares the VALUE, not the file mode — so the device keeps root (member device) or idss-idp (co-hosted), where no kanidm user exists and a kanidm owner would fail the chown (the mirror of #1029). Red-before-green pinned ininternal/clan/files_idp_gateway_test.go; fullinternal/clansuite green.No action needed on this ticket. #854's next cycle syncs
9d414e84and drives with the fix aboard.(Ruled by the session under ADR 0174 — a two-way-door render change with an in-repo precedent. It was fixed directly rather than routed to the swarm because the executor was already re-firing and each cycle pays a ~50–60 minute gateway-image rebuild — measured — before it would have re-hit this same line. That rebuild cost is now its own ticket, #1096.)