Connect from libpq service files and match the real Secret layout

The maintainer's login Secrets carry pg_service.conf ([evolution]),
pgpass and ca.crt. Add a strict read_pg_service (known keys only,
verify-full unless a local socket, bounded size) behind --pg-service in
evo-server and evo-world-clone, mount each login Secret whole in the
store Jobs instead of reading aevolution-db, and fix the migrate Job's
PGSERVICE to the [evolution] section. Record the store node choice,
per-environment databases and the backup plan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-09-29 14:12:26 -04:00
co-authored by Claude Opus 5.5
parent 2d950060db
commit 8d594f28af
12 changed files with 221 additions and 31 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ names it. Remove an item only when it is done, and record where it was done.
| Item | Raised | Why deferred | Needed before |
|---|---|---|---|
| **World0 break-glass membership.** Decide who may act as `aevolution:world0-break-glass`, and how that group is granted: for example a short-lived client certificate with that organization, or an OIDC group. Decide also how its use is approved and recorded. The admission policy already enforces the group (ADR-0069). | M8.2, 2026-09-29 | Maintainer: figure out later | Any intentional deletion of World0 data or identity; M8.8 World0 launch |
| **Backup destination for dev/stage stores.** Decide where backups go: the AEvolution PostgreSQL VM (WAL archive or base backups) and each environment's `aevolution-objects` volume. It should be off the host for any claim beyond disposable environments. | M8.3, 2026-09-29 | Needs the maintainer's choice of target | M8.7 backup and restore; any World0 data |
| **Backup destination for dev/stage stores.** There are no backups yet (maintainer, 2026-09-29). The plan is to build backup tooling for the AEvolution PostgreSQL VM and each `aevolution-objects` volume up to a pluggable destination, then add the destination. It must be off the host for anything beyond disposable environments. | M8.3, 2026-09-29 | The maintainer will supply a destination later | M8.7 backup and restore; any World0 data |
| **Storage after the RAID/disk rework.** Re-run `deploy/kubernetes/inventory/disk-probe-local-path.yaml` (or a new class), and update INVENTORY.md. | M8.1, 2026-09-29 | Maintainer is reorganizing disks | M8.3's final storage decision |
## Accepted risks (maintainer decisions)
+29
View File
@@ -2728,3 +2728,32 @@ admission policy and the stage and World0 AppProjects, then ran
tool's usage exit. It has not been built locally, because Docker is not running.
- Not executed: anything in the cluster, the store Jobs, retention, rebind and
rotation evidence, and the image build.
## M8.3 service-file connections - 2026-09-29
- The maintainer's dev Secrets have the keys `ca.crt`, `pg_service.conf`
(section `[evolution]`) and `pgpass`, with no `user` key. The values were
pasted into the conversation, so both passwords must be rotated. That rotation
is also the M8.3 credential-rotation evidence step. The values are not recorded
anywhere in the repository.
- `read_pg_service` and `--pg-service` were added to `evo-server` and
`evo-world-clone`.
- Parser tests: a valid file with another section and CRLF lines parses. The
parser refuses:
- `password`, `passfile` and `options` keys;
- `sslmode=require`;
- a repeated key or a repeated section;
- a non-numeric timeout;
- malformed lines;
- a missing section;
- a file over 4 KiB;
- a missing file.
`sslmode=disable` is accepted only for a local socket.
- `check-store --pg-service` against the local cluster verified the probe and the
privilege boundary.
- The store Jobs now mount each login Secret whole (service file, password file,
CA) and no longer read `aevolution-db`. The migrate Job's `PGSERVICE` is now
`evolution`; the previous `evolution-migrator` did not match the maintainer's
file.
- PostgreSQL Release and ASan/UBSan passed. The analysis build passed after one
loop copy was fixed. Deploy policy: 0 failures.
+22 -6
View File
@@ -18,15 +18,30 @@ manual, and none is performed by Argo CD.
## Secret references (created by an operator, never committed)
Each environment has its own **database**: dev uses `aevolution` on the PostgreSQL
VM `pg-forge-01`. Stage needs a separate database, with its own migrator login and
runtime group. Sharing one database would let one environment's runtime login act
on the other's regions, because the fenced functions are per database, not per
environment.
Each namespace gets its own Secrets, with environment-specific values:
- `harbor-pull`: a pull-only Harbor robot (docker-registry type).
- `evolution-postgres-migrator`: the migrator/owner login for that environment's
database. Keys: `pg_service.conf`, `pgpass`, `ca.crt`.
database.
- `evolution-postgres-runtime`: the runtime login, a member of that environment's
NOLOGIN runtime group (ADR-0060). Keys: `user`, `pgpass`, `ca.crt`.
- `aevolution-db`: connection settings. Only `PGHOST`, `PGHOSTADDR` (numeric),
`PGPORT` and `PGDATABASE` are ever read, as individual variables. `PGPASSWORD`
and `PGUSER` are never mounted; the policy check forbids it.
NOLOGIN runtime group (ADR-0060).
Both login Secrets have the keys `pg_service.conf`, `pgpass` and `ca.crt`:
- `pg_service.conf` has an `[evolution]` section with `host`, a numeric
`hostaddr`, `port`, `dbname`, `user`, `sslmode=verify-full` and
`sslrootcert=/run/postgres/ca.crt`. `connect_timeout` is allowed. `evo-server`
and `evo-world-clone` read it with `--pg-service` and refuse any other key.
- `pgpass` is mounted, then copied to private memory before use, because libpq
ignores group-readable password files.
`aevolution-db` (the `PG*`/`POSTGRES_*` connection variables) is not used by
AEvolution workloads. `PGPASSWORD` and `PGUSER` are never placed in a container
environment, and the policy check forbids it.
A World0 credential must never exist in the dev or stage namespaces, and no dev or
stage credential may reach the World0 database. Rotate by replacing the Secret and
@@ -58,7 +73,8 @@ Run this once per disposable environment (`dev`, then `stage`).
**1. Label the store node, and apply the storage class and claim.**
```sh
# Label exactly one worker (worker-1 or worker-2; never worker-3 or the control plane).
# Label exactly one worker. The maintainer allows any worker (never the control plane);
# worker-1 is chosen (lowest measured latency; worker-3's disk is 87 % full).
kubectl label node rke2-worker-1 aevolution.io/stores=true
kubectl apply -f deploy/kubernetes/platform/storage/storageclass.yaml
kubectl apply -k deploy/kubernetes/platform/dev # adds the aevolution-objects claim
+1 -1
View File
@@ -191,7 +191,7 @@ epoch.
Create Secret **evolution-postgres-migrator** in evolution-dev outside Git. Keys:
`pg_service.conf`, `pgpass`, `ca.crt`. The service file has section
`[evolution-migrator]` with host, numeric hostaddr, port, dbname, user,
`[evolution]` (the same section name in every login Secret, M8.3) with host, numeric hostaddr, port, dbname, user,
sslmode=verify-full, sslrootcert=/run/postgres/ca.crt and connect_timeout=5.
pgpass uses libpq's escaped host:port:database:user:password format. Do not paste
values into chat, manifests or image arguments. Configure cluster Secret RBAC and