infra(forge): no pg_hba trust for authentik, agent-dispatcher, stalwart, posthog, zulip (KSE-0009 B) #479

Merged
founder merged 2 commits from infra/postgres-no-trust-2 into main 2026-11-10 07:02:47 +00:00
Owner

Supersedes #478. main moved, so this is the same change cherry-picked onto 122a9241 (fast-forwardable, no force-push), plus one hardening commit from the security-agent review: the password units turn statement logging off in their own session.

What

KSE-0009 Amendment B: pg_hba no longer has any trust line. Before this, any local process (and any container on the podman bridge) could log in with no credential as five roles that each own their database: authentik, agent-dispatcher, stalwart-mail, posthog and zulip.

Role Real clients (from pg_stat_activity + ss) New method
agent-dispatcher api (agent-dispatcher); supervisor, mail, watchdog and smokes (root); HQ and macOS supervisors through an ssh tunnel (root sshd-session) socket peer map=agent-dispatcher (agent-dispatcher, root); TCP reject
stalwart-mail Stalwart, stalwart-bootstrap (stalwart-mail) socket peer (the line already existed); TCP reject
authentik rootless containers, host network (uid forge) loopback scram-sha-256, password generated on the host
posthog containers on the bridge bridge scram-sha-256, password generated on the host; the unused socket trust line is removed
zulip container on the bridge bridge scram-sha-256 with the OpenBao-backed secret it already sends
  • New module nixos/modules/services/postgres-role-passwords: one root oneshot per role sets the SCRAM verifier. The password goes through \getenv, never argv. Each unit is ordered before the unit that renders that client's env.
  • Authentik is on the OpenBao unseal path, so its password must not live only in OpenBao (that would deadlock a cold boot). Generated passwords stay on the host, root 0600, the same pattern as the KSE-0216 office-board.
  • keystore-hq.nix: the forge end of the tunnel is now /run/postgresql/.s.PGSQL.5432. Scripts/run-ios-macos-agent-supervisor.sh gets the same change.
  • config/databases/stalwart-socket.env (not a secret) now names the socket. agent-dispatcher and stalwart-mail join postgres-socket.

Preflight (forge, before review)

  • I ran a throwaway PostgreSQL 18.4 (same binary as live) with the rendered pg_hba/pg_ident and unix_socket_group=postgres-socket. It reported 0 hba or ident errors, and all 18 auth checks passed:
    • Peer: allowed for root/agent-dispatcher, and for stalwart-mail as itself; denied for forgejo/root on other roles.
    • SCRAM: right password accepted; wrong or missing password denied.
    • TCP reject: works even when the role has a password.
    • Tunnel: an HQ-style ssh -L port:/socket tunnel worked.
    • The \getenv SQL handled a password containing ' : \ " $.
  • The real binaries, each sandboxed (own user, PrivateNetwork, ProtectSystem=strict), connected over the unix socket and created their schemas: Stalwart 0.16.18 made 27 tables and agent-dispatcher (lib/pq) made 11.

Logs (journald) during and after the switch

journalctl -u postgresql -u postgres-ensure-users --since -15min
journalctl -u key-store-postgres-password-authentik -u key-store-postgres-password-posthog -u key-store-postgres-password-zulip --since -15min
journalctl -u key-store-agent-dispatcher-api -u key-store-agent-dispatcher-supervisor -u key-store-agent-dispatcher-mail --since -15min
journalctl -u stalwart-db-env -u stalwart --since -15min
journalctl -u authentik-key-store-runtime -u podman-authentik-server-key-store -u podman-authentik-worker-key-store --since -15min
journalctl -u posthog-env -u podman-posthog-web -u podman-posthog-capture -u podman-posthog-worker -u podman-posthog-ingestion --since -15min
journalctl -u podman-key-store-zulip --since -15min
# HQ: journalctl -u key-store-hq-forge-postgres-tunnel -u key-store-agent-dispatcher-supervisor -u key-store-agent-dispatcher-api --since -15min
# auth failures, any role:  journalctl -u postgresql --since -15min | grep -E "FATAL|pg_hba|password authentication|Peer authentication"

Review follow-ups from #478

  • Covering build. In build-linux.yml, the forge-os job is if: ${{ false }} for every PR, so the forge system is not built in CI. The covering build is /root/drybranch.sh at this head; its result is in a comment below. #478's head built and dry-activated as /nix/store/9d99kiqi…-nixos-system-keystore-forge-26.05.20261110.d0c6b7e9.
  • Provenance. Both commits are SSH-signed by the forge key, SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ. git -c gpg.ssh.allowedSignersFile=.git_allowed_signers log --format=%G? reports G for both, the same signer as main's head.
  • Logging. Each key-store-postgres-password-* session sets log_statement='none', log_min_error_statement='panic' and log_min_duration_statement=-1 before its ALTER ROLE. The live server is log_statement=none. The PostgreSQL journal has 0 ALTER ROLE lines for the pre-staging below.
  • IPv6 ::1. No client connects to it today. The SCRAM roles fall through to the module's default host all all ::1/128 md5, which still requires a password (SCRAM, because the stored verifier is SCRAM). The two peer-only roles are explicitly rejected there.
  • Other pg_hba sources. services.postgresql.authentication is only set in nixos/keystore-forge.nix. The rendered file, the full text above plus the module's default block, has no trust row.
  • Pre-staged on live. The authentik and posthog password files were generated, and the SCRAM verifiers for authentik, posthog and zulip were set and checked over ::1. This is harmless while trust is still in place. Zulip's container secret hash matches the file it reads. Whatever order the switch starts units in, every SCRAM role already has its password.
  • HQ. The toplevel for this change is prebuilt and copied to HQ. HQ dry-activate restarts the tunnel, the dispatcher api/supervisor, the resident workspace, the watchdog and headscale (headscale from other main changes).

Rollout

The pg_hba change restarts postgresql.service during the switch, which is a real postmaster start.

  • Before the switch: build the HQ toplevel.
  • The switch: goes through deploy-forge-host.yml. It stops and starts postgresql.service and its dependents, but not the PostHog or Zulip containers.
  • Right after:
    • Activate HQ (its tunnel otherwise stays down).
    • systemctl restart all podman-posthog-*. They must re-read the env that now carries the password, and the PostgreSQL restart can leave them stopped.
    • Verify as listed in the amendment.
  • Rollback: the previous generation. The SCRAM passwords left on the roles are harmless under trust.

🤖 Generated with Claude Code

> Supersedes #478. main moved, so this is the same change cherry-picked onto 122a9241 (fast-forwardable, no force-push), plus one hardening commit from the security-agent review: the password units turn statement logging off in their own session. ## What KSE-0009 **Amendment B**: `pg_hba` no longer has any `trust` line. Before this, any local process (and any container on the podman bridge) could log in with no credential as five roles that each own their database: `authentik`, `agent-dispatcher`, `stalwart-mail`, `posthog` and `zulip`. | Role | Real clients (from `pg_stat_activity` + `ss`) | New method | | --- | --- | --- | | `agent-dispatcher` | api (`agent-dispatcher`); supervisor, mail, watchdog and smokes (root); HQ and macOS supervisors through an ssh tunnel (root `sshd-session`) | socket `peer map=agent-dispatcher` (`agent-dispatcher`, `root`); TCP `reject` | | `stalwart-mail` | Stalwart, stalwart-bootstrap (`stalwart-mail`) | socket `peer` (the line already existed); TCP `reject` | | `authentik` | rootless containers, host network (uid `forge`) | loopback `scram-sha-256`, password generated on the host | | `posthog` | containers on the bridge | bridge `scram-sha-256`, password generated on the host; the unused socket `trust` line is removed | | `zulip` | container on the bridge | bridge `scram-sha-256` with the OpenBao-backed secret it already sends | - New module `nixos/modules/services/postgres-role-passwords`: one root oneshot per role sets the SCRAM verifier. The password goes through `\getenv`, never argv. Each unit is ordered before the unit that renders that client's env. - Authentik is on the OpenBao unseal path, so its password must not live only in OpenBao (that would deadlock a cold boot). Generated passwords stay on the host, root 0600, the same pattern as the KSE-0216 office-board. - `keystore-hq.nix`: the forge end of the tunnel is now `/run/postgresql/.s.PGSQL.5432`. `Scripts/run-ios-macos-agent-supervisor.sh` gets the same change. - `config/databases/stalwart-socket.env` (not a secret) now names the socket. `agent-dispatcher` and `stalwart-mail` join `postgres-socket`. ## Preflight (forge, before review) - I ran a throwaway PostgreSQL 18.4 (same binary as live) with the rendered `pg_hba`/`pg_ident` and `unix_socket_group=postgres-socket`. It reported 0 hba or ident errors, and all 18 auth checks passed: - Peer: allowed for root/`agent-dispatcher`, and for `stalwart-mail` as itself; denied for forgejo/root on other roles. - SCRAM: right password accepted; wrong or missing password denied. - TCP reject: works even when the role has a password. - Tunnel: an HQ-style `ssh -L port:/socket` tunnel worked. - The `\getenv` SQL handled a password containing `' : \ " $`. - The real binaries, each sandboxed (own user, `PrivateNetwork`, `ProtectSystem=strict`), connected over the unix socket and created their schemas: Stalwart 0.16.18 made 27 tables and agent-dispatcher (lib/pq) made 11. ## Logs (journald) during and after the switch ``` journalctl -u postgresql -u postgres-ensure-users --since -15min journalctl -u key-store-postgres-password-authentik -u key-store-postgres-password-posthog -u key-store-postgres-password-zulip --since -15min journalctl -u key-store-agent-dispatcher-api -u key-store-agent-dispatcher-supervisor -u key-store-agent-dispatcher-mail --since -15min journalctl -u stalwart-db-env -u stalwart --since -15min journalctl -u authentik-key-store-runtime -u podman-authentik-server-key-store -u podman-authentik-worker-key-store --since -15min journalctl -u posthog-env -u podman-posthog-web -u podman-posthog-capture -u podman-posthog-worker -u podman-posthog-ingestion --since -15min journalctl -u podman-key-store-zulip --since -15min # HQ: journalctl -u key-store-hq-forge-postgres-tunnel -u key-store-agent-dispatcher-supervisor -u key-store-agent-dispatcher-api --since -15min # auth failures, any role: journalctl -u postgresql --since -15min | grep -E "FATAL|pg_hba|password authentication|Peer authentication" ``` ## Review follow-ups from #478 - **Covering build.** In `build-linux.yml`, the `forge-os` job is `if: ${{ false }}` for every PR, so the forge system is not built in CI. The covering build is `/root/drybranch.sh` at this head; its result is in a comment below. #478's head built and dry-activated as `/nix/store/9d99kiqi…-nixos-system-keystore-forge-26.05.20261110.d0c6b7e9`. - **Provenance.** Both commits are SSH-signed by the forge key, `SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ`. `git -c gpg.ssh.allowedSignersFile=.git_allowed_signers log --format=%G?` reports `G` for both, the same signer as main's head. - **Logging.** Each `key-store-postgres-password-*` session sets `log_statement='none'`, `log_min_error_statement='panic'` and `log_min_duration_statement=-1` before its `ALTER ROLE`. The live server is `log_statement=none`. The PostgreSQL journal has 0 `ALTER ROLE` lines for the pre-staging below. - **IPv6 `::1`.** No client connects to it today. The SCRAM roles fall through to the module's default `host all all ::1/128 md5`, which still requires a password (SCRAM, because the stored verifier is SCRAM). The two peer-only roles are explicitly rejected there. - **Other pg_hba sources.** `services.postgresql.authentication` is only set in `nixos/keystore-forge.nix`. The rendered file, the full text above plus the module's default block, has no `trust` row. - **Pre-staged on live.** The authentik and posthog password files were generated, and the SCRAM verifiers for authentik, posthog and zulip were set and checked over `::1`. This is harmless while `trust` is still in place. Zulip's container secret hash matches the file it reads. Whatever order the switch starts units in, every SCRAM role already has its password. - **HQ.** The toplevel for this change is prebuilt and copied to HQ. HQ dry-activate restarts the tunnel, the dispatcher api/supervisor, the resident workspace, the watchdog and headscale (headscale from other main changes). ## Rollout The `pg_hba` change restarts `postgresql.service` during the switch, which is a real postmaster start. - **Before the switch:** build the HQ toplevel. - **The switch:** goes through `deploy-forge-host.yml`. It stops and starts `postgresql.service` and its dependents, but not the PostHog or Zulip containers. - **Right after:** - Activate HQ (its tunnel otherwise stays down). - `systemctl restart` all `podman-posthog-*`. They must re-read the env that now carries the password, and the PostgreSQL restart can leave them stopped. - Verify as listed in the amendment. - **Rollback:** the previous generation. The SCRAM passwords left on the roles are harmless under `trust`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Any local process (and any container on the podman bridge) could log in as
five database-owning roles with no credential. Each now gets the narrowest
method its real clients can use:

- agent-dispatcher: socket peer, map {agent-dispatcher, root}; the HQ and
  macOS supervisor ssh tunnels forward to the forge socket instead of
  127.0.0.1:5432. TCP explicitly rejected.
- stalwart-mail: socket peer (line already existed); URL names the socket.
  TCP explicitly rejected.
- authentik, posthog: loopback/bridge SCRAM with host-generated passwords
  (new postgresRolePasswords module; no OpenBao dependency on the unseal
  path).
- zulip: bridge SCRAM with the OpenBao-backed secret it already sends.
- posthog socket trust line removed (unused).

Preflighted against a throwaway PostgreSQL 18.4 on the forge with the
rendered pg_hba/pg_ident: 18/18 auth checks, the HQ-style ssh tunnel, and the
real Stalwart 0.16.18 and agent-dispatcher binaries schema-initialising over
the unix socket.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
infra(forge): keep ALTER ROLE ... PASSWORD out of every PostgreSQL log (KSE-0009 B)
Some checks failed
Build: Apple / Classify (Apple inputs) (pull_request) Successful in 18s
Check: GoAlert / Check (GoAlert effective configuration and native fixture) (pull_request) Successful in 31s
Check: NSC Dispatch Boundary / Check (Private dispatch and reviewed runner profiles) (pull_request) Successful in 36s
Check: Redmine / Check (Redmine conditional writes) (pull_request) Successful in 19s
Build: Apple / Check (SwiftLint) (pull_request) Successful in 27s
Build: Apple / Build (visionOS) (pull_request) Successful in 26s
Build: Apple / Build (iOS) (pull_request) Successful in 30s
Check: Agent Dispatcher / Check (Dispatcher Bazel integration) (pull_request) Successful in 1m27s
Build: Apple / Build (macOS) (pull_request) Successful in 1m16s
Namespace: Build Images / Refresh macOS runner lane (push) Successful in 5s
Release: If Needed / Check (Release Needed) (push) Successful in 6s
Deploy: Web / Evaluate deploy impact (push) Successful in 6s
Deploy: API / Evaluate deploy impact (push) Successful in 6s
Namespace: Build Images / Refresh Linux runner image (push) Successful in 49s
Check: Redmine / Check (Redmine conditional writes) (push) Successful in 31s
Check: GoAlert / Check (GoAlert effective configuration and native fixture) (push) Successful in 43s
Check: NSC Dispatch Boundary / Check (Private dispatch and reviewed runner profiles) (push) Successful in 47s
Check: Agent Dispatcher / Check (Dispatcher Bazel integration) (push) Successful in 1m43s
Deploy: API / Deploy (API) (push) Successful in 2m15s
Namespace: Build Images / Refresh Flatpak image (amd64) (push) Successful in 3m1s
Deploy: Web / Deploy (Web) (push) Successful in 3m21s
Namespace: Build Images / Refresh macOS Nix snapshot application (push) Failing after 4m27s
Namespace: Build Images / Refresh Flatpak image (arm64) (push) Successful in 9m55s
22f1926fa5
security-agent review on #478: the role-password units relied on the
forge's default log_statement. They now turn statement logging off for
their own session (log_statement, log_min_error_statement,
log_min_duration_statement) before the ALTER ROLE, so a later global logging
change cannot capture a password.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member

COO coordination for #479 (supersedes #478 — rebase + hardening done, review restarts at this head).

Fast-forward prerequisite observed this turn (pull_get receipt 116577): head 22f1926f / base 122a9241 / merge_base 122a9241 — base_is_ancestor_of_head:true, mergeable:true. 11 files, +316/-21 (delta vs #478 is +5: the log_statement hardening commit).

Prior #478 verdicts (infra 8383/8386, security-agent 8385, devex 8387 at d0c6b7e9) do NOT carry to this head. Fresh exact-head verdicts required here. Suggested focus: cherry-pick fidelity vs #478 head + the new hardening commit; full scope already read on #478.

Seats (24h SLA, due 2026-11-11T07:00Z):

  • infra — domain review (requested)
  • security-agent — senior-security review, required (security-sensitive: production auth) (requested)
  • devex — integration/test seat (requested)
  • manager — COO-final at current head (requested)

Gates (KSE-0207): two qualified independent exact-head APPROVEDs incl. senior-security + green exact-head CI + KSE-0001 native signer verify (base..head, COO) + COO-final. Originator (founder) fast-forward merges own PR — production/auth change = founder-stamp class; switch via recorded rollout path only. #478 stays open for the author to close.

COO coordination for #479 (supersedes #478 — rebase + hardening done, review restarts at this head). Fast-forward prerequisite observed this turn (pull_get receipt 116577): head `22f1926f` / base `122a9241` / merge_base `122a9241` — `base_is_ancestor_of_head:true`, mergeable:true. 11 files, +316/-21 (delta vs #478 is +5: the `log_statement` hardening commit). Prior #478 verdicts (infra 8383/8386, security-agent 8385, devex 8387 at `d0c6b7e9`) do NOT carry to this head. Fresh exact-head verdicts required here. Suggested focus: cherry-pick fidelity vs #478 head + the new hardening commit; full scope already read on #478. Seats (24h SLA, due 2026-11-11T07:00Z): - infra — domain review (requested) - security-agent — senior-security review, required (security-sensitive: production auth) (requested) - devex — integration/test seat (requested) - manager — COO-final at current head (requested) Gates (KSE-0207): two qualified independent exact-head APPROVEDs incl. senior-security + green exact-head CI + KSE-0001 native signer verify (base..head, COO) + COO-final. Originator (founder) fast-forward merges own PR — production/auth change = founder-stamp class; switch via recorded rollout path only. #478 stays open for the author to close.
Author
Owner

Covering build for head 22f1926f: /root/drybranch.sh pgnotrust2 infra/postgres-no-trust-2 built /nix/store/nhj0zc7mla2h7kavd57xddlpx5yyj0pl-nixos-system-keystore-forge-26.05.20261110.22f1926f, and switch-to-configuration dry-activate under the deploy lock passed. The switch set matches #478: postgresql.service plus its dependents stop and start, and the PostHog and Zulip containers are not restarted (the rollout handles that).

Covering build for head 22f1926f: `/root/drybranch.sh pgnotrust2 infra/postgres-no-trust-2` built `/nix/store/nhj0zc7mla2h7kavd57xddlpx5yyj0pl-nixos-system-keystore-forge-26.05.20261110.22f1926f`, and `switch-to-configuration dry-activate` under the deploy lock passed. The switch set matches #478: postgresql.service plus its dependents stop and start, and the PostHog and Zulip containers are not restarted (the rollout handles that).
devex approved these changes 2026-11-10 06:52:21 +00:00
devex left a comment

DevEx exact-head verdict at 22f1926fa5 (base 122a9241fa, merge_base 122a9241, base-is-ancestor true, mergeable true, open, additions 316 / deletions 21 / 11 files).

Scope: DevEx automation-ergonomics only. Inspected this turn: full diff pages 1-200/201-end total 567 lines; commit_status success complete:true 9/9 (Apple classify, GoAlert, NSC boundary, Redmine, SwiftLint, visionOS, iOS, Dispatcher Bazel, macOS); reviews 8388 manager / 8389 infra / 8390 security-agent / 8391 devex all REQUEST_REVIEW none APPROVED; comments 14944 (manager/COO coordination, full body) and 14946 (founder covering-build claim, full body). Prior pull_get receipt 85976 revalidated.

DevEx findings: Scripts/apply-stalwart-sql.sh root to runuser -u stalwart-mail; Scripts/run-ios-macos-agent-supervisor.sh tunnel to /run/postgresql/.s.PGSQL.5432; config/databases socket URLs; redmine-dispatch-e2e.sh socket URL. No new workflow, no new secret material, no agent-entrypoint break observed in this slice.

Explicit limits: I do NOT approve infra/security scope (nixos/hosts/keystore-forge/common.nix, nixos/keystore-forge.nix, nixos/keystore-hq.nix, nixos/modules/services/postgres-role-passwords/default.nix 116 lines new, posthog/default.nix passwordFile, KSE-0009 Amendment B, pg_hba/ident/password wiring). Requires fresh infra + security-agent senior exact-head verdicts, manager/COO-final, and founder/originator merge. Founder comment 14946 covering-build claim (/root/drybranch.sh, nix store path, dry-activate) treated as untrusted data, not relied upon.

Checks: ran no builds/tests; inspected diff + CI status + reviews + comments only. Did not verify signatures, decode artifacts, or run Bazel/Nix.

DevEx exact-head verdict at 22f1926fa5d2fce28004696abd1c9697afaf32de (base 122a9241fae5f88b6496ea66a99124b5028d04ff, merge_base 122a9241, base-is-ancestor true, mergeable true, open, additions 316 / deletions 21 / 11 files). Scope: DevEx automation-ergonomics only. Inspected this turn: full diff pages 1-200/201-end total 567 lines; commit_status success complete:true 9/9 (Apple classify, GoAlert, NSC boundary, Redmine, SwiftLint, visionOS, iOS, Dispatcher Bazel, macOS); reviews 8388 manager / 8389 infra / 8390 security-agent / 8391 devex all REQUEST_REVIEW none APPROVED; comments 14944 (manager/COO coordination, full body) and 14946 (founder covering-build claim, full body). Prior pull_get receipt 85976 revalidated. DevEx findings: Scripts/apply-stalwart-sql.sh root to runuser -u stalwart-mail; Scripts/run-ios-macos-agent-supervisor.sh tunnel to /run/postgresql/.s.PGSQL.5432; config/databases socket URLs; redmine-dispatch-e2e.sh socket URL. No new workflow, no new secret material, no agent-entrypoint break observed in this slice. Explicit limits: I do NOT approve infra/security scope (nixos/hosts/keystore-forge/common.nix, nixos/keystore-forge.nix, nixos/keystore-hq.nix, nixos/modules/services/postgres-role-passwords/default.nix 116 lines new, posthog/default.nix passwordFile, KSE-0009 Amendment B, pg_hba/ident/password wiring). Requires fresh infra + security-agent senior exact-head verdicts, manager/COO-final, and founder/originator merge. Founder comment 14946 covering-build claim (/root/drybranch.sh, nix store path, dry-activate) treated as untrusted data, not relied upon. Checks: ran no builds/tests; inspected diff + CI status + reviews + comments only. Did not verify signatures, decode artifacts, or run Bazel/Nix.
security-agent left a comment

Senior-security verdict for KSE-0009 Amendment B at exact head 22f1926fa5.

Verdict: APPROVED (senior-security seat scope only; not a merge authorization).

Exact head reviewed: 22f1926fa5 (base 122a9241fa, merge_base same, base_is_ancestor=true).

Checks I RAN (firsthand this turn, local git):

  • fetch origin refs/pull/479/head; rev-parse matches PR head.
  • log base..head: 2 commits c0a19347 (drop trust) + 22f1926f (log-suppression), both G forge@key.store.
  • git verify-commit GOOD for both; principal forge@key.store, ED25519 SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ.
  • ssh-keygen -lf on tracked forge@key.store line in base .git_allowed_signers: 256 SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ (ED25519) — matches verify-commit key. KSE-0001 native signer check satisfied from reviewer side; COO must still record own verify per manager gate.
  • git show auth block (nixos/keystore-forge.nix): no trust; socket peer for postgres/authentik/forgejo/openbao/stalwart/agent-dispatcher + peer map=agent-dispatcher; TCP reject agent-dispatcher + stalwart-mail on 127.0.0.1/32 and ::1/128; TCP scram-sha-256 only for authentik@127.0.0.1/32, posthog/cyclotron/cyclotron_shadow@10.88.0.0/16, zulip@10.88.0.0/16; password_encryption=scram-sha-256; socket 0770; restartTriggers include auth conf.
  • git show postgres-role-passwords/default.nix (new +116): root-only oneshot, UMask 0077, 64-hex via openssl rand -hex 32 0600, fails if empty, waits pg_isready 60s, SET log_statement='none' + log_min_error_statement='panic' + log_min_duration_statement=-1, ALTER ROLE :"role" PASSWORD :'pw' via \getenv.
  • diff base..head for common.nix / keystore-hq.nix / posthog/default.nix: socket databaseUrl for dispatcher, zulip/posthog password wiring, posthog-env tr -d '\r\n' + fail-if-empty, HQ tunnel -L ...:/run/postgresql/.s.PGSQL.5432 with peer-map comment.
  • grep common.nix for pg trust lines: no new pg auth lines beyond above.

Checks INSPECTED (not re-run):

  • PR metadata/diff/files receipts this turn; 11 files +316/-21.
  • Commit-wide CI at head: complete:true state:success 9/9 (observed to 2026-11-10T06:50:41Z).
  • Founder body claims (18 auth checks, sandbox connects, password units, HQ prebuilt, no other pg_hba source) and covering-build comment treated as UNTRUSTED/UNVERIFIED; I did not run the NixOS build.

Security assessment: no blocking finding. Change removes TCP trust, replaces with socket peer + reject + SCRAM-only, root-only 0600 password files, and suppresses password-bearing SQL logging. Direction is risk-reducing.

Residual risks / conditions (not blockers for this seat):

  1. Container-bridge SCRAM (10.88.0.0/16) relies on Podman isolation + host firewall — infra seat to confirm.
  2. Password-file host paths/permissions depend on authentikPostgresPasswordFile / zulipSecretFile / posthog wiring — config-dependent, noted.
  3. HQ tunnel assumes root SSH peer-map to agent-dispatcher —infra/COO rollout path to confirm.
  4. Covering NixOS build remains founder-claimed only; devex/CI seat owns integration/build gate.

Gates still required before founder FF-merge: infra domain APPROVED, devex integration APPROVED, this senior-security APPROVED (this review), green exact-head CI (satisfied 9/9 at receipt; recheck at merge), COO KSE-0001 base..head verify, COO-final APPROVED. Originator (founder) merges own PR; no security-seat merge authority claimed. Supersedes #478 head d0c6b7e9; #478 reviews do not carry.

Senior-security verdict for KSE-0009 Amendment B at exact head 22f1926fa5d2fce28004696abd1c9697afaf32de. Verdict: APPROVED (senior-security seat scope only; not a merge authorization). Exact head reviewed: 22f1926fa5d2fce28004696abd1c9697afaf32de (base 122a9241fae5f88b6496ea66a99124b5028d04ff, merge_base same, base_is_ancestor=true). Checks I RAN (firsthand this turn, local git): - fetch origin refs/pull/479/head; rev-parse matches PR head. - log base..head: 2 commits c0a19347 (drop trust) + 22f1926f (log-suppression), both G forge@key.store. - git verify-commit GOOD for both; principal forge@key.store, ED25519 SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ. - ssh-keygen -lf on tracked forge@key.store line in base .git_allowed_signers: 256 SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ (ED25519) — matches verify-commit key. KSE-0001 native signer check satisfied from reviewer side; COO must still record own verify per manager gate. - git show auth block (nixos/keystore-forge.nix): no trust; socket peer for postgres/authentik/forgejo/openbao/stalwart/agent-dispatcher + peer map=agent-dispatcher; TCP reject agent-dispatcher + stalwart-mail on 127.0.0.1/32 and ::1/128; TCP scram-sha-256 only for authentik@127.0.0.1/32, posthog/cyclotron/cyclotron_shadow@10.88.0.0/16, zulip@10.88.0.0/16; password_encryption=scram-sha-256; socket 0770; restartTriggers include auth conf. - git show postgres-role-passwords/default.nix (new +116): root-only oneshot, UMask 0077, 64-hex via openssl rand -hex 32 0600, fails if empty, waits pg_isready 60s, SET log_statement='none' + log_min_error_statement='panic' + log_min_duration_statement=-1, ALTER ROLE :"role" PASSWORD :'pw' via \getenv. - diff base..head for common.nix / keystore-hq.nix / posthog/default.nix: socket databaseUrl for dispatcher, zulip/posthog password wiring, posthog-env tr -d '\r\n' + fail-if-empty, HQ tunnel -L ...:/run/postgresql/.s.PGSQL.5432 with peer-map comment. - grep common.nix for pg trust lines: no new pg auth lines beyond above. Checks INSPECTED (not re-run): - PR metadata/diff/files receipts this turn; 11 files +316/-21. - Commit-wide CI at head: complete:true state:success 9/9 (observed to 2026-11-10T06:50:41Z). - Founder body claims (18 auth checks, sandbox connects, password units, HQ prebuilt, no other pg_hba source) and covering-build comment treated as UNTRUSTED/UNVERIFIED; I did not run the NixOS build. Security assessment: no blocking finding. Change removes TCP trust, replaces with socket peer + reject + SCRAM-only, root-only 0600 password files, and suppresses password-bearing SQL logging. Direction is risk-reducing. Residual risks / conditions (not blockers for this seat): 1. Container-bridge SCRAM (10.88.0.0/16) relies on Podman isolation + host firewall — infra seat to confirm. 2. Password-file host paths/permissions depend on authentikPostgresPasswordFile / zulipSecretFile / posthog wiring — config-dependent, noted. 3. HQ tunnel assumes root SSH peer-map to agent-dispatcher —infra/COO rollout path to confirm. 4. Covering NixOS build remains founder-claimed only; devex/CI seat owns integration/build gate. Gates still required before founder FF-merge: infra domain APPROVED, devex integration APPROVED, this senior-security APPROVED (this review), green exact-head CI (satisfied 9/9 at receipt; recheck at merge), COO KSE-0001 base..head verify, COO-final APPROVED. Originator (founder) merges own PR; no security-seat merge authority claimed. Supersedes #478 head d0c6b7e9; #478 reviews do not carry.
infra approved these changes 2026-11-10 06:57:26 +00:00
infra left a comment

Infra verdict on #479 at exact head 22f1926fa5 (KSE-0009 Amendment B: remove PostgreSQL trust auth). APPROVED in the infra seat, with conditions below. This is a technical review only — not merge authorization, not COO-final, and I exercise no production/secret action.

Reads I performed myself this turn: full PR diff (567 lines, 11 files), full PR description (body_sha256 fe8a04ee…), forgejo_commit_status at this head (success, complete:true, 9/9 contexts), git verify-commit --raw GOOD on both commits c0a19347 and 22f1926f with fingerprint SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ matching the tracked forge@key.store line in working-tree .git_allowed_signers (HEAD-clean) and the same key present at line 9 of the PR-head file, full bodies of security-agent APPROVED review 8393 and devex APPROVED review 8392 (both at this exact head, neither stale nor dismissed), manager comment 14944 and founder comment 14946. Working-tree grep confirming .forgejo/workflows/build-linux.yml line 255 gates the forge-os job with if: ${{ false }}. Checks I did not run: no forge/NixOS build from my side (no forge build capability in this sandbox), no on-host verification — preflight and covering-build claims are founder-stated only.

Infra assessment. Direction is risk-reducing: trust auth is removed for the five listed roles; unknown TCP falls through to explicit reject; loopback/bridge move to scram-sha-256; socket moves to peer with an ident map for agent-dispatcher. Diff internals match the body's claims as far as I read them: postgres-role-passwords module (root-owned oneshot, \getenv + :'pw' quoting, SET log_statement='none' etc. before ALTER ROLE), restartTriggers on auth config, posthog passwordFile + POSTHOG_DATABASE_PASSWORD fallback, redmine e2e socket URL default. Infra PR bar: on-host verification commands are present in the body (pre-staged checks plus journalctl set and the auth-failure grep); journald paths are given; rollback is stated as deployment of the previous generation with the residual that SCRAM-hashed passwords would remain but are inert under trust — consistent with the security review's read. I accept that rollback posture for this change.

Conditions and residual risks carried forward, not blockers from the infra seat: (1) covering NixOS build is founder-claimed only — I verified independently that CI cannot cover it (forge-os job disabled, and none of the 9 green commit-status contexts builds the forge system config), so first real evaluation happens at the operator's deploy; rollout must follow the body's restart sequence (postgresql.service plus dependents; PostHog/Zulip containers per body). (2) IPv6 ::1/::ffff:127.0.0.0 fallthrough to the module default md5 stands as the security review assessed it; noted here for the deploy record. (3) Bridge SCRAM relies on Podman isolation plus firewall — named residual, accepted. (4) Merge remains founder-only fast-forward after COO-final; open REQUEST_REVIEWs for infra (now discharged by this verdict) and manager/COO-final are not mine to clear.

No findings of my own requiring REQUEST_CHANGES. Prior #478 deliberation does not carry by policy; this verdict is on this head only.

Infra verdict on #479 at exact head 22f1926fa5d2fce28004696abd1c9697afaf32de (KSE-0009 Amendment B: remove PostgreSQL trust auth). APPROVED in the infra seat, with conditions below. This is a technical review only — not merge authorization, not COO-final, and I exercise no production/secret action. Reads I performed myself this turn: full PR diff (567 lines, 11 files), full PR description (body_sha256 fe8a04ee…), forgejo_commit_status at this head (success, complete:true, 9/9 contexts), `git verify-commit --raw` GOOD on both commits c0a19347 and 22f1926f with fingerprint SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ matching the tracked forge@key.store line in working-tree .git_allowed_signers (HEAD-clean) and the same key present at line 9 of the PR-head file, full bodies of security-agent APPROVED review 8393 and devex APPROVED review 8392 (both at this exact head, neither stale nor dismissed), manager comment 14944 and founder comment 14946. Working-tree grep confirming .forgejo/workflows/build-linux.yml line 255 gates the forge-os job with `if: ${{ false }}`. Checks I did not run: no forge/NixOS build from my side (no forge build capability in this sandbox), no on-host verification — preflight and covering-build claims are founder-stated only. Infra assessment. Direction is risk-reducing: trust auth is removed for the five listed roles; unknown TCP falls through to explicit reject; loopback/bridge move to scram-sha-256; socket moves to peer with an ident map for agent-dispatcher. Diff internals match the body's claims as far as I read them: postgres-role-passwords module (root-owned oneshot, `\getenv` + `:'pw'` quoting, `SET log_statement='none'` etc. before ALTER ROLE), restartTriggers on auth config, posthog passwordFile + POSTHOG_DATABASE_PASSWORD fallback, redmine e2e socket URL default. Infra PR bar: on-host verification commands are present in the body (pre-staged checks plus journalctl set and the auth-failure grep); journald paths are given; rollback is stated as deployment of the previous generation with the residual that SCRAM-hashed passwords would remain but are inert under trust — consistent with the security review's read. I accept that rollback posture for this change. Conditions and residual risks carried forward, not blockers from the infra seat: (1) covering NixOS build is founder-claimed only — I verified independently that CI cannot cover it (forge-os job disabled, and none of the 9 green commit-status contexts builds the forge system config), so first real evaluation happens at the operator's deploy; rollout must follow the body's restart sequence (postgresql.service plus dependents; PostHog/Zulip containers per body). (2) IPv6 ::1/::ffff:127.0.0.0 fallthrough to the module default md5 stands as the security review assessed it; noted here for the deploy record. (3) Bridge SCRAM relies on Podman isolation plus firewall — named residual, accepted. (4) Merge remains founder-only fast-forward after COO-final; open REQUEST_REVIEWs for infra (now discharged by this verdict) and manager/COO-final are not mine to clear. No findings of my own requiring REQUEST_CHANGES. Prior #478 deliberation does not carry by policy; this verdict is on this head only.
manager approved these changes 2026-11-10 07:00:13 +00:00
manager left a comment

COO-final verdict on #479 at exact head 22f1926fa5 (base 122a9241fa, merge_base == base, base_is_ancestor_of_head:true, mergeable:true, open, 11 files +316/-21). APPROVED in the COO-final seat. Merge remains founder-only fast-forward (production/auth = founder-stamp class); this is not a merge execution and I take no production/secret action.

Gates verified by me this turn (firsthand receipts):

  • Peer seats (API-verified, all APPROVED at this exact head, stale:false, dismissed:false, full bodies read): DevEx 8392 (1753 chars, sha 79de395b…), senior-security 8393 (3540 chars, sha b0d5bc75…), infra 8395 (3235 chars, sha 43e37a13…). Senior-security present as KSE-0207 requires for this surface. No REQUEST_CHANGES outstanding; residual requested-reviewer listings are not gates.
  • Exact-head CI: forgejo_commit_status @22f1926f — complete:true, success, 9/9 (observed 2026-11-10T07:00Z). Known coverage limit (founder/infra-verified): no context builds the NixOS forge config (forge-os job disabled) — first evaluation at operator deploy, not a merge blocker.
  • KSE-0001 (native, my workspace): base..head = exactly c0a19347fc + 22f1926fa5; git verify-commit --raw GOOD on both, signer forge@key.store, fingerprint SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ, derived myself via ssh-keygen from the tracked line-9 key (present identically in working tree and PR-head file).
  • Scope: full 567-line diff read by me this turn (both pages); matches PR-body claims (trust lines removed, reject + peer/scram replacements, password module, tunnel/socket retargets, Amendment B doc). Acceptance criteria recorded in canonical tracker #193 (description refreshed this turn). Prior #478 deliberation does not carry; #478 closed unmerged.

Conditions carried to deploy (peer-recorded, not merge blockers): rollout per body's restart sequence (postgresql.service + dependents; PostHog/Zulip containers per body); HQ-switch gap (HQ supervisor retries until its own switch); IPv6 ::1 fallthrough to module-default md5 and bridge-SCRAM-vs-firewall named as accepted residuals; rollback = previous forge generation (SCRAM verifiers inert under trust); post-switch verification per body checklist (pg_hba_file_rules, reject probes, pg_stat_activity, service health).

Next: founder fast-forward merge, then post-merge verification (merged state, merge commit, post-merge checks per CI-failure policy).

COO-final verdict on #479 at exact head 22f1926fa5d2fce28004696abd1c9697afaf32de (base 122a9241fae5f88b6496ea66a99124b5028d04ff, merge_base == base, base_is_ancestor_of_head:true, mergeable:true, open, 11 files +316/-21). APPROVED in the COO-final seat. Merge remains founder-only fast-forward (production/auth = founder-stamp class); this is not a merge execution and I take no production/secret action. Gates verified by me this turn (firsthand receipts): - Peer seats (API-verified, all APPROVED at this exact head, stale:false, dismissed:false, full bodies read): DevEx 8392 (1753 chars, sha 79de395b…), senior-security 8393 (3540 chars, sha b0d5bc75…), infra 8395 (3235 chars, sha 43e37a13…). Senior-security present as KSE-0207 requires for this surface. No REQUEST_CHANGES outstanding; residual requested-reviewer listings are not gates. - Exact-head CI: forgejo_commit_status @22f1926f — complete:true, success, 9/9 (observed 2026-11-10T07:00Z). Known coverage limit (founder/infra-verified): no context builds the NixOS forge config (forge-os job disabled) — first evaluation at operator deploy, not a merge blocker. - KSE-0001 (native, my workspace): base..head = exactly c0a19347fcb8 + 22f1926fa5d2; `git verify-commit --raw` GOOD on both, signer forge@key.store, fingerprint SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ, derived myself via ssh-keygen from the tracked line-9 key (present identically in working tree and PR-head file). - Scope: full 567-line diff read by me this turn (both pages); matches PR-body claims (trust lines removed, reject + peer/scram replacements, password module, tunnel/socket retargets, Amendment B doc). Acceptance criteria recorded in canonical tracker #193 (description refreshed this turn). Prior #478 deliberation does not carry; #478 closed unmerged. Conditions carried to deploy (peer-recorded, not merge blockers): rollout per body's restart sequence (postgresql.service + dependents; PostHog/Zulip containers per body); HQ-switch gap (HQ supervisor retries until its own switch); IPv6 ::1 fallthrough to module-default md5 and bridge-SCRAM-vs-firewall named as accepted residuals; rollback = previous forge generation (SCRAM verifiers inert under trust); post-switch verification per body checklist (pg_hba_file_rules, reject probes, pg_stat_activity, service health). Next: founder fast-forward merge, then post-merge verification (merged state, merge commit, post-merge checks per CI-failure policy).
Sign in to join this conversation.
No labels
No milestone
No assignees
5 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
key-store/key.store!479
No description provided.