gateway: the private path renders the real front door, and deploying a routed service adds its route (drive-arc T2) #359

Closed
opened 2026-08-09 18:17:56 +00:00 by ben · 1 comment
Owner

Slice T2 of the Nextcloud-provision drive arc — docs/superpowers/specs/2026-08-09-nextcloud-provision-e2e-design.md (commit c72bff1)

Two halves, both production-shaped:

(a) Front door on the private path. When GatewayFacts.Public is nil, the guest still renders Caddy: bound to guest 443; wildcard *.<apex> cert from a new guest-CA-signed clan-var (the kanidm-tls generator pattern, vmguest.go); the acme DNS-01 block replaced by local cert files; a fourth qemu hostfwd 127.0.0.1:<web>→443 (internal/vm/manager.go + unit regexes + evidence.ts reader); guest /etc/hosts maps the apex labels to loopback and the guest trusts its own CA (security.pki.certificateFiles) so the in-guest health check passes TLS.

(b) Route on deploy. attachCatalogueService (internal/provision/deploy.go) also drives AttachFrontDoor with the deployed service's LiveService route — today no production path ever adds a route. Nextcloud's nginx binds a loopback port (dissolving the Caddy:80/443 vs nginx:80 collision, cf. meetings.go's mesh-port precedent); the front door proxies to it.

The files route ships WITHOUT forward_auth (ADR 0150): Nextcloud's own OIDC login is the wall; gating it rides the auth-gate follow-up.

Accept

  • A private-path gateway's composed configuration.nix imports front-door.nix; Caddy serves https://files.<apex> → Nextcloud and https://id.<apex> → kanidm on the guest.
  • A files deploy adds the route idempotently; re-deploy no-ops.
  • The in-guest health probe of https://files.<apex>/status.php passes TLS + resolution.
  • Seam tests + nix-instantiate --parse smoke over the composed config.
## Slice T2 of the Nextcloud-provision drive arc — `docs/superpowers/specs/2026-08-09-nextcloud-provision-e2e-design.md` (commit `c72bff1`) Two halves, both production-shaped: **(a) Front door on the private path.** When `GatewayFacts.Public` is nil, the guest still renders Caddy: bound to guest 443; wildcard `*.<apex>` cert from a new guest-CA-signed clan-var (the `kanidm-tls` generator pattern, `vmguest.go`); the acme DNS-01 block replaced by local cert files; a fourth qemu hostfwd `127.0.0.1:<web>→443` (`internal/vm/manager.go` + unit regexes + `evidence.ts` reader); guest `/etc/hosts` maps the apex labels to loopback and the guest trusts its own CA (`security.pki.certificateFiles`) so the in-guest health check passes TLS. **(b) Route on deploy.** `attachCatalogueService` (`internal/provision/deploy.go`) also drives `AttachFrontDoor` with the deployed service's `LiveService` route — today no production path ever adds a route. Nextcloud's nginx binds a loopback port (dissolving the Caddy:80/443 vs nginx:80 collision, cf. `meetings.go`'s mesh-port precedent); the front door proxies to it. **The files route ships WITHOUT `forward_auth`** (ADR 0150): Nextcloud's own OIDC login is the wall; gating it rides the auth-gate follow-up. ## Accept - A private-path gateway's composed `configuration.nix` imports `front-door.nix`; Caddy serves `https://files.<apex>` → Nextcloud and `https://id.<apex>` → kanidm on the guest. - A files deploy adds the route idempotently; re-deploy no-ops. - The in-guest health probe of `https://files.<apex>/status.php` passes TLS + resolution. - Seam tests + `nix-instantiate --parse` smoke over the composed config.
Author
Owner

Landed in 6224ea2 on origin/main (drive-arc T2).

(a) Front door on the private path. assembleGatewayLiveSet now places a FrontDoorLiveSet{Private} whenever Public is nil but a CommunityApex is carried (ADR 0149), so the composed configuration.nix imports front-door.nix beside gateway-guest.nix (acceptance #1). The private render (frontdoor.go renderPrivateFrontDoor): Caddy on guest 443; a locally guest-CA-signed *.<apex> cert from a new front-door-tls clan-var (the kanidm-tls generator pattern); local tls <cert> <key> in place of the acme DNS-01 block; apex labels mapped to loopback in networking.hosts; the guest trusts its own CA via security.pki.certificateFiles (so the in-guest files.<apex>/status.php probe resolves + validates TLS, acceptance #3); id.<apex> proxied to the guest baseline's loopback kanidm. It declares NO services.kanidm of its own (the baseline owns the one instance) and NO acme-dns. A fourth qemu hostfwd 127.0.0.1:<web>->443 (vm/manager.go WebPort/webFwdRE, + evidence.ts guestWebPort).

(b) Route on deploy. attachCatalogueService now drives AttachFrontDoor on the private path (the production path that finally ADDS a route, acceptance #2 idempotent) with the deployed files service on Nextcloud's new nginx LOOPBACK bind (NextcloudLoopbackPort 8081, dissolving the Caddy:443 vs nginx:80 collision, cf. meetings.go). Files route ships UNGATED (ADR 0150). AttachFrontDoor joins the Clan interface; WithPrivateFrontDoor() gates the deploy path, wired on the .ourcloud.internal apex.

Verification: seam tests (render / attach / assembly / deploy) + nix-instantiate --parse clean over the composed private front door; the full go-ci gate is green on push (acceptance #4). The full nixosSystem eval + the live TLS/health-probe pass ride the T6 drive.

Notes for T6: kanidm origin stays localhost:<KanidmPort> (the S12 founding ceremony keeps its independent green) — flipping it behind id.<apex> is T4/T6 OIDC work. security.pki.certificateFiles needs the CA at BUILD time; the front-door-tls ca is a SECRET var (the kanidm-tls preflight-eval reasoning) — if the drive's preflight eval or build trips on the CA-trust timing, that is the first expected red.

T4 (files OIDC; operator=admin) is now unblocked — it proves through this wire.

Landed in `6224ea2` on origin/main (drive-arc T2). **(a) Front door on the private path.** `assembleGatewayLiveSet` now places a `FrontDoorLiveSet{Private}` whenever `Public` is nil but a `CommunityApex` is carried (ADR 0149), so the composed `configuration.nix` imports `front-door.nix` beside `gateway-guest.nix` (acceptance #1). The private render (`frontdoor.go` `renderPrivateFrontDoor`): Caddy on guest 443; a locally guest-CA-signed `*.<apex>` cert from a new `front-door-tls` clan-var (the kanidm-tls generator pattern); local `tls <cert> <key>` in place of the acme DNS-01 block; apex labels mapped to loopback in `networking.hosts`; the guest trusts its own CA via `security.pki.certificateFiles` (so the in-guest `files.<apex>/status.php` probe resolves + validates TLS, acceptance #3); `id.<apex>` proxied to the guest baseline's loopback kanidm. It declares NO `services.kanidm` of its own (the baseline owns the one instance) and NO acme-dns. A fourth qemu hostfwd `127.0.0.1:<web>->443` (`vm/manager.go` `WebPort`/`webFwdRE`, + `evidence.ts` `guestWebPort`). **(b) Route on deploy.** `attachCatalogueService` now drives `AttachFrontDoor` on the private path (the production path that finally ADDS a route, acceptance #2 idempotent) with the deployed files service on Nextcloud's new nginx LOOPBACK bind (`NextcloudLoopbackPort` 8081, dissolving the Caddy:443 vs nginx:80 collision, cf. meetings.go). Files route ships UNGATED (ADR 0150). `AttachFrontDoor` joins the `Clan` interface; `WithPrivateFrontDoor()` gates the deploy path, wired on the `.ourcloud.internal` apex. **Verification:** seam tests (render / attach / assembly / deploy) + `nix-instantiate --parse` clean over the composed private front door; the full go-ci gate is green on push (acceptance #4). The full nixosSystem eval + the live TLS/health-probe pass ride the T6 drive. **Notes for T6:** kanidm origin stays `localhost:<KanidmPort>` (the S12 founding ceremony keeps its independent green) — flipping it behind `id.<apex>` is T4/T6 OIDC work. `security.pki.certificateFiles` needs the CA at BUILD time; the `front-door-tls` `ca` is a SECRET var (the kanidm-tls preflight-eval reasoning) — if the drive's preflight eval or build trips on the CA-trust timing, that is the first expected red. **T4 (files OIDC; operator=admin) is now unblocked** — it proves through this wire.
ben closed this issue 2026-08-09 19:57:22 +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#359
No description provided.