front-door: ingress-and-tls — the real Caddy front door: forward_auth routes + LE wildcard via self-hosted acme-dns #219

Closed
opened 2026-07-31 02:38:44 +00:00 by ben · 6 comments
Owner

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

  • No ingress or ACME machinery exists in the shipped tree. 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 the acme.<domain> NS + glue pair (internal/founding/access.go) — point at machinery that has never been built.
  • ADR 0074's consequence — "the per-service ingress route template gains the forward_auth block — 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 in internal/memberorbit) but nothing calls it from an ingress.
  • The IdP-login brand artifact kanidm-brand.nix is compiled and committed by every brand apply, and consumed by nothing (grep hits only internal/brandkit/surface.go).

What to build

The front-door catalogue port's declarative part (ADR 0062 part 1), ported from the spike's gateway.nix as behavioural reference (the ADR 0009 pattern):

  1. Caddy with the per-service route template: each provisioned service's ruled hostname reverse-proxied over the mesh (wt0) to its node, every route inheriting forward_auth against 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).
  2. Public TLS: Let's Encrypt wildcard via the self-hosted acme-dns the founding records already delegate to (ADR 0014). TLS terminates only on the gateway's Caddy.
  3. kanidm behind loopback proxied per the spike's proven shape, consuming the compiled 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-dns skill (the #175/#182 precedent).

Acceptance criteria

  • Given a provisioned service and the ruled hostname map, When a member browses its URL, Then Caddy serves it over the mesh behind forward_auth — a suspended member is refused at the front door (ADR 0074), a matrix-restricted service refuses non-komiti members (ADR 0076)
  • Given a port-declared exempt path, When a sync client hits it, Then it bypasses the browser gate (and is governed by credential provisioning instead)
  • Given the acme-dns delegation, When the gateway comes up on the lab, Then a real wildcard certificate issues and the sign-in screen serves it — carrying the community's name and mono logo from the compiled artifact
  • Given a node without the gateway role, Then nothing listens publicly — 80/443 on the gateway remain the fleet's only public ports

Task manifest

task: front-door:ingress-and-tls
implements_seam: "the front-door port's nixosModule (ADR 0062) — ingress route template (ADR 0074/0076) + public TLS (ADR 0014) + branded IdP login (ADR 0038)"
interface: "members reach every service through one authenticated, TLS-terminated front door"
seam: "a clan-lab smoke with a real hostname (lab-dns), per the smoke-* precedent"
acceptance:
  - given: a provisioned service; when: browsed at its ruled URL; then: TLS by the wildcard cert, forward_auth enforced, exempt paths honoured
depends_on: [control-plane:service-hostnames]
out_of_scope: [the portal page, per-service application modules (their port tickets), gateway re-homing flows]
needs_human_decision: []

Blocks

The catalogue: files-port ticket (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.

## 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 - **No ingress or ACME machinery exists in the shipped tree.** `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 the `acme.<domain>` NS + glue pair (`internal/founding/access.go`) — point at machinery that has never been built. - ADR 0074's consequence — "the per-service ingress route template gains the `forward_auth` block — 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 in `internal/memberorbit`) but nothing calls it from an ingress. - The IdP-login brand artifact `kanidm-brand.nix` is compiled and committed by every brand apply, and consumed by nothing (grep hits only `internal/brandkit/surface.go`). ## What to build The front-door catalogue port's declarative part (ADR 0062 part 1), ported from the spike's `gateway.nix` as behavioural reference (the ADR 0009 pattern): 1. **Caddy** with the per-service route template: each provisioned service's ruled hostname reverse-proxied over the mesh (`wt0`) to its node, every route inheriting `forward_auth` against 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). 2. **Public TLS**: Let's Encrypt wildcard via the self-hosted acme-dns the founding records already delegate to (ADR 0014). TLS terminates only on the gateway's Caddy. 3. **kanidm behind loopback** proxied per the spike's proven shape, consuming the compiled `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-dns` skill (the #175/#182 precedent). ## Acceptance criteria - [ ] Given a provisioned service and the ruled hostname map, When a member browses its URL, Then Caddy serves it over the mesh behind `forward_auth` — a suspended member is refused at the front door (ADR 0074), a matrix-restricted service refuses non-komiti members (ADR 0076) - [ ] Given a port-declared exempt path, When a sync client hits it, Then it bypasses the browser gate (and is governed by credential provisioning instead) - [ ] Given the acme-dns delegation, When the gateway comes up on the lab, Then a real wildcard certificate issues and the sign-in screen serves it — carrying the community's name and mono logo from the compiled artifact - [ ] Given a node without the gateway role, Then nothing listens publicly — 80/443 on the gateway remain the fleet's only public ports ## Task manifest ```yaml task: front-door:ingress-and-tls implements_seam: "the front-door port's nixosModule (ADR 0062) — ingress route template (ADR 0074/0076) + public TLS (ADR 0014) + branded IdP login (ADR 0038)" interface: "members reach every service through one authenticated, TLS-terminated front door" seam: "a clan-lab smoke with a real hostname (lab-dns), per the smoke-* precedent" acceptance: - given: a provisioned service; when: browsed at its ruled URL; then: TLS by the wildcard cert, forward_auth enforced, exempt paths honoured depends_on: [control-plane:service-hostnames] out_of_scope: [the portal page, per-service application modules (their port tickets), gateway re-homing flows] needs_human_decision: [] ``` ## Blocks The `catalogue: files-port` ticket (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.
Author
Owner

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-dns skill, 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:

  • AC 3 (wildcard via acme-dns) is not smokable. A *.clan-lab.matou.nz wildcard needs DNS-01 (wildcards can't use HTTP-01), which needs a TXT at _acme-challenge.clan-lab.matou.nz — and acme-dns specifically needs the acme.<domain> NS delegation + glue that internal/founding/access.go writes for a real apex. lab-dns can create none of these. So no wildcard cert can issue on the lab.
  • AC 1 (browse each service at <slug>.<apex>) is not smokable either. files.clan-lab.matou.nz would have to resolve to the lab; only the single clan-lab.matou.nz record does, and *.matou.nz is 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.nz with HTTP-01 TLS, Caddy reverse-proxying kanidm on loopback, the branded IdP login, and forward_auth against the control plane's auth gate.

2. Scope: this is the front-door epic, not one slice. It combines (a) a new HTTP forward_auth surface exposing member.GateDecision to 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 consuming kanidm-brand.nix.

Recommended split for a human to rule on:

  • #219a (lab-provable, a real slice): the forward_auth HTTP endpoint + the Caddy front-door module + branded kanidm loopback, smoked single-host on clan-lab.matou.nz with HTTP-01 TLS and forward_auth enforcement (suspended member refused, komiti matrix enforced, exempt paths honoured). This is the piece catalogue: files-port (#220) actually needs to be browser-reachable.
  • #219b (real-hardware / production leg): the LE wildcard via self-hosted acme-dns + per-<slug>.<apex> routing, proven where the founding-written acme.<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_decision was [], so there was no prior ruling to follow. Leaving ready-for-human for Ben to re-scope. No code changed.

**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-dns` skill, 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: - **AC 3 (wildcard via acme-dns) is not smokable.** A `*.clan-lab.matou.nz` wildcard needs DNS-01 (wildcards can't use HTTP-01), which needs a `TXT` at `_acme-challenge.clan-lab.matou.nz` — and acme-dns specifically needs the `acme.<domain>` **NS delegation + glue** that `internal/founding/access.go` writes for a real apex. `lab-dns` can create none of these. So no wildcard cert can issue on the lab. - **AC 1 (browse each service at `<slug>.<apex>`) is not smokable either.** `files.clan-lab.matou.nz` would have to resolve to the lab; only the single `clan-lab.matou.nz` record does, and `*.matou.nz` is 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.nz` with **HTTP-01** TLS, Caddy reverse-proxying kanidm on loopback, the branded IdP login, and `forward_auth` against the control plane's auth gate. **2. Scope: this is the front-door epic, not one slice.** It combines (a) a new HTTP `forward_auth` surface exposing `member.GateDecision` to 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 consuming `kanidm-brand.nix`. **Recommended split for a human to rule on:** - **#219a (lab-provable, a real slice):** the `forward_auth` HTTP endpoint + the Caddy front-door module + branded kanidm loopback, smoked single-host on `clan-lab.matou.nz` with HTTP-01 TLS and `forward_auth` enforcement (suspended member refused, komiti matrix enforced, exempt paths honoured). This is the piece `catalogue: files-port` (#220) actually needs to be browser-reachable. - **#219b (real-hardware / production leg):** the LE **wildcard via self-hosted acme-dns** + per-`<slug>.<apex>` routing, proven where the founding-written `acme.<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_decision` was `[]`, so there was no prior ruling to follow. Leaving `ready-for-human` for Ben to re-scope. No code changed.
Author
Owner

Still blocked on the scope ruling from the 2026-07-31 investigation. The issue was re-armed to ready-for-agent at 05:32 without a narrowing comment, but the hard structural blocker stands: the lab-dns seam drives only the single clan-lab.matou.nz A record, so AC-1 (per-<slug> routing) and AC-3 (wildcard via self-hosted acme-dns, which needs DNS-01 + the acme.<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:

  1. a control-plane HTTP forward_auth endpoint over member.GateDecision (Go, seam-tested: suspended member refused, komiti matrix enforced, exempt paths bypass);
  2. a Caddy front-door nixosModule with the per-service route template (forward_auth + declared exempt paths), rendered through the clan adapter (ADR 0102);
  3. branded kanidm-behind-loopback consuming kanidm-brand.nix;
  4. the LE-wildcard-via-self-hosted-acme-dns config declared in the module but not lab-smoked (documented-only), plus per-<slug> routing declared;

smoked single-host on clan-lab.matou.nz with HTTP-01 TLS + forward_auth enforcement. 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.

**Still blocked on the scope ruling from the 2026-07-31 investigation.** The issue was re-armed to `ready-for-agent` at 05:32 without a narrowing comment, but the hard structural blocker stands: the `lab-dns` seam drives only the single `clan-lab.matou.nz` A record, so AC-1 (per-`<slug>` routing) and AC-3 (wildcard via self-hosted acme-dns, which needs DNS-01 + the `acme.<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: 1. a control-plane HTTP `forward_auth` endpoint over `member.GateDecision` (Go, seam-tested: suspended member refused, komiti matrix enforced, exempt paths bypass); 2. a Caddy front-door nixosModule with the per-service route template (`forward_auth` + declared exempt paths), rendered through the clan adapter (ADR 0102); 3. branded kanidm-behind-loopback consuming `kanidm-brand.nix`; 4. the LE-wildcard-via-self-hosted-acme-dns config **declared** in the module but **not lab-smoked** (documented-only), plus per-`<slug>` routing declared; smoked single-host on `clan-lab.matou.nz` with HTTP-01 TLS + `forward_auth` enforcement. 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`.
Author
Owner

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.nz A 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.nz NS → ns.acme.clan-lab.matou.nz — a standing delegation for a self-hosted acme-dns on the lab droplet itself, mirroring the existing acme.dev.matou.nz precedent in the zone. This is AC-3's architecture literally, one level down — the same shape every community gateway will run.
  • The lab's MATOU_LAB_DNS_TOKEN (see the lab-dns skill — 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.
  • Per-slug names need no records at all: *.clan-lab.matou.nz resolution comes for free once the smoke points the wildcard the lab way — create *.clan-lab/CNAME → clan-lab.matou.nz via 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:

  • AC-1 (per-slug routing): smokable. Slugs resolve; Caddy routes by label against the slug→URL authority (#218, closed).
  • AC-3 (wildcard via self-hosted acme-dns): smokable, fully faithful. The droplet runs its own acme-dns (the acme_dns role in matou-distributed-servers is a working reference), registers an account, aims the challenge CNAME at it, and Caddy issues *.clan-lab.matou.nz over DNS-01. Carry the production landmines: resolvers 1.1.1.1 8.8.8.8 in every tls block; the wildcard covers a single label (hyphenate, never dot).
  • AC-2 (forward_auth over member.GateDecision): unchanged, as proposed in the 05:59 comment.
  • The single-host narrowing proposal is declined — it is no longer necessary.

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 (the lab-dns skill's parking philosophy applies to all three RRsets).

Re-arming 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.nz` A 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.nz` **NS → `ns.acme.clan-lab.matou.nz`** — a standing delegation for a **self-hosted acme-dns on the lab droplet itself**, mirroring the existing `acme.dev.matou.nz` precedent in the zone. This is AC-3's architecture literally, one level down — the same shape every community gateway will run. - The lab's `MATOU_LAB_DNS_TOKEN` (see the `lab-dns` skill — 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. - Per-slug names need **no records at all**: `*.clan-lab.matou.nz` resolution comes for free once the smoke points the wildcard the lab way — create `*.clan-lab`/CNAME → `clan-lab.matou.nz` via 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:** - **AC-1 (per-slug routing): smokable.** Slugs resolve; Caddy routes by label against the slug→URL authority (#218, closed). - **AC-3 (wildcard via self-hosted acme-dns): smokable, fully faithful.** The droplet runs its own acme-dns (the `acme_dns` role in matou-distributed-servers is a working reference), registers an account, aims the challenge CNAME at it, and Caddy issues `*.clan-lab.matou.nz` over DNS-01. Carry the production landmines: `resolvers 1.1.1.1 8.8.8.8` in every `tls` block; the wildcard covers a single label (hyphenate, never dot). - **AC-2 (forward_auth over `member.GateDecision`): unchanged**, as proposed in the 05:59 comment. - **The single-host narrowing proposal is declined** — it is no longer necessary. **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 (the `lab-dns` skill's parking philosophy applies to all three RRsets). Re-arming `ready-for-agent`.
Author
Owner

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-ci pre-push gate:

1. The ingress now calls the auth gate (AC-1 / AC-2 mechanics). internal/controlapi/authgate.go — GET /authz/gate (controlapi.WithAuthGate, wired live in control-plane/cmd/control-plane/main.go). It is the Caddy forward_auth caller member.GateDecision's brain lacked ("the auth gate's brain is real but nothing calls it from an ingress"):

  • 204 allow — echoes the verified identity for the route to copy onto the backend;
  • 403 deny — a suspended member (ADR 0074 deny projection) or a matrix-restricted service the member's komiti do not open (ADR 0076);
  • 401 unauthenticated — no SSO session, so the route redirects to the IdP login;
  • a route that fails to name its service fails closed, never open.
  • A pluggable 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).
  • Tests: 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-4 declarative mechanics). internal/clan/frontdoor.go — clan.RenderFrontDoor, in the ADR 0102 templating layer (alongside renderNetworkd/renderDisko), emits the gateway's front-door.nix, ported from the spike's proven gateway.nix:

  • one *.<apex> Caddy site issuing a LE wildcard over DNS-01 via self-hosted acme-dns with pinned resolvers 1.1.1.1 8.8.8.8 and the caddy-dns/acmedns provider pinned (ADR 0014 — the production landmines you flagged);
  • each provisioned service host-matched, reverse-proxied over the mesh (wt0) to its node, behind one forward_auth template that names its slug to the gate (AC-1);
  • each port's declared client-protocol exempt paths (WebDAV/CalDAV) bypass the browser gate and are governed by credential provisioning instead (AC-2, ADR 0074);
  • the IdP login route ungated (it IS the sign-in) proxying loopback kanidm whose login carries the community name + mono logo from the compiled kanidm-brand.nix (ADR 0038 boundary);
  • 80/443 the fleet's only public ports (AC-4; the module lives only in a gateway machine dir, so a non-gateway node imports none of it).
  • Deterministic (routes sorted by slug). Tests: 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:

  1. Attach: a provision-time step must wire front-door.nix into 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.
  2. acme-dns registration flow: the gateway-side per-boot acme-dns account registration that writes the 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 main either way; I won't unilaterally close an epic with unmet live acceptance. Re-arm ready-for-agent on the attach leg and I'll take it next.

**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-ci` pre-push gate: **1. The ingress now calls the auth gate (`AC-1` / `AC-2` mechanics).** `internal/controlapi/authgate.go` — `GET /authz/gate` (`controlapi.WithAuthGate`, wired live in `control-plane/cmd/control-plane/main.go`). It is the Caddy `forward_auth` caller `member.GateDecision`'s brain lacked ("the auth gate's brain is real but nothing calls it from an ingress"): - **204 allow** — echoes the verified identity for the route to copy onto the backend; - **403 deny** — a suspended member (ADR 0074 deny projection) or a matrix-restricted service the member's komiti do not open (ADR 0076); - **401 unauthenticated** — no SSO session, so the route redirects to the IdP login; - a route that fails to name its service **fails closed**, never open. - A pluggable `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). - Tests: `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-4` declarative mechanics).** `internal/clan/frontdoor.go` — `clan.RenderFrontDoor`, in the ADR 0102 templating layer (alongside `renderNetworkd`/`renderDisko`), emits the gateway's `front-door.nix`, ported from the spike's proven `gateway.nix`: - one `*.<apex>` Caddy site issuing a **LE wildcard over DNS-01 via self-hosted acme-dns** with pinned resolvers `1.1.1.1 8.8.8.8` and the `caddy-dns/acmedns` provider pinned (ADR 0014 — the production landmines you flagged); - each provisioned service **host-matched, reverse-proxied over the mesh (wt0)** to its node, behind **one `forward_auth` template** that names its slug to the gate (`AC-1`); - each port's declared **client-protocol exempt paths** (WebDAV/CalDAV) **bypass the browser gate** and are governed by credential provisioning instead (`AC-2`, ADR 0074); - the **IdP login route ungated** (it IS the sign-in) proxying **loopback kanidm** whose login carries the community name + mono logo from the compiled `kanidm-brand.nix` (ADR 0038 boundary); - **80/443 the fleet's only public ports** (`AC-4`; the module lives only in a gateway machine dir, so a non-gateway node imports none of it). - Deterministic (routes sorted by slug). Tests: `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: 1. **Attach:** a provision-time step must wire `front-door.nix` into 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. 2. **acme-dns registration flow:** the gateway-side per-boot acme-dns account registration that writes the `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 `main` either way; I won't unilaterally close an epic with unmet live acceptance. Re-arm `ready-for-agent` on the attach leg and I'll take it next.
Author
Owner

The two missing slices are now tickets, both ready-for-agent (filed 2026-08-01 on Ben's go-ahead):

  • #251 front-door: gateway-attach — the provision-time caller of clan.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).
  • #252 front-door: acme-dns-registration — gateway-side acme-dns behind founding's acme.<domain> delegation, the per-boot registration writing OURCLOUD_ACMEDNS_* before Caddy needs it, and the registration fulldomain surfaced for the _acme-challenge CNAME writer (broker #234 rented path / lab-dns on 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.

**The two missing slices are now tickets, both `ready-for-agent`** (filed 2026-08-01 on Ben's go-ahead): - **#251 `front-door: gateway-attach`** — the provision-time caller of `clan.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). - **#252 `front-door: acme-dns-registration`** — gateway-side acme-dns behind founding's `acme.<domain>` delegation, the per-boot registration writing `OURCLOUD_ACMEDNS_*` before Caddy needs it, and the registration fulldomain surfaced for the `_acme-challenge` CNAME writer (broker #234 rented path / `lab-dns` on 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.
Author
Owner

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 pure clan.RenderFrontDoor render, both seam-tested. The remainder is tracked elsewhere:

  • #251 front-door: gateway-attach — wires the render into the gateway machine config at provision time (ready-for-agent).
  • #252 front-door: acme-dns-registration — gateway acme-dns + the per-boot registration feeding the DNS-01 block (ready-for-agent).
  • Live proof (a member browses a URL through Caddy; a real wildcard issues) — the #183 leg B·3 arena, once #251/#252 land.

Closing.

**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 pure `clan.RenderFrontDoor` render, both seam-tested. The remainder is tracked elsewhere: - **#251** `front-door: gateway-attach` — wires the render into the gateway machine config at provision time (`ready-for-agent`). - **#252** `front-door: acme-dns-registration` — gateway acme-dns + the per-boot registration feeding the DNS-01 block (`ready-for-agent`). - **Live proof** (a member browses a URL through Caddy; a real wildcard issues) — the #183 leg B·3 arena, once #251/#252 land. Closing.
ben 2026-08-01 00:54:40 +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.

Reference
Matou/idss#219
No description provided.