newsletters-healthy: Listmonk 6.1.0 refuses the port's bootstrapped admin identity — every admin API call answers 403, so the render-and-send check can never get in #1306

Closed
opened 2026-09-07 22:03:56 +00:00 by matou-build-agent · 1 comment

The failure

Drive 20260907T210012Z (private path, brands target): 16/17 green, red at newsletters-healthy after 360s of warm-up re-probe (artifacts/legs.json, artifacts/verdict.json — firstRedLeg: newsletters-healthy, commit 0fce2fe3). deploy-newsletters itself was green (873s).

The fault text is the check's own summary: "Newsletters is not serving — Listmonk could not render a pānui and hand it to the community's mail service". The underlying error is the same on every single probe:

error="listmonk: the API is not answering — HTTP 403" verdict=failed

logs/guest-control-plane.log:130-165 (36 warm-up attempts, 21:43:34 → 21:49:25) and :166-201 (~35 further re-probes, 21:49:30 → 21:55:23). Not one probe got anything but 403.

Where it fails, exactly

The check dies on its first call, before any fixture work: newslettersServing → newslettersGet(root + "/api/health") → non-200 → wrapped as "listmonk: the API is not answering — %w".

  • control-plane/cmd/control-plane/newslettershealth.go:201-205 — the /api/health GET and the exact error string.
  • control-plane/cmd/control-plane/newslettershealth.go:413-415 — the HTTP %d that carries the 403.
  • control-plane/cmd/control-plane/newslettershealth.go:472 — the auth it presents: Authorization: Basic base64(admin.User + ":" + admin.Secret()).

What is NOT the cause (ruled out from the evidence)

  1. Not a dead service. Listmonk is running and serving: logs/guest-resources.log:31 (listmonk-6.1.0/bin/listmonk, RSS 38M, started 21:35), :35 (a live postgres: listmonk listmonk [local] idle), and logs/guest-system-journal.log:328 (listmonk[14087]: updates.go:73: new update v6.2.0 found at 21:50:59 — it is executing its own background work while answering the check 403). logs/guest-failed-units.log lists zero failed units.
  2. Not an unlanded credential. An unresolved secret makes NewslettersAdmin.Zero() true (newslettershealth.go:106) and the check returns the PendingFault at newslettershealth.go:158-163 — "the Listmonk admin credential has not landed yet". That is the message the PREVIOUS drive (20260907T194850Z) carried and that 0fce2fe3 fixed. We are past that gate now: the resolver read a non-empty value off /run/secrets/vars/newsletters-secrets/env and Listmonk rejected it.
  3. Not the front door. This is the PRIVATE path. renderPrivateRoute (internal/clan/frontdoor.go:783-793) proxies each service host without forward_auth — "ungated this arc (ADR 0150)". state/clan-config-snapshot → machines/gateway/front-door.nix confirms only @idp/@admin/@portal carry a gate, and the gate's session refusal is a 302 redirect anyway (front-door.nix, the @unauth status 401 handle_response), never a bare 403. A missing route would also not produce this: an unmatched host under the wildcard vhost falls through to an empty 200, which would surface as could not decode the reply, not HTTP 403.
  4. Not a warm-up ceiling. Six minutes of a byte-identical deterministic refusal is not a service still starting. Raising the ceiling would only buy a longer red.

The suspected layer

The newsletters port's Listmonk admin-identity bootstrap / API auth mechanism. The port authenticates to Listmonk as a config-file admin over HTTP Basic, in three places that all share the one identity:

  • internal/clan/newsletters.go:242 — "app.admin_username" = "idss-admin" as a Listmonk settings key.
  • internal/clan/newsletters.go:238 — the password rides services.listmonk.secretFile as LISTMONK_ADMIN_PASSWORD, minted by renderPortSecretsEnvFile (internal/clan/portsecrets.go:74-86, key named at portsecrets.go:55).
  • internal/clan/newsletters.go:324,331 (the newsletters-smtp reconciler) and :415,425,432 (the newsletters-brand oneshot) — curl -u "$user:$LISTMONK_ADMIN_PASSWORD".
  • control-plane/cmd/control-plane/newslettershealth.go:472 — the same Basic header from the check.

Two candidate root causes, both upstream-contract questions about the pinned listmonk 6.1.0 (guest-resources.log:31) that need a primary-source read before either is acted on (GOTCHAS #183: read the upstream's CURRENT source — the pinned nixpkgs module, the pinned app version — before ruling a carrier's mechanism; a research table's contract is a claim, the drive is the proof):

(a) — most likely — password BasicAuth is no longer an API credential on this Listmonk. Modern Listmonk moved API access to API users + Authorization: token <user>:<token>, with the interactive admin's password no longer valid on /api/*; an unauthenticated API request answers 403, which is precisely and uniformly what every probe saw, including on /api/health. Under this reading the port needs to mint and bootstrap an API token, and the health check plus both oneshots switch to token auth.

(b) the secretFile env key never reaches Listmonk. services.listmonk.secretFile is a systemd EnvironmentFile whose keys must be Listmonk's own LISTMONK_<section>__<key> override convention (e.g. LISTMONK_app__admin_password). LISTMONK_ADMIN_PASSWORD matches no section/key under that convention, so the minted password would never become the admin's password and Basic auth as idss-admin would fail for every caller. Note app.address clearly IS landing — Listmonk is reachable on the derived host at all — so the dotted-settings shape works; only the password's carrier is in question.

Whichever holds, the same three call sites are wrong together, which is why this has never been proven: the newsletters-smtp and newsletters-brand oneshots both swallow their failures (|| exit 0 at newsletters.go:324, || true at :332, || echo … (continuing) at :434), so the SMTP send path and the brand apply have been silently no-opping on every deploy. Expect newsletters-wears-kit and the send half to be red behind this one.

Which refusal rule fired

Rule 3 (product-behaviour surface as a design decision), and rule 2 as well.

  • Rule 3: the fix mints a new secret (an API token) and/or renames the credential a deployed community carries in its newsletters-secrets generator, and changes how the port authenticates to its own service — the explicitly-named #1247 secrets class, not a mechanical repair. It is not a two-way door: the generator's file set is pinned by TestGeneratorFileSetsArePinned and regenerating a generator rotates material a deployed fleet already holds.
  • Rule 3's fast lane does not apply: I cannot reach the pinned upstream from this workstation (no nixpkgs checkout in the local store, and the drive's VM is torn down — its ssh port refuses), so I cannot write a test here that proves which of (a)/(b) is true. Confidence is the fast lane's entry condition and I do not have it.
  • Rule 2: the correct fix spans internal/clan/newsletters.go, internal/clan/portsecrets.go, control-plane/cmd/control-plane/newslettershealth.go and control-plane/cmd/control-plane/main.go — four non-test files before the pins below.

Pins that will need re-ruling with the fix

  • internal/clan/newsletters_test.go:74 — LISTMONK_ADMIN_PASSWORD= / LISTMONK_SMTP_PASSWORD= in the generator.
  • internal/clan/newsletters_test.go:127 — "app.admin_username" = "idss-admin";.
  • internal/clan/newsletters_test.go:188,192 — $user:$LISTMONK_ADMIN_PASSWORD in the brand oneshot.
  • control-plane/cmd/control-plane/adminsecret_test.go — the resolver's newsletters key.

Evidence absent from this run

No error-context.md and no Playwright locator artifact (the red is a leg fault raised by the in-guest health probe, not a browser assertion). No droplet-journal.txt — this is the VM/private path (logs/qemu.log, logs/guest-unit.log), not a droplet drive. logs/state-logs.log records ENOENT for state/logs. state/clan-config-snapshot (HEAD 4433b3a4) predates the co-host deploys, so it carries no deployed newsletters.nix and no Caddy newsletters route — the front-door reasoning above is from the render source, not the snapshot. logs/guest-system-journal.log is a 503-line tail beginning 21:42, so it does not cover Listmonk's 21:35 startup or the newsletters-smtp/newsletters-brand oneshot runs; capturing journalctl -u listmonk -u newsletters-smtp -u newsletters-brand on the next newsletters drive would settle (a) vs (b) directly.

drive 20260907T210012Z red at newsletters-healthy: newsletters service is not healthy after 360s of warm-up re-probe (#556): Newsletters is not serving — Listmonk could not render a pānui and hand it to the community's mail service — this service
evidence: /home/swarm/swarm/Matou/idss/test-results/private-path/20260907T210012Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## The failure Drive `20260907T210012Z` (private path, brands target): 16/17 green, red at `newsletters-healthy` after 360s of warm-up re-probe (`artifacts/legs.json`, `artifacts/verdict.json` — `firstRedLeg: newsletters-healthy`, commit `0fce2fe3`). `deploy-newsletters` itself was **green** (873s). The fault text is the check's own summary: *"Newsletters is not serving — Listmonk could not render a pānui and hand it to the community's mail service"*. The underlying error is the same on every single probe: ``` error="listmonk: the API is not answering — HTTP 403" verdict=failed ``` `logs/guest-control-plane.log:130-165` (36 warm-up attempts, 21:43:34 → 21:49:25) and `:166-201` (~35 further re-probes, 21:49:30 → 21:55:23). Not one probe got anything but 403. ## Where it fails, exactly The check dies on its **first** call, before any fixture work: `newslettersServing` → `newslettersGet(root + "/api/health")` → non-200 → wrapped as `"listmonk: the API is not answering — %w"`. - `control-plane/cmd/control-plane/newslettershealth.go:201-205` — the `/api/health` GET and the exact error string. - `control-plane/cmd/control-plane/newslettershealth.go:413-415` — the `HTTP %d` that carries the 403. - `control-plane/cmd/control-plane/newslettershealth.go:472` — the auth it presents: `Authorization: Basic base64(admin.User + ":" + admin.Secret())`. ## What is NOT the cause (ruled out from the evidence) 1. **Not a dead service.** Listmonk is running and serving: `logs/guest-resources.log:31` (`listmonk-6.1.0/bin/listmonk`, RSS 38M, started 21:35), `:35` (a live `postgres: listmonk listmonk [local] idle`), and `logs/guest-system-journal.log:328` (`listmonk[14087]: updates.go:73: new update v6.2.0 found` at 21:50:59 — it is executing its own background work while answering the check 403). `logs/guest-failed-units.log` lists **zero** failed units. 2. **Not an unlanded credential.** An unresolved secret makes `NewslettersAdmin.Zero()` true (`newslettershealth.go:106`) and the check returns the `PendingFault` at `newslettershealth.go:158-163` — *"the Listmonk admin credential has not landed yet"*. That is the message the PREVIOUS drive (`20260907T194850Z`) carried and that `0fce2fe3` fixed. We are past that gate now: the resolver read a non-empty value off `/run/secrets/vars/newsletters-secrets/env` and Listmonk **rejected** it. 3. **Not the front door.** This is the PRIVATE path. `renderPrivateRoute` (`internal/clan/frontdoor.go:783-793`) proxies each service host **without** `forward_auth` — "ungated this arc (ADR 0150)". `state/clan-config-snapshot` → `machines/gateway/front-door.nix` confirms only `@idp`/`@admin`/`@portal` carry a gate, and the gate's session refusal is a 302 redirect anyway (front-door.nix, the `@unauth status 401` handle_response), never a bare 403. A *missing* route would also not produce this: an unmatched host under the wildcard vhost falls through to an empty 200, which would surface as `could not decode the reply`, not `HTTP 403`. 4. **Not a warm-up ceiling.** Six minutes of a byte-identical deterministic refusal is not a service still starting. Raising the ceiling would only buy a longer red. ## The suspected layer **The newsletters port's Listmonk admin-identity bootstrap / API auth mechanism.** The port authenticates to Listmonk as a config-file admin over HTTP Basic, in three places that all share the one identity: - `internal/clan/newsletters.go:242` — `"app.admin_username" = "idss-admin"` as a Listmonk settings key. - `internal/clan/newsletters.go:238` — the password rides `services.listmonk.secretFile` as **`LISTMONK_ADMIN_PASSWORD`**, minted by `renderPortSecretsEnvFile` (`internal/clan/portsecrets.go:74-86`, key named at `portsecrets.go:55`). - `internal/clan/newsletters.go:324,331` (the `newsletters-smtp` reconciler) and `:415,425,432` (the `newsletters-brand` oneshot) — `curl -u "$user:$LISTMONK_ADMIN_PASSWORD"`. - `control-plane/cmd/control-plane/newslettershealth.go:472` — the same Basic header from the check. Two candidate root causes, both upstream-contract questions about the **pinned listmonk 6.1.0** (`guest-resources.log:31`) that need a primary-source read before either is acted on (GOTCHAS #183: *read the upstream's CURRENT source — the pinned nixpkgs module, the pinned app version — before ruling a carrier's mechanism; a research table's contract is a claim, the drive is the proof*): **(a) — most likely — password BasicAuth is no longer an API credential on this Listmonk.** Modern Listmonk moved API access to API users + `Authorization: token <user>:<token>`, with the interactive admin's password no longer valid on `/api/*`; an unauthenticated API request answers **403**, which is precisely and uniformly what every probe saw, including on `/api/health`. Under this reading the port needs to mint and bootstrap an **API token**, and the health check plus both oneshots switch to token auth. **(b) the `secretFile` env key never reaches Listmonk.** `services.listmonk.secretFile` is a systemd `EnvironmentFile` whose keys must be Listmonk's own `LISTMONK_<section>__<key>` override convention (e.g. `LISTMONK_app__admin_password`). `LISTMONK_ADMIN_PASSWORD` matches no section/key under that convention, so the minted password would never become the admin's password and Basic auth as `idss-admin` would fail for every caller. Note `app.address` clearly IS landing — Listmonk is reachable on the derived host at all — so the dotted-settings shape works; only the password's carrier is in question. Whichever holds, the same three call sites are wrong together, which is why this has never been proven: the `newsletters-smtp` and `newsletters-brand` oneshots both swallow their failures (`|| exit 0` at `newsletters.go:324`, `|| true` at `:332`, `|| echo … (continuing)` at `:434`), so the SMTP send path and the brand apply have been silently no-opping on every deploy. Expect `newsletters-wears-kit` and the send half to be red behind this one. ## Which refusal rule fired **Rule 3 (product-behaviour surface as a design decision), and rule 2 as well.** - Rule 3: the fix mints a new secret (an API token) and/or renames the credential a deployed community carries in its `newsletters-secrets` generator, and changes how the port authenticates to its own service — the explicitly-named #1247 secrets class, not a mechanical repair. It is not a two-way door: the generator's file set is pinned by `TestGeneratorFileSetsArePinned` and regenerating a generator rotates material a deployed fleet already holds. - Rule 3's fast lane does **not** apply: I cannot reach the pinned upstream from this workstation (no nixpkgs checkout in the local store, and the drive's VM is torn down — its ssh port refuses), so I cannot write a test here that proves which of (a)/(b) is true. Confidence is the fast lane's entry condition and I do not have it. - Rule 2: the correct fix spans `internal/clan/newsletters.go`, `internal/clan/portsecrets.go`, `control-plane/cmd/control-plane/newslettershealth.go` and `control-plane/cmd/control-plane/main.go` — four non-test files before the pins below. ## Pins that will need re-ruling with the fix - `internal/clan/newsletters_test.go:74` — `LISTMONK_ADMIN_PASSWORD=` / `LISTMONK_SMTP_PASSWORD=` in the generator. - `internal/clan/newsletters_test.go:127` — `"app.admin_username" = "idss-admin";`. - `internal/clan/newsletters_test.go:188,192` — `$user:$LISTMONK_ADMIN_PASSWORD` in the brand oneshot. - `control-plane/cmd/control-plane/adminsecret_test.go` — the resolver's newsletters key. ## Evidence absent from this run No `error-context.md` and no Playwright locator artifact (the red is a leg fault raised by the in-guest health probe, not a browser assertion). No `droplet-journal.txt` — this is the VM/private path (`logs/qemu.log`, `logs/guest-unit.log`), not a droplet drive. `logs/state-logs.log` records `ENOENT` for `state/logs`. `state/clan-config-snapshot` (HEAD `4433b3a4`) predates the co-host deploys, so it carries no deployed `newsletters.nix` and no Caddy newsletters route — the front-door reasoning above is from the render source, not the snapshot. `logs/guest-system-journal.log` is a 503-line tail beginning 21:42, so it does not cover Listmonk's 21:35 startup or the `newsletters-smtp`/`newsletters-brand` oneshot runs; capturing `journalctl -u listmonk -u newsletters-smtp -u newsletters-brand` on the next newsletters drive would settle (a) vs (b) directly. drive `20260907T210012Z` red at `newsletters-healthy`: `newsletters service is not healthy after 360s of warm-up re-probe (#556): Newsletters is not serving — Listmonk could not render a pānui and hand it to the community's mail service — this service` evidence: `/home/swarm/swarm/Matou/idss/test-results/private-path/20260907T210012Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: 40d79d47a9d2 -->
Owner

Ruled + landed 8910b1bf — closing. Both candidates settled from listmonk v6.1.0 source, and BOTH were true: (a) internal/auth/auth.go Middleware validates ANY Authorization header (Basic included) via GetAPIToken against the API-user cache — a password user can never call /api/*; (b) cmd/install.go creates the superadmin + Super Admin role only from LISTMONK_ADMIN_USER + LISTMONK_ADMIN_PASSWORD — our app.admin_username settings key was meaningless, so no admin existed either. LISTMONK_ADMIN_API_USER prints a random token to stderr (unusable); API tokens are stored as-is and cached at daemon start.

Fix: generator mints LISTMONK_API_TOKEN; systemd.services.listmonk.environment.LISTMONK_ADMIN_USER = idss-admin (the module's --install ExecStartPre runs with the secret env loaded); an ExecStartPre appended with lib.mkAfter psql-upserts the idss-api API user (Super Admin, enabled) with the minted token — the module's own update-database-config.sh is the precedent — before the daemon caches API users; health check + SMTP reconciler + brand oneshot authenticate token idss-api:<token>. GOTCHAS #185. Pins re-ruled; clan + control-plane suites green.

Two-way under ADR 0174 (drive worlds only carry this generator today) — Ben: veto anytime. Your refusal was right and the analysis was exactly the map I needed.

**Ruled + landed `8910b1bf` — closing.** Both candidates settled from listmonk v6.1.0 source, and BOTH were true: (a) `internal/auth/auth.go` Middleware validates ANY Authorization header (Basic included) via `GetAPIToken` against the API-user cache — a password user can never call `/api/*`; (b) `cmd/install.go` creates the superadmin + Super Admin role only from `LISTMONK_ADMIN_USER` + `LISTMONK_ADMIN_PASSWORD` — our `app.admin_username` settings key was meaningless, so no admin existed either. `LISTMONK_ADMIN_API_USER` prints a random token to stderr (unusable); API tokens are stored as-is and cached at daemon start. **Fix:** generator mints `LISTMONK_API_TOKEN`; `systemd.services.listmonk.environment.LISTMONK_ADMIN_USER = idss-admin` (the module's `--install` ExecStartPre runs with the secret env loaded); an ExecStartPre appended with `lib.mkAfter` psql-upserts the `idss-api` API user (Super Admin, enabled) with the minted token — the module's own `update-database-config.sh` is the precedent — before the daemon caches API users; health check + SMTP reconciler + brand oneshot authenticate `token idss-api:<token>`. GOTCHAS #185. Pins re-ruled; clan + control-plane suites green. Two-way under ADR 0174 (drive worlds only carry this generator today) — Ben: veto anytime. Your refusal was right and the analysis was exactly the map I needed.
ben closed this issue 2026-09-07 22:15:55 +00:00
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.

Reference
Matou/idss#1306
No description provided.