- Veröffentlicht
- 13.10.2026 11:15
- Zuletzt geändert
- 13.10.2026
- EPSS (30 Tage)
- unbekannt
- CVSS-Vektor
- CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
Beschreibung
Originaltext der Quelle, nicht übersetzt.
Before commit `67902b5b415c`, every PostgreSQL example in the docs and chart used `sslmode=require`, which in pgdriver encrypts the connection but skips certificate verification. The verifying alternative, `sql_tls_ca_file`, failed every handshake because the TLS config never got a `ServerName`. An operator who followed the docs had no working way to authenticate the database through `sql_tls_ca_file`, and each replica reads the CA key over that connection at startup.
Found in an independent audit at `fb856f1` and re-checked against `main` at `145cb53` with `github.com/uptrace/bun/driver/pgdriver v1.2.18`.
## Where
Line numbers are as of `145cb53`, before the fix.
- `internal/storage/sql.go:252-254` passed `pgdriver.WithDSN(cfg.DSN)`, then added `pgdriver.WithTLSConfig(cfg.TLS)` when any `sql_tls_*_file` was set.
- In pgdriver v1.2.18, the default config has `InsecureSkipVerify: true` (`config.go:67`), and `sslmode=require` without `sslrootcert` keeps it (`config.go:311-313`). That matches libpq's meaning of `require`.
- `WithTLSConfig` replaces the driver's TLS config wholesale (`config.go:125-128`) and runs after `WithDSN`, so any `ServerName` derived from the DSN was lost.
- `loadBackendTLS` (`internal/storage/spec.go:334`) built `&tls.Config{MinVersion: tls.VersionTLS12}` with `RootCAs` but no `ServerName`. pgdriver hands it to `tls.Client` on the open socket (`proto.go:127`), and crypto/tls refuses: "either ServerName or InsecureSkipVerify must be set".
- `sslmode=require` examples: `docs/storage-backends.md:651,669`, `docs/helm-chart.md:122`, `charts/openvox-ca/values.yaml:363`, `charts/openvox-ca/ci/postgres-ha-values.yaml:53`. `docs/storage-backends.md:664` presented `require` as the DSN way to get TLS.
No test exercised `sql_tls_ca_file` against a real server. MySQL and Redis set or infer `ServerName` and aren't affected.
## Reproduction
On a build before the fix, set `sql_tls_ca_file` to the server's CA and connect to a TLS-enabled PostgreSQL. Startup fails with the crypto/tls error above. With the documented `sslmode=require` DSN instead, the connection succeeds against a server presenting any certificate.
## Impact
An attacker who can get on path on the database network (shared segment, compromised sidecar, cloud network misconfiguration) can impersonate the database. At startup each replica reads `ca_key` (plaintext unless `encrypt_ca_key` is on), the inventory HMAC key, the CRL and every certificate. The attacker can read the CA key, or feed back a forged CRL and inventory.
## Fix
Fixed on `main` on 2026-10-13 in commit [`67902b5b415c81d7535338c74e73a7f3e2d410fa`](https://github.com/voxpupuli/openvox-ca/commit/67902b5b415c81d7535338c74e73a7f3e2d410fa) (PR #479, closes #475), Go module version `v0.0.0-20261013085950-67902b5b415c`. The PostgreSQL backend now follows libpq: `sslmode` decides how the server is checked, and the `sql_tls_*_file` settings only supply the certificates.
- `sslmode=verify-full`, with the CA given either as `sslrootcert` in the DSN or as `sql_tls_ca_file`, authenticates the server by chain and host name. `ServerName` is now set from the host actually dialled (the DSN host, `host=`, or `PGHOST`), so `sql_tls_ca_file` completes its handshake.
- `verify-ca`, and `require` with a CA, check the chain only, as libpq does.
- With `sql_tls_*` files set, startup is refused if `sslmode` is `disable`, `allow`, `prefer` or missing, or if the DSN also sets `sslrootcert`, `sslcert` or `sslkey`.
- The docs, chart values and the HA fixture now use `verify-full`, and say plainly that `require` alone does not verify the server.
- `postgres_integration` specs connect through `sql_tls_ca_file`, and refuse a server whose certificate is untrusted or issued for another host.
## What to do
Move to a build that includes `67902b5b415c` (2026-10-13 or later), and change any `sslmode=require` DSN to `sslmode=verify-full&sslrootcert=/path/to/ca.pem`, or set `sql_tls_ca_file` with `sslmode=verify-full`.
Until you can upgrade, put `sslmode=verify-full&sslrootcert=...` in the DSN and leave the `sql_tls_*` settings unset; earlier builds already authenticate the server that way.
Betroffene Pakete im beobachteten Stack
Gogithub.com/voxpupuli/openvox-ca0.0.0-20261013085950-67902b5b415cGHSA-xxmp-x77j-mc26
Empfohlene Prüfung
- Feststellen, ob und in welcher Version die betroffenen Pakete in Ihren Systemen, Images und Abhängigkeiten vorkommen.
- Wo eine Fix-Version genannt ist: aktualisieren. Wo nicht: Hersteller-Advisory und Referenzen auf Workarounds prüfen.
- Erreichbarkeit beachten: Der Angriffsweg (Nachbarnetz) ist aus dem CVSS-Vektor abgeleitet.
Diese Seite sagt nichts darüber, ob Ihre Systeme betroffen sind. Das klärt erst eine Prüfung Ihrer Versionen.