a gateway that reaches its own IdP through public DNS cannot sign anyone in when its public record blips — pin id.<apex> to loopback on the box #1597

Closed
opened 2026-09-18 18:55:27 +00:00 by matou-build-agent · 4 comments

The gateway control plane reaches its OWN IdP through public DNS. Split off #1596 (the harness half — keep-on-red now keeps the community name — is fixed there).

Symptom

On a community whose public DNS record blips (or points elsewhere), the front door's sign-in code exchange dials https://id.<apex>/oauth2/token by PUBLIC name and dies remote error: tls: internal error, even though kanidm is on the same box. getent hosts id.<apex> on the box answers the zone wildcard, not itself. Surfaced live on run 14 of #1547 (GOTCHAS #249).

Cause

The gateway asks the internet where its own IdP is, instead of resolving id.<apex> to loopback / the box itself.

Proposed fix

A hosts pin or loopback resolution for id.<apex> (and any other same-box service the control plane dials by apex name) ON the gateway, so a public-DNS blip cannot stop a community signing its own members in. This is the PRODUCT residue GOTCHAS #249 leaves open after #1596 fixed the harness half.

Found while working #1596 (keep-on-red keeps the box but released the name).

The gateway control plane reaches its OWN IdP through public DNS. Split off #1596 (the harness half — keep-on-red now keeps the community name — is fixed there). ## Symptom On a community whose public DNS record blips (or points elsewhere), the front door's sign-in code exchange dials `https://id.<apex>/oauth2/token` by PUBLIC name and dies `remote error: tls: internal error`, even though kanidm is on the same box. `getent hosts id.<apex>` on the box answers the zone wildcard, not itself. Surfaced live on run 14 of #1547 (GOTCHAS #249). ## Cause The gateway asks the internet where its own IdP is, instead of resolving `id.<apex>` to loopback / the box itself. ## Proposed fix A hosts pin or loopback resolution for `id.<apex>` (and any other same-box service the control plane dials by apex name) ON the gateway, so a public-DNS blip cannot stop a community signing its own members in. This is the PRODUCT residue GOTCHAS #249 leaves open after #1596 fixed the harness half. Found while working #1596 (keep-on-red keeps the box but released the name).
Author
Member

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.

Ruling: category reclassified enhancement → bug, and routed ready-for-agent (not ready-for-human).

Why this is a two-way door, not a one-way door: the fix pins id.<apex> (and any other same-box service the control plane dials by apex name) to loopback / the box itself on the gateway. Someone could reflexively route anything touching DNS / TLS / the IdP to a human as a "security change" — but this is a security narrowing/hardening, not a widening: it removes the gateway's dependency on the public internet to reach its own IdP, opens no new public surface, and loosens no auth requirement. So it is not on the ADR 0174 one-way-door list (no personal credentials, no posture widening, no member-facing trust accept, no data destruction, no non-routine spend, no physical hands/eyes). It is revertible (remove the hosts/loopback pin) and provable by an existing probe: the door-legs debug tail on a kept-on-red world already reproduced the failure live (run 14 of #1547, GOTCHAS #249). Category → bug because this is a documented defect (GOTCHAS #249) that stops a core flow — a community cannot sign its own members in when its public record blips.

One open implementation question is a two-way door I'm leaving to the implementing agent rather than a human: exactly which same-box services beyond id.<apex> the control plane dials by public apex name (the brief scopes this as a grep-and-confirm task).


Agent Brief

Category: bug
Summary: Pin id.<apex> (and any other same-box service the control plane dials by apex name) to loopback on the gateway, so a public-DNS blip cannot stop a community signing its own members in.

Current behavior:
The gateway control plane reaches its own IdP through public DNS. The front door's sign-in code exchange dials https://id.<apex>/oauth2/token by public name, so when the community's public DNS record blips or points elsewhere, getent hosts id.<apex> on the box answers the zone wildcard's host instead of itself, and the exchange dies remote error: tls: internal error ({"code":"signin_exchange"}) — even though kanidm is on the same box. Surfaced live on run 14 of #1547's kept-on-red world (GOTCHAS #249). The harness half — keeping the box also keeps its NAME pointed — is already fixed in #1596; this is the remaining product residue: the box asks the internet where its own IdP is.

Desired behavior:
On the gateway, id.<apex> resolves to loopback / the box itself, so the control plane's code exchange (and any other same-box service it dials by apex name) reaches its own IdP without depending on the public DNS record. A public-DNS blip must no longer stop sign-in on a world whose box is up. Communities where the IdP is not on the box (the IDIP bridge path, ADR 0212 — the gateway declares no kanidm generators) must be unaffected: only pin names whose service actually lives on that box.

Key interfaces / where to build:

  • The gateway/guest system config carries a per-community loopback pin for id.<apex> (the apex is community-specific and set at founding — this is templated/rendered per community, not a static image line; the front-door render already knows the apex, e.g. via the IdP-hostname helper used when wiring the OIDC seed).
  • Scope the set: grep the control plane for every same-box service dialed by public apex name (start from the id.<apex> OAuth2 token dial; confirm whether files.<apex> or others are dialed box-to-box by public name and belong in the pin). Pin only same-box services.
  • Do not pin on the IDIP-bridge path where the IdP is not on the box (guard on the same fact the front-door render uses to skip kanidm wiring).

Acceptance criteria:

  • On a co-hosted gateway whose IdP is on the box, id.<apex> resolves to loopback / the box, and the sign-in code exchange succeeds even when the public DNS record is absent or points elsewhere.
  • A test/probe asserts the resolution (or the successful exchange under a blipped/wrong public record) — the door-legs debug tail / a seam or unit test covering the pinned resolution.
  • The IDIP-bridge path (IdP not on the box) is unchanged — no loopback pin for id.<apex> there.
  • Any additional same-box apex-named services found in scope are covered by the same pin; the grep result is recorded in the change.
  • Existing gateway/guest deploy tests stay green.

Out of scope:

  • The harness/teardown half (keep-on-red keeping the NAME) — already fixed in #1596.
  • The browser-side resolution (--host-resolver-rules / rolesWorld.hostResolverRules) — that is drive plumbing, fixable from outside, and not the box's dependency.
  • Any change to how the public DNS record itself is claimed/released or to the broker.

Note: the fix lands in trees the gateway SNAPSHOT bakes (nix/gateway-image/**, nix/guest/**) and/or the deploy render, so once it is on main the executor may swap it to snapshot-pending / deploy-pending until a snapshot/deploy carries it — that is the normal post-implementation rail, not a triage gate.

> *This was generated by AI during triage.* **Ruled by agent under ADR 0174 — veto anytime.** **Ruling:** category reclassified `enhancement` → `bug`, and routed **`ready-for-agent`** (not `ready-for-human`). **Why this is a two-way door, not a one-way door:** the fix pins `id.<apex>` (and any other same-box service the control plane dials by apex name) to loopback / the box itself on the gateway. Someone could reflexively route anything touching DNS / TLS / the IdP to a human as a "security change" — but this is a security **narrowing/hardening**, not a widening: it *removes* the gateway's dependency on the public internet to reach its own IdP, opens no new public surface, and loosens no auth requirement. So it is not on the ADR 0174 one-way-door list (no personal credentials, no posture widening, no member-facing trust accept, no data destruction, no non-routine spend, no physical hands/eyes). It is **revertible** (remove the hosts/loopback pin) and **provable** by an existing probe: the door-legs debug tail on a kept-on-red world already reproduced the failure live (run 14 of #1547, GOTCHAS #249). Category → `bug` because this is a documented defect (GOTCHAS #249) that stops a core flow — a community cannot sign its own members in when its public record blips. One open implementation question is a two-way door I'm leaving to the implementing agent rather than a human: exactly **which** same-box services beyond `id.<apex>` the control plane dials by public apex name (the brief scopes this as a grep-and-confirm task). --- ## Agent Brief **Category:** bug **Summary:** Pin `id.<apex>` (and any other same-box service the control plane dials by apex name) to loopback on the gateway, so a public-DNS blip cannot stop a community signing its own members in. **Current behavior:** The gateway control plane reaches its **own** IdP through public DNS. The front door's sign-in code exchange dials `https://id.<apex>/oauth2/token` by public name, so when the community's public DNS record blips or points elsewhere, `getent hosts id.<apex>` on the box answers the zone wildcard's host instead of itself, and the exchange dies `remote error: tls: internal error` (`{"code":"signin_exchange"}`) — even though kanidm is on the same box. Surfaced live on run 14 of #1547's kept-on-red world (GOTCHAS #249). The harness half — keeping the box also keeps its NAME pointed — is already fixed in #1596; this is the remaining **product** residue: the box asks the internet where its own IdP is. **Desired behavior:** On the gateway, `id.<apex>` resolves to loopback / the box itself, so the control plane's code exchange (and any other same-box service it dials by apex name) reaches its own IdP without depending on the public DNS record. A public-DNS blip must no longer stop sign-in on a world whose box is up. Communities where the IdP is **not** on the box (the IDIP bridge path, ADR 0212 — the gateway declares no kanidm generators) must be unaffected: only pin names whose service actually lives on that box. **Key interfaces / where to build:** - The gateway/guest system config carries a per-community loopback pin for `id.<apex>` (the apex is community-specific and set at founding — this is templated/rendered per community, not a static image line; the front-door render already knows the apex, e.g. via the IdP-hostname helper used when wiring the OIDC seed). - Scope the set: grep the control plane for every same-box service dialed by **public apex name** (start from the `id.<apex>` OAuth2 token dial; confirm whether `files.<apex>` or others are dialed box-to-box by public name and belong in the pin). Pin only same-box services. - Do **not** pin on the IDIP-bridge path where the IdP is not on the box (guard on the same fact the front-door render uses to skip kanidm wiring). **Acceptance criteria:** - [ ] On a co-hosted gateway whose IdP is on the box, `id.<apex>` resolves to loopback / the box, and the sign-in code exchange succeeds even when the public DNS record is absent or points elsewhere. - [ ] A test/probe asserts the resolution (or the successful exchange under a blipped/wrong public record) — the door-legs debug tail / a seam or unit test covering the pinned resolution. - [ ] The IDIP-bridge path (IdP not on the box) is unchanged — no loopback pin for `id.<apex>` there. - [ ] Any additional same-box apex-named services found in scope are covered by the same pin; the grep result is recorded in the change. - [ ] Existing gateway/guest deploy tests stay green. **Out of scope:** - The harness/teardown half (keep-on-red keeping the NAME) — already fixed in #1596. - The browser-side resolution (`--host-resolver-rules` / `rolesWorld.hostResolverRules`) — that is drive plumbing, fixable from outside, and not the box's dependency. - Any change to how the public DNS record itself is claimed/released or to the broker. --- Note: the fix lands in trees the gateway SNAPSHOT bakes (`nix/gateway-image/**`, `nix/guest/**`) and/or the deploy render, so once it is on `main` the executor may swap it to `snapshot-pending` / `deploy-pending` until a snapshot/deploy carries it — that is the normal post-implementation rail, not a triage gate.
Author
Member

swarm-claim host=bens-mac-04 run=26715
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=26715 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #1597 — status success

⛔ close-report gates REFUSED this close — the following claims did not verify:

  • commit 487f682af1 is not reachable from origin/main (not landed)
  • changed_files: 'internal/clan/frontdoor.go' is not in the diff of the claimed commits
  • changed_files: 'internal/clan/frontdoor_test.go' is not in the diff of the claimed commits
  • changed_files: 'docs/GOTCHAS.md' is not in the diff of the claimed commits
  • changed_files: 'STATUS.md' is not in the diff of the claimed commits
envelope
{
  "issue": 1597,
  "status": "success",
  "commits": [
    "487f682af103816f2e52aefd2afeac556d2c53ec"
  ],
  "changed_files": [
    "internal/clan/frontdoor.go",
    "internal/clan/frontdoor_test.go",
    "docs/GOTCHAS.md",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci -c go test ./internal/clan/ ./internal/controlapi/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go build ./... && go vet ./internal/clan/ ./internal/controlapi/ && gofmt -l",
      "exit_code": 0
    }
  ],
  "criteria": {
    "On a co-hosted gateway whose IdP is on the box, id.<apex> resolves to loopback and the sign-in exchange succeeds under a blipped/wrong public record": "renderOwnIDPLoopbackPin (internal/clan/frontdoor.go) emits networking.hosts.\"127.0.0.1\" = [ id.<apex> ] on the kanidm path, so the box's own https://id.<apex>/oauth2/token dial reaches loopback Caddy -> loopback kanidm regardless of public DNS; TestRenderFrontDoor_PinsOwnIdPToLoopback",
    "A test/probe asserts the pinned resolution": "TestRenderFrontDoor_PinsOwnIdPToLoopback (internal/clan/frontdoor_test.go) asserts the exact networking.hosts pin in the public render",
    "The IDIP-bridge path (IdP not on the box) is unchanged — no loopback pin there": "renderOwnIDPLoopbackPin is called only inside the !cfg.IdentityIDIP block; TestRenderFrontDoor_IDIPPathDoesNotPinIdPToLoopback asserts no networking.hosts pin when IdentityIDIP is set",
    "Any additional same-box apex-named services found in scope are covered; the grep result is recorded": "Grep of internal/controlapi + internal/clan (recorded in commit body and issue comment) confirms id.<apex> is the only same-box service the control plane dials by apex name — the catalogue ports run on their own mesh nodes and are dialed by mesh target, never by apex name on the gateway, so only id.<apex> is pinned",
    "Existing gateway/guest deploy tests stay green": "nix develop .#go-ci -c go test ./internal/clan/ ./internal/controlapi/ green; go build/vet/gofmt clean; pre-push revive gate 0 issues"
  },
  "summary": "The public front door pins id.<apex> to loopback on the gateway (kanidm path only) so a public-DNS blip can no longer stop a community signing its own members in.",
  "blockers": []
}
**close-report** for #1597 — status `success` :no_entry: **close-report gates REFUSED this close** — the following claims did not verify: - commit 487f682af103816f2e52aefd2afeac556d2c53ec is not reachable from origin/main (not landed) - changed_files: 'internal/clan/frontdoor.go' is not in the diff of the claimed commits - changed_files: 'internal/clan/frontdoor_test.go' is not in the diff of the claimed commits - changed_files: 'docs/GOTCHAS.md' is not in the diff of the claimed commits - changed_files: 'STATUS.md' is not in the diff of the claimed commits <details><summary>envelope</summary> ```json { "issue": 1597, "status": "success", "commits": [ "487f682af103816f2e52aefd2afeac556d2c53ec" ], "changed_files": [ "internal/clan/frontdoor.go", "internal/clan/frontdoor_test.go", "docs/GOTCHAS.md", "STATUS.md" ], "tests": [ { "command": "nix develop .#go-ci -c go test ./internal/clan/ ./internal/controlapi/", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go build ./... && go vet ./internal/clan/ ./internal/controlapi/ && gofmt -l", "exit_code": 0 } ], "criteria": { "On a co-hosted gateway whose IdP is on the box, id.<apex> resolves to loopback and the sign-in exchange succeeds under a blipped/wrong public record": "renderOwnIDPLoopbackPin (internal/clan/frontdoor.go) emits networking.hosts.\"127.0.0.1\" = [ id.<apex> ] on the kanidm path, so the box's own https://id.<apex>/oauth2/token dial reaches loopback Caddy -> loopback kanidm regardless of public DNS; TestRenderFrontDoor_PinsOwnIdPToLoopback", "A test/probe asserts the pinned resolution": "TestRenderFrontDoor_PinsOwnIdPToLoopback (internal/clan/frontdoor_test.go) asserts the exact networking.hosts pin in the public render", "The IDIP-bridge path (IdP not on the box) is unchanged — no loopback pin there": "renderOwnIDPLoopbackPin is called only inside the !cfg.IdentityIDIP block; TestRenderFrontDoor_IDIPPathDoesNotPinIdPToLoopback asserts no networking.hosts pin when IdentityIDIP is set", "Any additional same-box apex-named services found in scope are covered; the grep result is recorded": "Grep of internal/controlapi + internal/clan (recorded in commit body and issue comment) confirms id.<apex> is the only same-box service the control plane dials by apex name — the catalogue ports run on their own mesh nodes and are dialed by mesh target, never by apex name on the gateway, so only id.<apex> is pinned", "Existing gateway/guest deploy tests stay green": "nix develop .#go-ci -c go test ./internal/clan/ ./internal/controlapi/ green; go build/vet/gofmt clean; pre-push revive gate 0 issues" }, "summary": "The public front door pins id.<apex> to loopback on the gateway (kanidm path only) so a public-DNS blip can no longer stop a community signing its own members in.", "blockers": [] } ``` </details>
Author
Member

close-report for #1597 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1597,
  "status": "success",
  "commits": [
    "487f682af103816f2e52aefd2afeac556d2c53ec"
  ],
  "changed_files": [
    "internal/clan/frontdoor.go",
    "internal/clan/frontdoor_test.go",
    "docs/GOTCHAS.md",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci -c go test ./internal/clan/ ./internal/controlapi/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go build ./... && go vet ./internal/clan/ ./internal/controlapi/ && gofmt -l",
      "exit_code": 0
    }
  ],
  "criteria": {
    "On a co-hosted gateway whose IdP is on the box, id.<apex> resolves to loopback and the sign-in exchange succeeds under a blipped/wrong public record": "renderOwnIDPLoopbackPin (internal/clan/frontdoor.go) emits networking.hosts.\"127.0.0.1\" = [ id.<apex> ] on the kanidm path, so the box's own https://id.<apex>/oauth2/token dial reaches loopback Caddy -> loopback kanidm regardless of public DNS; TestRenderFrontDoor_PinsOwnIdPToLoopback",
    "A test/probe asserts the pinned resolution": "TestRenderFrontDoor_PinsOwnIdPToLoopback (internal/clan/frontdoor_test.go) asserts the exact networking.hosts pin in the public render",
    "The IDIP-bridge path (IdP not on the box) is unchanged — no loopback pin there": "renderOwnIDPLoopbackPin is called only inside the !cfg.IdentityIDIP block; TestRenderFrontDoor_IDIPPathDoesNotPinIdPToLoopback asserts no networking.hosts pin when IdentityIDIP is set",
    "Any additional same-box apex-named services found in scope are covered; the grep result is recorded": "Grep of internal/controlapi + internal/clan (recorded in commit body and issue comment) confirms id.<apex> is the only same-box service the control plane dials by apex name — the catalogue ports run on their own mesh nodes and are dialed by mesh target, never by apex name on the gateway, so only id.<apex> is pinned",
    "Existing gateway/guest deploy tests stay green": "nix develop .#go-ci -c go test ./internal/clan/ ./internal/controlapi/ green; go build/vet/gofmt clean; pre-push revive gate 0 issues"
  },
  "summary": "The public front door pins id.<apex> to loopback on the gateway (kanidm path only) so a public-DNS blip can no longer stop a community signing its own members in.",
  "blockers": []
}
**close-report** for #1597 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1597, "status": "success", "commits": [ "487f682af103816f2e52aefd2afeac556d2c53ec" ], "changed_files": [ "internal/clan/frontdoor.go", "internal/clan/frontdoor_test.go", "docs/GOTCHAS.md", "STATUS.md" ], "tests": [ { "command": "nix develop .#go-ci -c go test ./internal/clan/ ./internal/controlapi/", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go build ./... && go vet ./internal/clan/ ./internal/controlapi/ && gofmt -l", "exit_code": 0 } ], "criteria": { "On a co-hosted gateway whose IdP is on the box, id.<apex> resolves to loopback and the sign-in exchange succeeds under a blipped/wrong public record": "renderOwnIDPLoopbackPin (internal/clan/frontdoor.go) emits networking.hosts.\"127.0.0.1\" = [ id.<apex> ] on the kanidm path, so the box's own https://id.<apex>/oauth2/token dial reaches loopback Caddy -> loopback kanidm regardless of public DNS; TestRenderFrontDoor_PinsOwnIdPToLoopback", "A test/probe asserts the pinned resolution": "TestRenderFrontDoor_PinsOwnIdPToLoopback (internal/clan/frontdoor_test.go) asserts the exact networking.hosts pin in the public render", "The IDIP-bridge path (IdP not on the box) is unchanged — no loopback pin there": "renderOwnIDPLoopbackPin is called only inside the !cfg.IdentityIDIP block; TestRenderFrontDoor_IDIPPathDoesNotPinIdPToLoopback asserts no networking.hosts pin when IdentityIDIP is set", "Any additional same-box apex-named services found in scope are covered; the grep result is recorded": "Grep of internal/controlapi + internal/clan (recorded in commit body and issue comment) confirms id.<apex> is the only same-box service the control plane dials by apex name — the catalogue ports run on their own mesh nodes and are dialed by mesh target, never by apex name on the gateway, so only id.<apex> is pinned", "Existing gateway/guest deploy tests stay green": "nix develop .#go-ci -c go test ./internal/clan/ ./internal/controlapi/ green; go build/vet/gofmt clean; pre-push revive gate 0 issues" }, "summary": "The public front door pins id.<apex> to loopback on the gateway (kanidm path only) so a public-DNS blip can no longer stop a community signing its own members in.", "blockers": [] } ``` </details>
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#1597
No description provided.