feat: require TLS to PostgreSQL, Valkey and S3

Storage servers accept only TLS 1.3 (pg_hba hostssl / hostnossl reject,
Valkey port 0, S3 gateway HTTPS only) with stand identities postgres,
valkey and s3. Clients trust only the stand CA from [client_tls] ca_file
and check the host name; no switch to disable verification. Processes
exit with code 2 without a CA or with an IP storage address. Temporary
stands, CI and bench/ run on TLS storages; make storage_tls_check adds
negative checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 21:17:49 +03:00
co-authored by Claude Opus 5.5
parent 25f5d981c0
commit 8bca5543fd
56 changed files with 2562 additions and 176 deletions
+91
View File
@@ -26,9 +26,33 @@
# рабочем стенде. Нужен Compose ≥ 2.24 (!reset, !override; secrets из
# environment с uid / mode).
# С change storage-tls хранилища — только TLS: пары postgres, valkey, s3 — их
# сервисам с владельцем — пользователем процесса (postgres и valkey — 999, s3 —
# seaweed 1000; ключ 0400), CA — ещё s3-bootstrap (seaweed 1000) и клиентам на
# образе API (10001); pg_hba.conf — configs (bind mount в основном файле).
services:
postgres:
ports: !reset []
# !override: bind mount pg_hba.conf заменяет configs, volume данных остаётся
volumes: !override
- postgres_data:/var/lib/postgresql
configs:
- source: postgres_hba
target: /etc/postgresql/pg_hba.conf
secrets: !override
- source: ca.crt
uid: "999"
gid: "999"
mode: 0444
- source: postgres.crt
uid: "999"
gid: "999"
mode: 0444
- source: postgres.key
uid: "999"
gid: "999"
mode: 0400
valkey:
ports: !reset []
@@ -36,15 +60,46 @@ services:
configs:
- source: valkey_conf
target: /usr/local/etc/valkey/valkey.conf
secrets: !override
- source: ca.crt
uid: "999"
gid: "999"
mode: 0444
- source: valkey.crt
uid: "999"
gid: "999"
mode: 0444
- source: valkey.key
uid: "999"
gid: "999"
mode: 0400
s3:
ports: !reset []
secrets: !override
- source: ca.crt
uid: "1000"
gid: "1000"
mode: 0444
- source: s3.crt
uid: "1000"
gid: "1000"
mode: 0444
- source: s3.key
uid: "1000"
gid: "1000"
mode: 0400
s3-bootstrap:
volumes: !reset []
configs:
- source: s3_bootstrap
target: /opt/s3/bootstrap.sh
secrets: !override
- source: ca.crt
uid: "1000"
gid: "1000"
mode: 0444
rabbitmq:
ports: !reset []
@@ -61,6 +116,13 @@ services:
configs: &config-toml
- source: config_toml
target: /app/config.toml
# клиентам хранилищ — только CA стенда, владелец app (UID 10001); так же
# у cleaner, relay и worker (алиас YAML с тегом !override не разрешён)
secrets: !override
- source: ca.crt
uid: "10001"
gid: "10001"
mode: 0444
api:
image: *ci-image
@@ -89,16 +151,31 @@ services:
image: *ci-image
volumes: !reset []
configs: *config-toml
secrets: !override
- source: ca.crt
uid: "10001"
gid: "10001"
mode: 0444
relay:
image: *ci-image
volumes: !reset []
configs: *config-toml
secrets: !override
- source: ca.crt
uid: "10001"
gid: "10001"
mode: 0444
worker:
image: *ci-image
volumes: !reset []
configs: *config-toml
secrets: !override
- source: ca.crt
uid: "10001"
gid: "10001"
mode: 0444
haproxy:
ports: !reset []
@@ -184,6 +261,8 @@ configs:
environment: CI_S3_BOOTSTRAP
rabbitmq_conf:
environment: CI_RABBITMQ_CONF
postgres_hba:
environment: CI_POSTGRES_HBA
haproxy_cfg:
environment: CI_HAPROXY_CFG
haproxy_openssl_cnf:
@@ -220,3 +299,15 @@ secrets: !override
environment: CI_PKI_HAPROXY_PEM
ingress.pem:
environment: CI_PKI_INGRESS_PEM
postgres.crt:
environment: CI_PKI_POSTGRES_CRT
postgres.key:
environment: CI_PKI_POSTGRES_KEY
valkey.crt:
environment: CI_PKI_VALKEY_CRT
valkey.key:
environment: CI_PKI_VALKEY_KEY
s3.crt:
environment: CI_PKI_S3_CRT
s3.key:
environment: CI_PKI_S3_KEY