front-door: ingress-and-tls — the real Caddy front door: forward_auth routes + LE wildcard via self-hosted acme-dns #219
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
Depends on
Reference
Matou/idss#219
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?
Parent
Founding spec #11 (the gateway role, ADR 0013) + members spec #19 (the gated door, ADRs 0074/0076). Contract-gap sweep 2026-07-30, filed on Ben's request.
What's true today
nix/holds exactly one file (the guest base image); the only real Caddy config in the repo is the spike's (spikes/kanidm-netbird/clan/machines/node1/gateway.nix). The four DNS records founding writes — apex A, wildcard A, and theacme.<domain>NS + glue pair (internal/founding/access.go) — point at machinery that has never been built.forward_authblock — one template, every service inherits it" — exists only as ADR text and a STATUS.md cross-feature edge. The auth gate's brain is real (member.GateDecision, keyed by slug; deny projection ininternal/memberorbit) but nothing calls it from an ingress.kanidm-brand.nixis compiled and committed by every brand apply, and consumed by nothing (grep hits onlyinternal/brandkit/surface.go).What to build
The front-door catalogue port's declarative part (ADR 0062 part 1), ported from the spike's
gateway.nixas behavioural reference (the ADR 0009 pattern):wt0) to its node, every route inheritingforward_authagainst the control plane's auth gate (ADR 0074), with each port's declared client-protocol exempt paths honoured (WebDAV/CalDAV/S3 — ADR 0074) and the komiti × service matrix enforced through the gate (ADR 0076).kanidm-brand.nix(name + mono logo only — the ADR 0038 boundary).Rendered/attached through the clan adapter's templating layer (ADR 0102 — the adapter is the only place that writes per-machine NixOS text). Proven the way this repo proves gateway work: a smoke on the clan-lab with a real name via the
lab-dnsskill (the #175/#182 precedent).Acceptance criteria
forward_auth— a suspended member is refused at the front door (ADR 0074), a matrix-restricted service refuses non-komiti members (ADR 0076)Task manifest
Blocks
The
catalogue: files-portticket (a browser-reachable branded login needs the front door). Likely also the real evidence path for #183 leg B·3 — left unlinked for Ben to judge, since #183 is his human-driven closeout.Blocked → ready-for-human (scope + lab-provability decision needed).
I picked this up as the first ready task and investigated it end to end. Two things stop it being a single completable slice, and the second is a hard structural blocker on its own seam:
1. The seam (
a clan-lab smoke with a real hostname) cannot exercise acceptance criteria 1 and 3.The lab's only DNS lever is the
lab-dnsskill, which drives one update-only record —clan-lab.matou.nz(an A record). Its API (dynamicdns.key-systems.net/update.php) has no create/delete and no NS/CNAME/TXT — it can only re-point that single A record. Given that:*.clan-lab.matou.nzwildcard needs DNS-01 (wildcards can't use HTTP-01), which needs aTXTat_acme-challenge.clan-lab.matou.nz— and acme-dns specifically needs theacme.<domain>NS delegation + glue thatinternal/founding/access.gowrites for a real apex.lab-dnscan create none of these. So no wildcard cert can issue on the lab.<slug>.<apex>) is not smokable either.files.clan-lab.matou.nzwould have to resolve to the lab; only the singleclan-lab.matou.nzrecord does, and*.matou.nzis a single-label wildcard that does not cover*.clan-lab.matou.nz(and even if it did, it points at matou-prod). Per-subdomain routing can't be exercised.What the lab can prove (the #175/#182 precedent, the spike's shape): a single hostname
clan-lab.matou.nzwith HTTP-01 TLS, Caddy reverse-proxying kanidm on loopback, the branded IdP login, andforward_authagainst the control plane's auth gate.2. Scope: this is the front-door epic, not one slice. It combines (a) a new HTTP
forward_authsurface exposingmember.GateDecisionto the ingress (Go, seam-testable), (b) a new nix front-door module (Caddy per-service route template +forward_auth+ exempt paths), (c) a self-hosted acme-dns server (no acme-dns machinery exists in-tree today — grep confirms), and (d) kanidm-behind-loopback consumingkanidm-brand.nix.Recommended split for a human to rule on:
forward_authHTTP endpoint + the Caddy front-door module + branded kanidm loopback, smoked single-host onclan-lab.matou.nzwith HTTP-01 TLS andforward_authenforcement (suspended member refused, komiti matrix enforced, exempt paths honoured). This is the piececatalogue: files-port(#220) actually needs to be browser-reachable.<slug>.<apex>routing, proven where the founding-writtenacme.<domain>NS delegation actually exists — i.e. #183's arena — or gated behind new lab DNS-delegation tooling if it must stay on the lab.Alternatively, if you intend the wildcard/acme-dns to be declared in the module but not lab-smoked (documented-only for now), say so and #219 can proceed as the single-host smoke with the wildcard config shipped unexercised.
needs_human_decisionwas[], so there was no prior ruling to follow. Leavingready-for-humanfor Ben to re-scope. No code changed.Still blocked on the scope ruling from the 2026-07-31 investigation. The issue was re-armed to
ready-for-agentat 05:32 without a narrowing comment, but the hard structural blocker stands: thelab-dnsseam drives only the singleclan-lab.matou.nzA record, so AC-1 (per-<slug>routing) and AC-3 (wildcard via self-hosted acme-dns, which needs DNS-01 + theacme.<domain>NS delegation + glue) cannot be smoked on the lab.I asked in Mattermost to confirm proceeding as a single-host smoke; no reply within the wait window, so re-blocking rather than guessing which scope to spend lab infra on.
Concrete proposal awaiting a ruling — proceed as the SINGLE-HOST clan-lab smoke (#175/#182 shape) delivering:
forward_authendpoint overmember.GateDecision(Go, seam-tested: suspended member refused, komiti matrix enforced, exempt paths bypass);forward_auth+ declared exempt paths), rendered through the clan adapter (ADR 0102);kanidm-brand.nix;<slug>routing declared;smoked single-host on
clan-lab.matou.nzwith HTTP-01 TLS +forward_authenforcement. The wildcard/acme-dns + per-<slug>proof defers to #183's real-hardware arena (the #219b split).To re-arm: reply OK on this scope (I close #219 on the single-host smoke), or post the split you want, then re-add
ready-for-agent.Ruling — full scope stands; the structural blocker is dissolved, not narrowed (ADR 0118).
The 2026-07-31 investigation's premise was correct at the time: the lab's only DNS lever was the single update-only
clan-lab.matou.nzA record. That premise is now false. matou.nz DNS hosting moved to deSEC (ADR 0118,dad3345): the zone has a real record-CRUD API behind policy-fenced tokens, and the registrar-visit class of blockers is gone.What now exists for this ticket (live, fence-tested tonight):
acme.clan-lab.matou.nzNS →ns.acme.clan-lab.matou.nz— a standing delegation for a self-hosted acme-dns on the lab droplet itself, mirroring the existingacme.dev.matou.nzprecedent in the zone. This is AC-3's architecture literally, one level down — the same shape every community gateway will run.MATOU_LAB_DNS_TOKEN(see thelab-dnsskill — the CLI now drives deSEC; Key-Systems is dead) covers exactly three RRsets:clan-lab/A (the existing point/park),ns.acme.clan-lab/A (the delegation glue → droplet IP), and_acme-challenge.clan-lab/CNAME (→ the droplet acme-dns's per-boot registration). Verified: 201 create / 204 delete on all three; 403 on everything else including the NS record itself.*.clan-lab.matou.nzresolution comes for free once the smoke points the wildcard the lab way — create*.clan-lab/CNAME →clan-lab.matou.nzvia the same API pattern if the implementation wants it standing, or the seam creates it. (If a fourth allow is needed on the token, ask — it is a one-line policy addition, not a design question.)Scope consequences:
acme_dnsrole in matou-distributed-servers is a working reference), registers an account, aims the challenge CNAME at it, and Caddy issues*.clan-lab.matou.nzover DNS-01. Carry the production landmines:resolvers 1.1.1.1 8.8.8.8in everytlsblock; the wildcard covers a single label (hyphenate, never dot).member.GateDecision): unchanged, as proposed in the 05:59 comment.Operational facts for the implementation (paid for during the migration, don't rediscover): deSEC repoints are PATCH not PUT; transient 429/5xx are real, retry with backoff; authoritative publication is eventually consistent (~60–120 s) — verify against
ns1.desec.io/ns2.desec.org, never assume. Teardown discipline extends to the two new records: a destroyed lab leaves glue + challenge CNAME deleted (thelab-dnsskill's parking philosophy applies to all three RRsets).Re-arming
ready-for-agent.Code slice landed on
origin/main(27e08c0). One scope decision left for you.Following your full-scope ruling (ADR 0118 dissolved the lab DNS blocker), I built and pushed the two pieces the contract-gap sweep found missing — both seam-tested, all green through the
nix develop .#go-cipre-push gate:1. The ingress now calls the auth gate (
AC-1/AC-2mechanics).internal/controlapi/authgate.go—GET /authz/gate(controlapi.WithAuthGate, wired live incontrol-plane/cmd/control-plane/main.go). It is the Caddyforward_authcallermember.GateDecision's brain lacked ("the auth gate's brain is real but nothing calls it from an ingress"):SessionResolver(default header-trust) is the honest seam to the kanidm-OIDC login the route redirects to (ADR 0038 — authentication is the login's, this is authorization).internal/controlapi/authgate_test.go(open allows, suspended refused, restricted refuses non-komiti / admits komiti, no-session 401, missing-service fails closed).2. The front door renders (
AC-1/AC-2/AC-3/AC-4declarative mechanics).internal/clan/frontdoor.go—clan.RenderFrontDoor, in the ADR 0102 templating layer (alongsiderenderNetworkd/renderDisko), emits the gateway'sfront-door.nix, ported from the spike's provengateway.nix:*.<apex>Caddy site issuing a LE wildcard over DNS-01 via self-hosted acme-dns with pinned resolvers1.1.1.1 8.8.8.8and thecaddy-dns/acmednsprovider pinned (ADR 0014 — the production landmines you flagged);forward_authtemplate that names its slug to the gate (AC-1);AC-2, ADR 0074);kanidm-brand.nix(ADR 0038 boundary);AC-4; the module lives only in a gateway machine dir, so a non-gateway node imports none of it).internal/clan/frontdoor_test.go, one per acceptance clause.The decision I'm leaving you (why this is
ready-for-human, not closed):AC-1's "browses its URL, Then Caddy serves it" and AC-3's "a real wildcard certificate issues" are live-hardware proofs this slice cannot produce on its own. Two genuine dependencies sit between the rendered module and a live smoke, and both are other slices:
front-door.nixinto a gateway machine config, populating routes (slug → ruled host → mesh target → exempt paths) from #218's slug→URL authority and the live placement, written under the clan single-writer. The render is the pure, exported seam that step calls — I did not wire it into enrollment, because routes come from the live service set, not fresh-host facts.OURCLOUD_ACMEDNS_*unit environment the render's DNS-01 block reads — already explicitly scoped out of broker #234.You tied AC-3's live proof to #183 leg B·3 yourself. So: do you want #219 to close on this code slice (with the attach + acme-dns-registration + live wildcard smoke tracked as the #219b / #183-arena follow-up you floated), or held open until that live smoke runs? I've banked the code on
maineither way; I won't unilaterally close an epic with unmet live acceptance. Re-armready-for-agenton the attach leg and I'll take it next.The two missing slices are now tickets, both
ready-for-agent(filed 2026-08-01 on Ben's go-ahead):front-door: gateway-attach— the provision-time caller ofclan.RenderFrontDoor: routes assembled from the #218 slug→URL authority + live placement + port exempt paths, written into the gateway machine dir under the clan single-writer (ADR 0102).front-door: acme-dns-registration— gateway-side acme-dns behind founding'sacme.<domain>delegation, the per-boot registration writingOURCLOUD_ACMEDNS_*before Caddy needs it, and the registration fulldomain surfaced for the_acme-challengeCNAME writer (broker #234 rented path /lab-dnson the lab).Neither is blocked; the swarm can take both now. The live wildcard smoke that proves this ticket's AC-1/AC-3 needs both and lives in the #183 leg B·3 arena — left unlinked from #183 for Ben to judge, per this ticket's own precedent.
Still open here: Ben's close-vs-hold ruling — close #219 on the landed code slice with the live proof tracked via #251/#252 + the #183 arena, or hold it open until that smoke runs.
Ben's ruling: close now on the landed code slice (2026-08-01).
The declarative machinery is done and banked on
main(27e08c0): the auth gate (GET /authz/gate) and the pureclan.RenderFrontDoorrender, both seam-tested. The remainder is tracked elsewhere:front-door: gateway-attach— wires the render into the gateway machine config at provision time (ready-for-agent).front-door: acme-dns-registration— gateway acme-dns + the per-boot registration feeding the DNS-01 block (ready-for-agent).Closing.