forge: authentik-smoke never pipes curl into an early-exiting reader (exit 23 on healthy IdP) #157
No reviewers
Labels
No labels
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
key-store/key.store!157
Loading…
Reference in a new issue
No description provided.
Delete branch "claude/epic-torvalds-c8fe5d"
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?
authentik-smoke.servicefailed on every hourly run for days (curl: Failed writing body, status=23) while Authentik itself was healthy.Cause — the three SAML metadata probes were
curl -fsSL … | grep -q 'entityID=…'. The entityID sits on line 1 of the ~6.4 KB metadata; curl writes the body into the pipe in two chunks (4096 + rest);grep -qexits on the first match; curl's second write hits EPIPE → exit 23, and underpipefailthat is the pipeline's status because grep exited 0. Reproduced on the forge: the deployed script passes 5/10 (the Zulip metadata pipeline alone fails 7/10).Fix — every HTTP body lands in a shell variable before anything inspects it: new
check_oidc_discovery/check_saml_metadata_entity_idhelpers, and the JWKS loop +check_saml_metadata_certfetch first and runjq/grepon a here-string. No curl stdout ever feeds a reader that can stop early, so exit 23 cannot occur.fetchadds--max-time 60(the oneshot hasTimeoutStartSec=infinity, so a stalled upstream would otherwise park the unit and starve the timer). The discovery / entityID checks now say which provider failed instead of exiting 1 silently. All assertions are kept (readiness, per-provider issuer, authorize probes, SAML entityIDs, SAML/OIDC certificate checks).Verification on the forge (script rendered with
nix eval .#nixosConfigurations.keystore-forge.config.systemd.services.authentik-smoke.script, run under the unit's own PATH):set -ematches the unit: IdP connection refused → rc 7; Caddy-style 502 (local TLS stub) → rc 22The requested URL returned error: 502; upstream accepts and never answers → rc 28 (--max-time); unknown provider (404) → rc 22; wrong issuer / non-JSON / empty body → rc 1 with… discovery document does not publish its own issuer; wrong or prefix entityID → rc 1 with… does not publish entityID …Follow-up after merge: forge switch, then
systemctl status authentik-smokeafter the next timer run.