rented gateway config double-declares services.kanidm (VMMode baseline + public front-door collide) #693

Closed
opened 2026-08-23 07:27:59 +00:00 by matou-build-agent · 1 comment

Failure

Drive 20260823T071501Z, leg enroll-configure (sig cdebd4257a3d): the rented gateway's node config fails to eval —

… while evaluating the attribute 'value'
error: The option `services.kanidm.server.settings.bindaddress' has conflicting definition values:

Evidence

The run's captured state/clan-config/machines/gateway/ carries both:

  • gateway-guest.nix:137 — bindaddress = "0.0.0.0:8443"; (inline VM-mode kanidm)
  • front-door.nix:16 — bindaddress = "127.0.0.1:8443"; # loopback ONLY (public front-door kanidm)

Both attrpaths (server.settings.bindaddress and the older enableServer/serverSettings names) alias onto the same final option, so nixpkgs sees two conflicting definitions on the one machine.

Root cause

internal/founding/rentedpath.go:297 sets Install: clan.VMMode for the rented carrier's configure leg (a single clan update, no takeover — deliberate, per the standuprented.go:19-23 comment), but rentedpath.go:320 pairs it with Gateway: publicGatewayFacts(d, ip, claim, smtp) — the exact same "public gateway" facts constructor ownvpspath.go:619 and selfhostedpath.go:231 use, but those always pair it with Install: clan.FullInstall.

The two Install modes drive genuinely different (and, per docs/GOTCHAS.md #12 / issue #443's "Ben's 2026-08-11 ruling", deliberately mutually exclusive) machine-config shapes:

  • VMMode → internal/clan/enrollment.go:418-438 (writeNodeConfig's s.NodeConfig == nil branch) bakes gateway-guest.nix via renderGatewayGuest (vmguest.go:114-146), which unconditionally splices in kanidmServer(g) (vmguest.go:259-269) — an inline services.kanidm bound 0.0.0.0:8443, designed for the private/QEMU-demo gateway that has no separate front door.
  • Public gateway facts (Gateway.Public != nil) → assembleGatewayLiveSet (internal/clan/gateway_attach.go) takes the public FrontDoorLiveSet branch (no Private field), so AttachGateway also writes front-door.nix via RenderFrontDoor → renderKanidmLoopback (frontdoor.go:261-278), which declares its own services.kanidm bound 127.0.0.1:8443 behind Caddy.

The #443 closure (docs/GOTCHAS.md §12 update) established exactly two shapes — VM-mode-with-inline-kanidm (no front door) vs. own-VPS-full-install-with-front-door (no inline kanidm, via control-plane.nix/renderControlPlaneSurface) — and documented them as never combined. The rented carrier (added later, commit 516c5054, ADR 0189/DDR 0190-191) needed "no takeover" (VMMode's install semantics) but is also a genuinely public gateway (front-door's shape), and nothing reconciled that: it inherited VMMode's baseline and the public front-door facts, recombining two ingredients the #443 ruling kept apart. This was latent and unexercised until #692 (this repo, af942243) fixed the earlier SSH-identity fault blocking supply/configure on the same journey, letting the drive reach eval for the first time.

Suspected layer / what plugging it needs

A design decision, not a mechanical patch — options include:

  • Decouple "no-takeover install" from "which kanidm/baseline shape a gateway renders": e.g. a third Install value, or a flag writeNodeConfig/renderGatewayGuest can read to skip the inline kanidmServer (+ its brand/credential-floor/idp-bridge blocks) and instead take the full-install-style control-plane.nix kanidm-provision surface, when Gateway.Public != nil even under VMMode.
  • Or: make the rented path's front-door render the Private variant (own inline kanidm, no separate declaration) instead of the Public variant — but the rented gateway is genuinely public (real DO droplet + apex), so this looks like the wrong direction.

Whichever direction, it touches internal/founding/rentedpath.go, internal/clan/enrollment.go, and internal/clan/vmguest.go/frontdoor.go together, plus the doc invariants in docs/GOTCHAS.md #12 and the renderGatewayGuest/kanidmServer/renderControlPlaneSurface comments that currently assert these two shapes never combine — those comments need updating in the same commit as the fix (ADR 0042 same-commit law). Needs a maintainer call on which shape the rented gateway should actually carry before a worker touches this.

drive 20260823T071501Z red at pair: journey leg "enroll-configure" went red: founding: the rented server stand-up did not complete (status "blocked"): the node's config does not evaluate — fix it so the node evaluates, then re-drive:
evidence: test-results/…/20260823T071501Z/ on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)

## Failure Drive `20260823T071501Z`, leg `enroll-configure` (sig `cdebd4257a3d`): the rented gateway's node config fails to eval — ``` … while evaluating the attribute 'value' error: The option `services.kanidm.server.settings.bindaddress' has conflicting definition values: ``` ## Evidence The run's captured `state/clan-config/machines/gateway/` carries **both**: - `gateway-guest.nix:137` — `bindaddress = "0.0.0.0:8443";` (inline VM-mode kanidm) - `front-door.nix:16` — `bindaddress = "127.0.0.1:8443"; # loopback ONLY` (public front-door kanidm) Both attrpaths (`server.settings.bindaddress` and the older `enableServer`/`serverSettings` names) alias onto the same final option, so nixpkgs sees two conflicting definitions on the one machine. ## Root cause `internal/founding/rentedpath.go:297` sets `Install: clan.VMMode` for the rented carrier's `configure` leg (a single `clan update`, no takeover — deliberate, per the `standuprented.go:19-23` comment), but `rentedpath.go:320` pairs it with `Gateway: publicGatewayFacts(d, ip, claim, smtp)` — the exact same "public gateway" facts constructor `ownvpspath.go:619` and `selfhostedpath.go:231` use, but *those* always pair it with `Install: clan.FullInstall`. The two Install modes drive genuinely different (and, per `docs/GOTCHAS.md` #12 / issue #443's "Ben's 2026-08-11 ruling", deliberately mutually exclusive) machine-config shapes: - **VMMode** → `internal/clan/enrollment.go:418-438` (`writeNodeConfig`'s `s.NodeConfig == nil` branch) bakes `gateway-guest.nix` via `renderGatewayGuest` (`vmguest.go:114-146`), which unconditionally splices in `kanidmServer(g)` (`vmguest.go:259-269`) — an inline `services.kanidm` bound `0.0.0.0:8443`, designed for the private/QEMU-demo gateway that has no separate front door. - **Public gateway facts** (`Gateway.Public != nil`) → `assembleGatewayLiveSet` (`internal/clan/gateway_attach.go`) takes the *public* `FrontDoorLiveSet` branch (no `Private` field), so `AttachGateway` also writes `front-door.nix` via `RenderFrontDoor` → `renderKanidmLoopback` (`frontdoor.go:261-278`), which declares its own `services.kanidm` bound `127.0.0.1:8443` behind Caddy. The #443 closure (`docs/GOTCHAS.md` §12 update) established exactly two shapes — VM-mode-with-inline-kanidm (no front door) vs. own-VPS-full-install-with-front-door (no inline kanidm, via `control-plane.nix`/`renderControlPlaneSurface`) — and documented them as never combined. The rented carrier (added later, commit `516c5054`, ADR 0189/DDR 0190-191) needed "no takeover" (VMMode's install semantics) but is also a genuinely public gateway (front-door's shape), and nothing reconciled that: it inherited VMMode's baseline *and* the public front-door facts, recombining two ingredients the #443 ruling kept apart. This was latent and unexercised until `#692` (this repo, `af942243`) fixed the earlier SSH-identity fault blocking `supply`/`configure` on the same journey, letting the drive reach eval for the first time. ## Suspected layer / what plugging it needs A design decision, not a mechanical patch — options include: - Decouple "no-takeover install" from "which kanidm/baseline shape a gateway renders": e.g. a third `Install` value, or a flag `writeNodeConfig`/`renderGatewayGuest` can read to skip the inline `kanidmServer` (+ its brand/credential-floor/idp-bridge blocks) and instead take the full-install-style `control-plane.nix` kanidm-provision surface, when `Gateway.Public != nil` even under VMMode. - Or: make the rented path's front-door render the *Private* variant (own inline kanidm, no separate declaration) instead of the *Public* variant — but the rented gateway is genuinely public (real DO droplet + apex), so this looks like the wrong direction. Whichever direction, it touches `internal/founding/rentedpath.go`, `internal/clan/enrollment.go`, and `internal/clan/vmguest.go`/`frontdoor.go` together, plus the doc invariants in `docs/GOTCHAS.md` #12 and the `renderGatewayGuest`/`kanidmServer`/`renderControlPlaneSurface` comments that currently assert these two shapes never combine — those comments need updating in the same commit as the fix (ADR 0042 same-commit law). Needs a maintainer call on which shape the rented gateway should actually carry before a worker touches this. drive `20260823T071501Z` red at `pair`: `journey leg "enroll-configure" went red: founding: the rented server stand-up did not complete (status "blocked"): the node's config does not evaluate — fix it so the node evaluates, then re-drive: ` evidence: `test-results/…/20260823T071501Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596) <!-- rehearsal-sig: cdebd4257a3d -->
Author
Member

Ruled by agent under ADR 0174 — veto anytime.

Root cause confirmed exactly as the ticket's own analysis: GOTCHAS #12's #443 closure named only two gateway shapes (VM-mode-inline-kanidm/no-front-door vs full-install-front-door/no-inline-kanidm) and asserted they never combine. The rented carrier recombined them — Install: clan.VMMode (no takeover) paired with Gateway: publicGatewayFacts(...) (the same public-facts builder own-VPS/self-hosted pair with FullInstall) — so writeNodeConfig baked gateway-guest.nix's inline kanidm (0.0.0.0:8443) and assembleGatewayLiveSet composed front-door.nix's public kanidm (127.0.0.1:8443) onto the one machine.

Ruling: adopted the ticket's own favoured direction (option 1) — decouple "no-takeover install" from "which kanidm shape a gateway renders". renderGatewayGuest (internal/clan/vmguest.go) now branches on GatewayFacts.Public, not Install alone: a public gateway (VMMode or full-install) never bakes the private inline kanidmServer/idpLoopbackBridge/brand-CSS-duplicate/credential-floor-duplicate/VM-shaped-assertions blocks — it takes the SAME gatewayKanidmProvision + gatewayBrandPush + gatewayGateConsentBlock + gatewayControlPlaneAssertions blocks renderControlPlaneSurface already proved out for own-VPS/self-hosted (#443/#452/#453/#454). The VM host baseline (sshd/boot/disk) is untouched — this fix touches only the kanidm/idp surface the eval error actually named.

Recorded as DDR 0193 (docs/adr/0193-design-public-vmmode-gateway-shares-the-full-install-kanidm-shape.md); GOTCHAS #12 gained an Update; the affected doc comments (kanidmServer, renderGatewayGuest) were corrected in the same commit (ADR 0042).

Why a two-way door: revertible by commit; provable by a new fast unit test, TestRenderGatewayGuest_PublicGatewaySkipsInlineKanidmServer (internal/clan/vmguest_test.go) — proven RED before the fix (asserted the conflicting services.kanidm = {...} block was absent and failed), GREEN after — plus nix-instantiate --parse on the composed output. Not a security-posture widening: the change removes a conflicting declaration and the surviving one is the exact block set production already runs successfully for every other public gateway.

Proof:

  • go build ./... && go vet ./... && go test ./... — all green (full repo, internal/clan 13.5s).
  • TestRenderGatewayGuest_PublicGatewaySkipsInlineKanidmServer — red before / green after (TDD).
  • New eval-smoke sibling TestRentedGateway_EvalSmoke (internal/clan/seedcommunity_eval_test.go, gated IDSS_EVAL_SMOKE=1) reproduces installRented's exact composition end to end against a real nix eval — could not run to a verdict in this session-runner checkout: it hits a pre-existing "No SOPS key found" gap (no sops-age key pre-registered on this host). This is NOT specific to my change — the already-merged TestOwnVPSGateway_EvalSmoke fails identically here, confirmed by running it directly. Filed as a follow-up (see below) rather than worked here (out of #693's scope).
  • Commit 5a53b04c on main (pushed).

Left open, filed as a follow-up (out of this ticket's scope): gatewayFleetPorts() opens 8080/8443 in the firewall for every renderGatewayGuest caller, including the now-public VMMode branch — harmless on the private QEMU path (NAT'd hostfwd) but a real internet-facing rented droplet publicly exposing the control-plane API port (8080) is a security-posture question this ticket's evidence never raised, so it stays on the ADR 0174 one-way-door list rather than getting bundled into this ruling. Also filed a lighter follow-up for the eval-smoke sops-key gap discovered while proving this fix.

Close-report: the eval-conflict is fixed, proven by unit test + full suite, and documented (DDR 0193 + GOTCHAS #12). advances #693.

**Ruled by agent under ADR 0174 — veto anytime.** Root cause confirmed exactly as the ticket's own analysis: GOTCHAS #12's #443 closure named only two gateway shapes (VM-mode-inline-kanidm/no-front-door vs full-install-front-door/no-inline-kanidm) and asserted they never combine. The rented carrier recombined them — `Install: clan.VMMode` (no takeover) paired with `Gateway: publicGatewayFacts(...)` (the same public-facts builder own-VPS/self-hosted pair with `FullInstall`) — so `writeNodeConfig` baked `gateway-guest.nix`'s inline kanidm (`0.0.0.0:8443`) *and* `assembleGatewayLiveSet` composed `front-door.nix`'s public kanidm (`127.0.0.1:8443`) onto the one machine. **Ruling:** adopted the ticket's own favoured direction (option 1) — decouple "no-takeover install" from "which kanidm shape a gateway renders". `renderGatewayGuest` (`internal/clan/vmguest.go`) now branches on `GatewayFacts.Public`, not `Install` alone: a public gateway (VMMode *or* full-install) never bakes the private inline `kanidmServer`/`idpLoopbackBridge`/brand-CSS-duplicate/credential-floor-duplicate/VM-shaped-assertions blocks — it takes the SAME `gatewayKanidmProvision` + `gatewayBrandPush` + `gatewayGateConsentBlock` + `gatewayControlPlaneAssertions` blocks `renderControlPlaneSurface` already proved out for own-VPS/self-hosted (#443/#452/#453/#454). The VM host baseline (sshd/boot/disk) is untouched — this fix touches only the kanidm/idp surface the eval error actually named. Recorded as DDR 0193 (`docs/adr/0193-design-public-vmmode-gateway-shares-the-full-install-kanidm-shape.md`); GOTCHAS #12 gained an Update; the affected doc comments (`kanidmServer`, `renderGatewayGuest`) were corrected in the same commit (ADR 0042). **Why a two-way door:** revertible by commit; provable by a new fast unit test, `TestRenderGatewayGuest_PublicGatewaySkipsInlineKanidmServer` (`internal/clan/vmguest_test.go`) — proven RED before the fix (asserted the conflicting `services.kanidm = {...}` block was absent and failed), GREEN after — plus `nix-instantiate --parse` on the composed output. Not a security-posture widening: the change *removes* a conflicting declaration and the surviving one is the exact block set production already runs successfully for every other public gateway. **Proof:** - `go build ./... && go vet ./... && go test ./...` — all green (full repo, `internal/clan` 13.5s). - `TestRenderGatewayGuest_PublicGatewaySkipsInlineKanidmServer` — red before / green after (TDD). - New eval-smoke sibling `TestRentedGateway_EvalSmoke` (`internal/clan/seedcommunity_eval_test.go`, gated `IDSS_EVAL_SMOKE=1`) reproduces `installRented`'s exact composition end to end against a real `nix eval` — **could not run to a verdict in this session-runner checkout**: it hits a pre-existing "No SOPS key found" gap (no sops-age key pre-registered on this host). This is NOT specific to my change — the already-merged `TestOwnVPSGateway_EvalSmoke` fails identically here, confirmed by running it directly. Filed as a follow-up (see below) rather than worked here (out of #693's scope). - Commit `5a53b04c` on `main` (pushed). **Left open, filed as a follow-up (out of this ticket's scope):** `gatewayFleetPorts()` opens 8080/8443 in the firewall for every `renderGatewayGuest` caller, including the now-public VMMode branch — harmless on the private QEMU path (NAT'd hostfwd) but a real internet-facing rented droplet publicly exposing the control-plane API port (8080) is a security-posture question this ticket's evidence never raised, so it stays on the ADR 0174 one-way-door list rather than getting bundled into this ruling. Also filed a lighter follow-up for the eval-smoke sops-key gap discovered while proving this fix. **Close-report:** the eval-conflict is fixed, proven by unit test + full suite, and documented (DDR 0193 + GOTCHAS #12). advances #693.
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#693
No description provided.