P5 monitoring: the Paperless consume-and-find and Listmonk render-and-send checks call the PUBLIC door on browser-gated API paths (302 → /authz/signin) — Document archive + Newsletters read DOWN forever on a gateway co-host while both serve (Whakat… #1503

Closed
opened 2026-09-16 00:33:00 +00:00 by ben · 3 comments
Owner

Symptom

On the Whakatōhea Demo community (founded 2026-09-16 on a rented 8 GB gateway by the phase-9 journey's demo profile, run 20260915T235523Z, seven services placed on the gateway at the founding page), P5 monitoring marks Document archive and Newsletters DOWN (severity critical) from the first aggregation pass and never recovers, while both upstreams run and answer:

  • paperless-web listening on 0.0.0.0:28981, GET / → 302 (its own login); listmonk on [::]:9010, ⇨ http server started.
  • GET /api/v1/monitor/status on the gateway (14 min after founding): {"all_healthy":false, services: newsletters up:false critical, document-archive up:false critical, devices[0].status "document archive down"}; alert-count 4.
  • The control-plane journal carries no failure line for either check — the cause is only in the alert body the dashboard shows.

Cause

Both functional checks call the service's PUBLIC door with the admin credential, and the front door browser-gates exactly the paths they call:

# run as root on the gateway, through the public door
POST https://document-archive.<apex>/api/token/  (admin + /run/secrets/vars/document-archive-secrets/adminpass) → 302 /authz/signin
GET  https://newsletters.<apex>/api/lists        (idss-api + LISTMONK_API_TOKEN)                                   → 302 /authz/signin
GET  https://newsletters.<apex>/api/health                                                                          → 302 /authz/signin

The rendered machines/gateway/front-door.nix on the box:

  • document-archive block: forward_auth … @unauth → redir …/authz/signin 302 with no exempt matcher at all — internal/clan/portroute.go registers PaperlessSlug: {ServePort: paperlessServePort} with no ExemptPaths ("wholly browser-gated", by design).
  • newsletters block: @newsletters_exempt path /subscription/* /link/* /api/public/* /uploads/* (NewslettersExemptPaths, internal/clan/newsletters.go:122) — the admin API (/api/lists, /api/campaigns, /api/health) is gated.

The checks (control-plane/cmd/control-plane/paperlesshealth.go paperlessToken → POST {root}/api/token/; newslettershealth.go newslettersServing → the admin API) therefore fail on every pass with an HTTP 302 they read as "could not sign in" / "the API is not answering". Files greens because its check rides /status.php + /ocs/…, which ARE exempt (@files_exempt); Community archive and Data collections green because their whole /api/* is exempt.

This is not founding-specific: the same portServe map renders the P4 control-panel co-host route, so any gateway-hosted Paperless/Listmonk should show the same permanent DOWN in P5. Brand-reach drive 8 (#1277) proved these two services' deploy-time health (the P4 gate over loopback/mesh) and their doors — not the P5 public-door check — which is why it never showed.

What to decide (two-way door; the agent can rule under ADR 0174)

Either (a) probe these two over the gateway-local address the deploy-time health gate already uses (loopback 127.0.0.1:28981 / :9010, or the mesh address for a device host), keeping the browser gate exactly as designed; or (b) exempt the narrow API paths the checks need (/api/token/ + /api/documents/… + /api/tasks/… for Paperless; /api/lists, /api/subscribers, /api/campaigns/*, /api/health for Listmonk) — which also opens those paths to anyone holding the app credential, a posture change ADR 0074 should weigh. (a) matches how Files/archive checks are already honest without widening the gate.

Acceptance

  • On a gateway co-hosting Paperless and Listmonk (the demo box whakatohea-demo.idss.nz at 209.38.89.233 is standing and KEPT — do not release it; read-only inspection via the phase-9 run's rent-operator key on matou-workstation), GET /api/v1/monitor/status reads both up:true within two CheckIntervals of the fix landing, with no change to the front-door exempt sets unless (b) is ruled.
  • A seam test pins the check's target address for a gateway-hosted port (loopback) vs a device-hosted one (mesh).
  • GOTCHAS entry: "a functional P5 check that rides the public door must call only exempt paths — or not ride the door".

Evidence

Demo box journal + /srv/idss/config/machines/gateway/front-door.nix (commits f57606c, ff99504); monitor status JSON above; control-plane/cmd/control-plane/{paperlesshealth,newslettershealth}.go; internal/clan/portroute.go:170-182. Filed from Ben's phase-9 demo session, 2026-09-16.

## Symptom On the Whakatōhea Demo community (founded 2026-09-16 on a rented 8 GB gateway by the phase-9 journey's demo profile, run `20260915T235523Z`, seven services placed on the gateway at the founding page), P5 monitoring marks **Document archive** and **Newsletters** DOWN (severity critical) from the first aggregation pass and never recovers, while both upstreams run and answer: - `paperless-web` listening on `0.0.0.0:28981`, `GET /` → 302 (its own login); `listmonk` on `[::]:9010`, `⇨ http server started`. - `GET /api/v1/monitor/status` on the gateway (14 min after founding): `{"all_healthy":false, services: newsletters up:false critical, document-archive up:false critical, devices[0].status "document archive down"}`; alert-count 4. - The control-plane journal carries **no failure line** for either check — the cause is only in the alert body the dashboard shows. ## Cause Both functional checks call the service's PUBLIC door with the admin credential, and the front door **browser-gates exactly the paths they call**: ``` # run as root on the gateway, through the public door POST https://document-archive.<apex>/api/token/ (admin + /run/secrets/vars/document-archive-secrets/adminpass) → 302 /authz/signin GET https://newsletters.<apex>/api/lists (idss-api + LISTMONK_API_TOKEN) → 302 /authz/signin GET https://newsletters.<apex>/api/health → 302 /authz/signin ``` The rendered `machines/gateway/front-door.nix` on the box: - `document-archive` block: `forward_auth … @unauth → redir …/authz/signin 302` with **no exempt matcher at all** — `internal/clan/portroute.go` registers `PaperlessSlug: {ServePort: paperlessServePort}` with no `ExemptPaths` ("wholly browser-gated", by design). - `newsletters` block: `@newsletters_exempt path /subscription/* /link/* /api/public/* /uploads/*` (`NewslettersExemptPaths`, `internal/clan/newsletters.go:122`) — the admin API (`/api/lists`, `/api/campaigns`, `/api/health`) is gated. The checks (`control-plane/cmd/control-plane/paperlesshealth.go` `paperlessToken` → `POST {root}/api/token/`; `newslettershealth.go` `newslettersServing` → the admin API) therefore fail on every pass with an HTTP 302 they read as "could not sign in" / "the API is not answering". Files greens because its check rides `/status.php` + `/ocs/…`, which ARE exempt (`@files_exempt`); Community archive and Data collections green because their whole `/api/*` is exempt. This is not founding-specific: the same `portServe` map renders the P4 control-panel co-host route, so any gateway-hosted Paperless/Listmonk should show the same permanent DOWN in P5. Brand-reach drive 8 (#1277) proved these two services' **deploy-time** health (the P4 gate over loopback/mesh) and their doors — not the P5 public-door check — which is why it never showed. ## What to decide (two-way door; the agent can rule under ADR 0174) Either (a) probe these two over the gateway-local address the deploy-time health gate already uses (loopback `127.0.0.1:28981` / `:9010`, or the mesh address for a device host), keeping the browser gate exactly as designed; or (b) exempt the narrow API paths the checks need (`/api/token/` + `/api/documents/…` + `/api/tasks/…` for Paperless; `/api/lists`, `/api/subscribers`, `/api/campaigns/*`, `/api/health` for Listmonk) — which also opens those paths to anyone holding the app credential, a posture change ADR 0074 should weigh. (a) matches how Files/archive checks are already honest without widening the gate. ## Acceptance - On a gateway co-hosting Paperless and Listmonk (the demo box `whakatohea-demo.idss.nz` at 209.38.89.233 is standing and KEPT — do not release it; read-only inspection via the phase-9 run's rent-operator key on matou-workstation), `GET /api/v1/monitor/status` reads both `up:true` within two CheckIntervals of the fix landing, with no change to the front-door exempt sets unless (b) is ruled. - A seam test pins the check's target address for a gateway-hosted port (loopback) vs a device-hosted one (mesh). - GOTCHAS entry: "a functional P5 check that rides the public door must call only exempt paths — or not ride the door". ## Evidence Demo box journal + `/srv/idss/config/machines/gateway/front-door.nix` (commits `f57606c`, `ff99504`); monitor status JSON above; `control-plane/cmd/control-plane/{paperlesshealth,newslettershealth}.go`; `internal/clan/portroute.go:170-182`. Filed from Ben's phase-9 demo session, 2026-09-16.

swarm-claim host=matou-dev-server-01 run=24872
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=24872 (automated multi-host claim — lowest live claim id works this ticket)

Ruled by agent under ADR 0174 — veto anytime.

Ruling: option (a) — probe the two functional checks (Paperless
consume-and-find, Listmonk render-and-send) over the gateway-local address
the co-hosted container publishes (loopback 127.0.0.1:<ServePort> for a
gateway co-host, the mesh address for a device host), and keep the front-door
browser gate exactly as designed. No change to any ExemptPaths set.

Why (a), not (b): (b) would exempt the admin API paths
(/api/token/, /api/lists, /api/campaigns/*, /api/health, …) at the
front door — a security-posture widening that opens those paths to anyone
holding the app credential (the one-way door ADR 0074/0074-weighing would have
to own). (a) matches how Files (/status.php) and Community archive
(whole /api/* exempt) are already honest without widening the gate: the
functional check calls the service locally, below the browser gate, exactly
where the deploy-time health gate already reaches it.

Why it is a two-way door: revertible by a later commit (the check's target
address is a derivation in the composition root, not a posture change or a
credential/data act), and provable by an existing-style test + probe.

What proves it:

  • a seam test pinning the check's target address for a gateway-hosted port
    (loopback 127.0.0.1:28981 / :9010) vs a device-hosted one (mesh);
  • on the standing demo box, GET /api/v1/monitor/status reads both
    document-archive and newsletters up:true within two CheckIntervals of
    the fix landing, with the front-door exempt sets unchanged.

Scope note: current placements of both ports are gateway co-host (the
portServe loopback route), so production wires the loopback branch; the mesh
branch for a future device-hosted placement rides the same seam
(serviceProbeBase) and is pinned by the seam test.

**Ruled by agent under ADR 0174 — veto anytime.** **Ruling:** option **(a)** — probe the two functional checks (Paperless consume-and-find, Listmonk render-and-send) over the **gateway-local address** the co-hosted container publishes (loopback `127.0.0.1:<ServePort>` for a gateway co-host, the mesh address for a device host), and keep the front-door browser gate **exactly as designed**. No change to any `ExemptPaths` set. **Why (a), not (b):** (b) would exempt the admin API paths (`/api/token/`, `/api/lists`, `/api/campaigns/*`, `/api/health`, …) at the front door — a **security-posture widening** that opens those paths to anyone holding the app credential (the one-way door ADR 0074/0074-weighing would have to own). (a) matches how Files (`/status.php`) and Community archive (whole `/api/*` exempt) are already honest without widening the gate: the functional check calls the service **locally**, below the browser gate, exactly where the deploy-time health gate already reaches it. **Why it is a two-way door:** revertible by a later commit (the check's target address is a derivation in the composition root, not a posture change or a credential/data act), and provable by an existing-style test + probe. **What proves it:** - a seam test pinning the check's target address for a gateway-hosted port (loopback `127.0.0.1:28981` / `:9010`) vs a device-hosted one (mesh); - on the standing demo box, `GET /api/v1/monitor/status` reads both `document-archive` and `newsletters` `up:true` within two CheckIntervals of the fix landing, with the front-door exempt sets unchanged. **Scope note:** current placements of both ports are gateway co-host (the `portServe` loopback route), so production wires the loopback branch; the mesh branch for a future device-hosted placement rides the same seam (`serviceProbeBase`) and is pinned by the seam test.

close-report for #1503 — status success

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

envelope
{
  "issue": 1503,
  "status": "success",
  "commits": [
    "b014fab0"
  ],
  "changed_files": [
    "STATUS.md",
    "control-plane/cmd/control-plane/main.go",
    "control-plane/cmd/control-plane/servingprobe.go",
    "control-plane/cmd/control-plane/servingprobe_test.go",
    "control-plane/cmd/control-plane/six_port_health_wiring_test.go",
    "docs/GOTCHAS.md"
  ],
  "tests": [
    {
      "command": "go test ./control-plane/cmd/control-plane/ -run 'ServiceProbeBase|DerivedLocal|SixPortHealth|Paperless|Newsletters|DocumentArchive'",
      "exit_code": 0
    },
    {
      "command": "go test ./control-plane/cmd/control-plane/",
      "exit_code": 0
    },
    {
      "command": "go vet ./control-plane/cmd/control-plane/",
      "exit_code": 0
    },
    {
      "command": "golangci-lint run ./control-plane/cmd/control-plane/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "On a gateway co-hosting Paperless and Listmonk, GET /api/v1/monitor/status reads both up:true within two CheckIntervals, with no change to the front-door exempt sets unless (b) is ruled": "Ruled (a) under ADR 0174 (issue comment #46933): the checks now probe the gateway-local loopback (127.0.0.1:28981 / :9010) below the browser gate instead of the public door that 302'd every admin API path — derivedPaperlessURL/derivedNewslettersURL in main.go via coHostProbeBase. Front-door exempt sets UNCHANGED (no clan/front-door.nix edit). Pinned offline by TestDerivedLocalURLs_ProbeLoopbackNotPublicDoor; the live both-up:true read rides a read-only inspection of the standing demo box (executor frontier, ADR 0174 rule 7).",
    "A seam test pins the check's target address for a gateway-hosted port (loopback) vs a device-hosted one (mesh)": "TestServiceProbeBase_GatewayLoopbackVsDeviceMesh in servingprobe_test.go pins both branches for Paperless (127.0.0.1:28981 vs mesh) and Newsletters (127.0.0.1:9010 vs mesh) over serviceProbeBase, reading ServePort from clan.PortServeFacts.",
    "GOTCHAS entry: a functional P5 check that rides the public door must call only exempt paths - or not ride the door": "docs/GOTCHAS.md #236 (Symptom/Cause/Rule, severity, sourced to #1503)."
  },
  "summary": "Paperless and Listmonk P5 functional checks now probe the gateway-local loopback below the browser gate, so a gateway co-host no longer reds them forever on the browser-gated public door.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #1503 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1503, "status": "success", "commits": [ "b014fab0" ], "changed_files": [ "STATUS.md", "control-plane/cmd/control-plane/main.go", "control-plane/cmd/control-plane/servingprobe.go", "control-plane/cmd/control-plane/servingprobe_test.go", "control-plane/cmd/control-plane/six_port_health_wiring_test.go", "docs/GOTCHAS.md" ], "tests": [ { "command": "go test ./control-plane/cmd/control-plane/ -run 'ServiceProbeBase|DerivedLocal|SixPortHealth|Paperless|Newsletters|DocumentArchive'", "exit_code": 0 }, { "command": "go test ./control-plane/cmd/control-plane/", "exit_code": 0 }, { "command": "go vet ./control-plane/cmd/control-plane/", "exit_code": 0 }, { "command": "golangci-lint run ./control-plane/cmd/control-plane/", "exit_code": 0 } ], "criteria": { "On a gateway co-hosting Paperless and Listmonk, GET /api/v1/monitor/status reads both up:true within two CheckIntervals, with no change to the front-door exempt sets unless (b) is ruled": "Ruled (a) under ADR 0174 (issue comment #46933): the checks now probe the gateway-local loopback (127.0.0.1:28981 / :9010) below the browser gate instead of the public door that 302'd every admin API path — derivedPaperlessURL/derivedNewslettersURL in main.go via coHostProbeBase. Front-door exempt sets UNCHANGED (no clan/front-door.nix edit). Pinned offline by TestDerivedLocalURLs_ProbeLoopbackNotPublicDoor; the live both-up:true read rides a read-only inspection of the standing demo box (executor frontier, ADR 0174 rule 7).", "A seam test pins the check's target address for a gateway-hosted port (loopback) vs a device-hosted one (mesh)": "TestServiceProbeBase_GatewayLoopbackVsDeviceMesh in servingprobe_test.go pins both branches for Paperless (127.0.0.1:28981 vs mesh) and Newsletters (127.0.0.1:9010 vs mesh) over serviceProbeBase, reading ServePort from clan.PortServeFacts.", "GOTCHAS entry: a functional P5 check that rides the public door must call only exempt paths - or not ride the door": "docs/GOTCHAS.md #236 (Symptom/Cause/Rule, severity, sourced to #1503)." }, "summary": "Paperless and Listmonk P5 functional checks now probe the gateway-local loopback below the browser gate, so a gateway co-host no longer reds them forever on the browser-gated public door.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#1503
No description provided.