feat: drop capabilities, run read-only and non-root in every container, mTLS for the S3 gRPC gateway

Every service of the stand gets the x-hardening anchor (cap_drop ALL,
no-new-privileges, read-only root) with an empty exception table, tmpfs
with size limits, pids limits by measurement and non-root users for
PostgreSQL, Valkey, RabbitMQ and SeaweedFS. The S3 gateway gRPC accepts
only mTLS with the stand CA. make hardening_check checks inspect data,
processes and listeners against the compose model; a fast test keeps the
override files from removing restrictions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-27 05:23:13 +03:00
co-authored by Claude Opus 5.5
parent 1f45bfe011
commit 157b878289
26 changed files with 2639 additions and 130 deletions
+7 -1
View File
@@ -211,7 +211,13 @@ bootstrap хранилищ без обхода», «Отрицательные
(`bench/bench.compose.yml`) повторяет их: список заменяется целиком. Valkey — `--port 0
--tls-port`, сертификат, CA, `tls-auth-clients no`, `tls-protocols "TLSv1.3"` в `valkey.conf`.
Шлюз S3 — `-s3.cert.file` / `-s3.key.file` без `-s3.port.https`: HTTP-порта API нет. gRPC шлюза
(`S3_PORT + 10000`) — без TLS, строка-исключение матрицы.
(`S3_PORT + 10000`) — с change `container-hardening` (design, решение 6) только mTLS:
`infra/s3/security.toml` — `[grpc] ca` стенда и `[grpc.s3]` с парой `s3`, сертификат клиента CA
стенда обязателен (без TLS, без сертификата и с сертификатом другого CA вызовы не доходят), а
административные вызовы ещё и требуют токен ключа подписи. Клиентов в сети у порта нет; filer
того же процесса толкает учётные записи на loopback без TLS и получает отказ — доставка идёт
подпиской (строка журнала — `docker.md`, раздел S3). Проверка — строки gRPC в `make s3_check`.
До change — без TLS, строка-исключение матрицы.
- **Клиенты — `[client_tls] ca_file`, проверка всегда.** Один построитель
`build_client_context` (`src/infra/tls/client.py`): `SSLContext(PROTOCOL_TLS_CLIENT)`, только
этот CA (без пути — ни одного доверенного CA, а не системное хранилище: `create_default_context`