fleetwire: the prepare script's umask 077 leaves /srv/idss 0700 — idss-idp and the Mātou config server (non-root units) die 203/EXEC and the deploy never finishes #2187
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#2187
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?
What happened
tu-ia rented founding (app 2026.11.3426 at
a5025990), 2026-11-10 — after #2185 and the hand-added_acme-challengeCNAME (#2186), the gateway enrolled, got its certificates and the deploy began at 12:42. It then sat indeployingfor 30+ minutes with the gateway idle (load 0.06). On the box:Both crash-looping (restart counter 15+),
https://id.tech.tuia.co/a 502 through Caddy.ls -la:Why
internal/fleetwire/prepare.go's box script setsumask 077(right for the SSH and sops keys it writes) and thenmkdir -p "$R/srv/idss"— so the fleet root is born 0700. The supply later creates/srv/idss/bin0755 and chmods every binary 0755, but the parent stays 0700, and a non-root unit cannot traverse it:idss-idpruns asUser=idss-idp, the Mātou config server asDynamicUser=true. The control plane runs as root, so it works and the deploy reaches the point where it waits on the IdP bridge's health forever. Nothing in the gateway render (keri.go/idss-idpunit) owns the directory mode either.Fix
chmod 755 "$R/srv/idss"right after themkdir -pin the prepare script (explicit, umask-independent; the lock inside stays 0600).TestPrepareBox_FleetRootIsTraversableByServiceUsersruns the real script in the sandbox and fails before / passes after. On tu-ia the box was repaired by hand (chmod 755 /srv/idss, restart the two units — both active within seconds,id.tech.tuia.coanswering) at 13:13.Consider also a
systemd.tmpfilesruled /srv/idss 0755 root root -in the gateway render so the mode is owned by the deployed system, not only by the one-shot prepare, and a health-wait message that names the EXEC failure instead ofcurl: (7)×60.Related: #2185, #2186,
internal/fleetwire/prepare.go,internal/fleetwire/supply.go,internal/clan/keri.go(idss-idp unit), ADR 0196.Fix on main as
db4bddee(GOTCHAS #414, STATUS line):chmod 755 "$R/srv/idss"after themkdir -pin the prepare script;TestPrepareBox_FleetRootIsTraversableByServiceUsersruns the real script in the sandbox — red before, green after;go test ./internal/fleetwire/green. tu-ia's box was repaired by hand at 13:13 (both units active,id.tech.tuia.coanswering) and the deploy is continuing on it; a fresh box needs the next app build.Ruled by agent under ADR 0174 — veto anytime.
Ruling. The bug this issue reports — the rented deploy hung because
/srv/idsswas born0700under the prepare script'sumask 077, soidss-idp(User=idss-idp) andmatou-config-server(DynamicUser=true) died203/EXECand the IdP-bridge health wait never cleared — is already fixed onmainatdb4bddee: an explicitchmod 755 "$R/srv/idss"after themkdir -pininternal/fleetwire/prepare.go, guarded byTestPrepareBox_FleetRootIsTraversableByServiceUsers, hazard logged as GOTCHAS #414. tu-ia's box was repaired by hand at 13:13.What is not implemented is this issue's own "Consider also" defence-in-depth, which I verified is still absent on
main:systemd.tmpfilesrule owns/srv/idss's mode in the gateway render (grep -rn 'd /srv/idss 0755' internal/is empty; only thechmodin the one-shot prepare script sets it);curl: (7)with no hint at the203/EXECcause.I'm re-scoping this ticket to those two follow-ups and labelling it
enhancement+ready-for-agent. Category isenhancement, notbug: the break itself is fixed and test-guarded — what remains is hardening and diagnostics.Why a two-way door. Both items are backend Go + unit-test changes, reversible by a single commit and provable by tests run in the sandbox; no personal credentials, no security-posture widening, no member-facing trust accept, no data destruction, no non-routine spend. Nothing here sits on the one-way-door list.
Agent brief
The deploy-blocking fix (
chmod 755inprepare.go) is done — do not touch it. This ticket is only the two hardening items the filer flagged.1. Let the deployed system own
/srv/idss's mode, not only the one-shot prepare script.Add a
systemd.tmpfilesruled /srv/idss 0755 root root -to the gateway render so the fleet root's traversable mode is re-asserted on every boot, independent of how the directory first came to exist. The gateway/IdP render lives ininternal/clan/keri.go(theidss-idpunit and/srv/idss/bin/*paths are defined there — seeConfigServerBinaround line 140). Wire the tmpfiles rule alongside the unit so a fresh box and every subsequent boot carry it. Guard it with a render assertion test ininternal/clan/(the existingkeri/render tests are the pattern) that fails if the rule is absent.2. Make the IdP-bridge health wait name the real failure.
Today a non-root unit crash-looping on
203/EXECpresents to the deploy as ~60×curl: (7)with no cause, which cost ~30 min of opaquedeployingon tu-ia. In the deploy health-wait loop (internal/founding/deploy.go— the probe/retry loops around lines 1505–1620 are the shape; find the one that waits on the IdP bridge), when the wait exhausts (or periodically), emit a message that points at the likely cause: the unit is up but failing atEXEC/Permission deniedrather than merely unreachable. Prefer reading the unit'ssystemctl is-active/status(or the restart counter) over inferring fromcurlalone, so the operator sees "idss-idp failing at exec (203/EXEC)" instead ofcurl: (7). Guard the message shape with a unit test next to the existing deploy-log tests.Scope / non-goals. No change to
prepare.go'schmodor its test. Helper-side code (internal/clan,internal/founding,internal/fleetwire), so it reaches a founder only through a rebuilt app at the signed-feed revision (#1769, the normal deploy rail) — that is out of this ticket's hands.Acceptance.
d /srv/idss 0755 root root -tmpfiles rule is present in the gateway render.curl: (7).go test ./internal/clan/... ./internal/founding/...green.Pointers.
internal/fleetwire/prepare.go(the landed fix, reference only),internal/clan/keri.go(gateway/IdP render),internal/founding/deploy.go(health-wait loops), ADR 0196, GOTCHAS #414, #2185, #2186.sh -cover ssh — the remote shell re-parses the words,sh -c gitprints usage and the flip faults (Retry then faults at the mv) #2188swarm-claim host=bens-mac-04 run=63202
(automated multi-host claim — lowest live claim id works this ticket)
sh -cover ssh — the remote shell re-parses the words,sh -c gitprints usage and the flip faults (Retry then faults at the mv) #2188⏩ independent reviewer for #2187 — verdict
unauthenticatedreview JSON
close-report for #2187 — status
success✅ close-report gates passed — every claim verified against the pushed worker branch
sandcastle/worker/20261110-134338-cb6e57(pre-land — the host promotes it tomainonly after its post-run verify, #193/#283); issue closed.envelope
🚨 Reopened — a push-mode close did NOT land on
main(#283). close-report closed this issue against the pushed worker branch, but the host's post-run verify rolled the land back (the promote did not advance main (a no-op push to main)), soorigin/mainnever carried the commits (3d77157cf324bbdd14eba561ddf1b5ce744cdb27). The gates-passed comment above is therefore NOT true ofmain. Reopening and relabellingready-for-sessionso the work is redone where it can land; the commits are parked on a rescue branch for triage (see this run's alarm).close-report for #2187 — status
success(push-mode; verify-only — all work already onmain).Ruled by agent under ADR 0174 — veto anytime. The full scope of this ticket is genuinely on
origin/main; this session verified it rather than re-landing, because the hardening work the reopen (#70291) flagged as un-landed subsequently landed as a sibling commit.What is on
mainCore deploy-blocking fix —
cbb50b54's parentdb4bddee(already verified in #70251):chmod 755 "$R/srv/idss"after themkdir -pininternal/fleetwire/prepare.go:57, so the fleet root is0755regardless of the script'sumask 077. The founding lock inside keeps its private mode.The two re-scoped hardening follow-ups (brief #70253) —
cbb50b54:internal/clan/keri.go—renderFleetRootTmpfilesemitssystemd.tmpfiles.rules = [ "d /srv/idss 0755 root root -" ]inRenderKeri, so the deployed system owns the fleet-root mode on every boot and on a fresh box (the trailing-leaves the seeded binaries + lock untouched).FleetRootconst added.internal/founding/deploy.go—fleetRootExecFailureHintreads the harvested switch journal on a deploy failure and names the203/EXEC/Permission denied/Errno 13-beside-/srv/idsscause in a control-plane-row line, instead of the ~60× barecurl: (7)the health wait printed (which cost ~30 min of opaquedeployingon tu-ia).Why reopened, and why it's done now
The earlier swarm close (#70279) closed against the parked worker branch
sandcastle/worker/20261110-134338-cb6e57(3d77157…), whose promote was a no-op push tomain(#283), so #70291 reopened it. That parked commit is still not an ancestor oforigin/main, but the equivalent work re-landed ascbb50b54(same five files, same change) and is an ancestor oforigin/main(git merge-base --is-ancestor cbb50b54 origin/main→ true). Nothing is missing and nothing needed re-landing.Proof (run this session against
origin/main=cbb50b54)d /srv/idss 0755 root root -tmpfiles ruleTestRenderKeri_FleetRootTmpfilesRulePASS (+TestRenderKeri_ParsesUnderNixPASS — still parses under Nix)curl: (7)TestFleetRootExecFailureHintPASSgo test ./internal/clan/... ./internal/founding/...greenok internal/clan,ok internal/foundingTestPrepareBox_FleetRootIsTraversableByServiceUsersPASS (internal/fleetwire/)go vet ./internal/clan/ ./internal/founding/ ./internal/fleetwire/exit 0;gofmt -lclean on all five files.GOTCHAS #414 logged. Closing.
The hand-applied
chmod 755 /srv/idssheld through the rest of the walk (deploy complete 13:32, authority flipped 22:01 on app 3430, zero failed units). The prepare-script fix (db4bddee) and sandcastle's deploy-side hardening (cbb50b54) have not yet been exercised on a FRESH box — leaving this open until the next fresh rental walks through.