front-door: acme-dns-registration — gateway-side acme-dns + the per-boot registration that writes OURCLOUD_ACMEDNS_* #252

Closed
opened 2026-08-01 00:47:51 +00:00 by ben · 1 comment
Owner

Parent

Front-door epic #219 — its rendered DNS-01 block reads a unit environment nothing writes (#219 comment, 2026-07-31). ADR 0014 (LE wildcard via self-hosted acme-dns), ADR 0118 + Ben's #219 ruling of 2026-07-31 (the standing lab delegation).

What's true today

  • The rendered front-door.nix (landed 27e08c0) pins the caddy-dns/acmedns provider with resolvers 1.1.1.1 8.8.8.8 and reads OURCLOUD_ACMEDNS_* unit environment — credentials no step produces. This flow was explicitly scoped out of broker #234: the broker writes the _acme-challenge.<slug> CNAME whose target is "the community's acme-dns registration"; the registration itself is gateway-side.
  • Founding's four records already delegate acme.<domain> NS + glue to the gateway (internal/founding/access.go).
  • On the lab, the architecture exists one level down, live and fence-tested (#219 ruling, ADR 0118): acme.clan-lab.matou.nz NS → ns.acme.clan-lab.matou.nz is a standing delegation for a self-hosted acme-dns on the lab droplet, mirroring the acme.dev.matou.nz precedent; the lab-dns token covers exactly the glue A and the _acme-challenge.clan-lab CNAME.

What to build

The gateway-side acme-dns half:

  1. Self-hosted acme-dns on the gateway, serving the delegated acme.<domain> zone (the thing founding's NS + glue records already point at) — declarative, in the gateway machine dir only.
  2. The per-boot registration flow: register an account against the local acme-dns and write the credentials as the OURCLOUD_ACMEDNS_* unit environment Caddy's DNS-01 block reads, ordered so the environment exists before Caddy first needs it.
  3. Surface the registration's fulldomain as a readable fact, so the _acme-challenge CNAME writer (broker #234 on the rented path; the lab-dns skill on the lab) can point the challenge CNAME at it.

Acceptance criteria

  • Given a gateway boot, When the registration unit has run, Then acme-dns answers for the delegated zone and OURCLOUD_ACMEDNS_* is populated before Caddy attempts issuance (unit ordering, not luck)
  • Given repeated boots, Then the challenge CNAME's target stays valid — registration is stable, or re-registration republishes the fulldomain fact for the CNAME writer
  • Given the credentials are absent or the registration failed, Then issuance fails loud (no silent hang, no fallback to a public DNS provider)
  • Given a non-gateway machine, Then it runs no acme-dns and holds no registration credentials

Task manifest

task: front-door:acme-dns-registration
implements_seam: "the gateway-side acme-dns (ADR 0014) behind founding's acme.<domain> delegation + the per-boot registration that feeds the render's DNS-01 block (OURCLOUD_ACMEDNS_*)"
interface: "a freshly-booted gateway can prove wildcard DNS-01 ownership with no public-DNS credentials on the box"
seam: "unit-level tests over the registration flow + rendered-config assertions; live issuance rides the lab smoke"
acceptance:
  - given: a gateway boot; when: the registration unit runs; then: acme-dns serves the delegated zone, OURCLOUD_ACMEDNS_* exists before Caddy needs it, and the fulldomain fact is readable for the CNAME writer
depends_on: []
out_of_scope: [the _acme-challenge CNAME writes themselves (broker #234 rented path / lab-dns on the lab), the provision-time route attach (sibling ticket), the live lab smoke (#183 leg B·3 arena)]
needs_human_decision: []

Blocks

The live wildcard smoke proving #219 AC-3 needs this and the sibling front-door: gateway-attach ticket; that smoke lives in the #183 leg B·3 arena — left unlinked from #183 for Ben to judge, per #219's own precedent.

## Parent Front-door epic #219 — its rendered DNS-01 block reads a unit environment nothing writes (#219 comment, 2026-07-31). ADR 0014 (LE wildcard via self-hosted acme-dns), ADR 0118 + Ben's #219 ruling of 2026-07-31 (the standing lab delegation). ## What's true today - The rendered `front-door.nix` (landed `27e08c0`) pins the `caddy-dns/acmedns` provider with resolvers `1.1.1.1 8.8.8.8` and reads **`OURCLOUD_ACMEDNS_*` unit environment** — credentials no step produces. This flow was **explicitly scoped out of broker #234**: the broker writes the `_acme-challenge.<slug>` CNAME whose *target* is "the community's acme-dns registration"; the registration itself is gateway-side. - Founding's four records already delegate `acme.<domain>` NS + glue to the gateway (`internal/founding/access.go`). - On the lab, the architecture exists one level down, live and fence-tested (#219 ruling, ADR 0118): `acme.clan-lab.matou.nz` NS → `ns.acme.clan-lab.matou.nz` is a standing delegation for a self-hosted acme-dns on the lab droplet, mirroring the `acme.dev.matou.nz` precedent; the `lab-dns` token covers exactly the glue A and the `_acme-challenge.clan-lab` CNAME. ## What to build The gateway-side acme-dns half: 1. **Self-hosted acme-dns on the gateway**, serving the delegated `acme.<domain>` zone (the thing founding's NS + glue records already point at) — declarative, in the gateway machine dir only. 2. **The per-boot registration flow**: register an account against the local acme-dns and write the credentials as the `OURCLOUD_ACMEDNS_*` unit environment Caddy's DNS-01 block reads, ordered so the environment exists before Caddy first needs it. 3. **Surface the registration's fulldomain** as a readable fact, so the `_acme-challenge` CNAME writer (broker #234 on the rented path; the `lab-dns` skill on the lab) can point the challenge CNAME at it. ## Acceptance criteria - [ ] Given a gateway boot, When the registration unit has run, Then acme-dns answers for the delegated zone and `OURCLOUD_ACMEDNS_*` is populated before Caddy attempts issuance (unit ordering, not luck) - [ ] Given repeated boots, Then the challenge CNAME's target stays valid — registration is stable, or re-registration republishes the fulldomain fact for the CNAME writer - [ ] Given the credentials are absent or the registration failed, Then issuance fails loud (no silent hang, no fallback to a public DNS provider) - [ ] Given a non-gateway machine, Then it runs no acme-dns and holds no registration credentials ## Task manifest ```yaml task: front-door:acme-dns-registration implements_seam: "the gateway-side acme-dns (ADR 0014) behind founding's acme.<domain> delegation + the per-boot registration that feeds the render's DNS-01 block (OURCLOUD_ACMEDNS_*)" interface: "a freshly-booted gateway can prove wildcard DNS-01 ownership with no public-DNS credentials on the box" seam: "unit-level tests over the registration flow + rendered-config assertions; live issuance rides the lab smoke" acceptance: - given: a gateway boot; when: the registration unit runs; then: acme-dns serves the delegated zone, OURCLOUD_ACMEDNS_* exists before Caddy needs it, and the fulldomain fact is readable for the CNAME writer depends_on: [] out_of_scope: [the _acme-challenge CNAME writes themselves (broker #234 rented path / lab-dns on the lab), the provision-time route attach (sibling ticket), the live lab smoke (#183 leg B·3 arena)] needs_human_decision: [] ``` ## Blocks The live wildcard smoke proving #219 AC-3 needs this **and** the sibling `front-door: gateway-attach` ticket; that smoke lives in the #183 leg B·3 arena — left unlinked from #183 for Ben to judge, per #219's own precedent.
Author
Owner

Landed in 2697d43 on main.

clan.RenderAcmeDNS (internal/clan/acmedns.go) renders the gateway machine dir's acme-dns.nix — a pure render mirroring RenderFrontDoor, so a later provisioning slice writes it under the clan single-writer (ADR 0102):

  • Self-hosted acme-dns authoritative for the delegated acme.<domain> zone founding's NS + glue already point at: public 53 (LE's resolver follows the delegation here) with SOA/NS/glue records; the register/update HTTP API bound to 127.0.0.1 only — no public-DNS credential leaves the box (the manifest interface). AC-1 serve side.
  • Per-boot registration oneshot: registers ONCE against the local acme-dns, reuses the stored account across boots from a persistent StateDirectory (stable challenge-CNAME target — AC-2), and (re)publishes every boot both the OURCLOUD_ACMEDNS_* env Caddy reads (0600; the same four constants frontdoor.go defines, so the halves cannot drift) and the world-readable fulldomain fact the _acme-challenge CNAME writer points at.
  • Ordering, not luck: registration before caddy.service and pulled in by it (AC-1); Caddy Requires it with a non-optional EnvironmentFile, and jq -e/set -euo pipefail/exit 1 on a failed register or bad account, so a missing/failed registration fails issuance loud — no silent hang, no fallback to a public DNS provider (AC-3).
  • Gateway-dir-only, so a non-gateway node imports none of it, runs no acme-dns, holds no credentials (AC-4).

Seam: internal/clan/acmedns_test.go (8 rendered-config assertions). STATUS.md updated (header lead + milestone log).

Out of scope / still open: the _acme-challenge CNAME writes (broker #234 / lab-dns), the provision-time attach (sibling #251), the live lab smoke (#183 leg B·3).

Landed in `2697d43` on `main`. `clan.RenderAcmeDNS` (`internal/clan/acmedns.go`) renders the gateway machine dir's `acme-dns.nix` — a pure render mirroring `RenderFrontDoor`, so a later provisioning slice writes it under the clan single-writer (ADR 0102): - **Self-hosted acme-dns** authoritative for the delegated `acme.<domain>` zone founding's NS + glue already point at: public 53 (LE's resolver follows the delegation here) with SOA/NS/glue records; the register/update HTTP API bound to `127.0.0.1` only — no public-DNS credential leaves the box (the manifest interface). *AC-1 serve side.* - **Per-boot registration oneshot**: registers ONCE against the local acme-dns, reuses the stored account across boots from a persistent `StateDirectory` (stable challenge-CNAME target — **AC-2**), and (re)publishes every boot both the `OURCLOUD_ACMEDNS_*` env Caddy reads (0600; the same four constants `frontdoor.go` defines, so the halves cannot drift) and the world-readable `fulldomain` fact the `_acme-challenge` CNAME writer points at. - **Ordering, not luck**: registration `before caddy.service` and pulled in by it (**AC-1**); Caddy `Requires` it with a non-optional `EnvironmentFile`, and `jq -e`/`set -euo pipefail`/`exit 1` on a failed register or bad account, so a missing/failed registration fails issuance loud — no silent hang, no fallback to a public DNS provider (**AC-3**). - **Gateway-dir-only**, so a non-gateway node imports none of it, runs no acme-dns, holds no credentials (**AC-4**). Seam: `internal/clan/acmedns_test.go` (8 rendered-config assertions). STATUS.md updated (header lead + milestone log). Out of scope / still open: the `_acme-challenge` CNAME writes (broker #234 / lab-dns), the provision-time attach (sibling #251), the live lab smoke (#183 leg B·3).
ben closed this issue 2026-08-01 01:22: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.

Dependencies

No dependencies set.

Reference
Matou/idss#252
No description provided.