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 -2
View File
@@ -28,8 +28,13 @@ change `async-attachments` (2, 6–8) и `pipeline-reliability` (1–9, 19). З
объявлять и удалять не может), relay — identity `relay` (объявляет свою очередь и публикует
через default exchange, получать не может); файлы — `secrets` сервиса и `BROKER__*_FILE`,
консоль — `make run_worker` / `make run_relay`. Проверка при старте — `client_tls_problems`
(код 2). Ключ `worker` в `/run/secrets` читает и процесс обработки того же UID — остаточное
(`container-hardening`, трек 5); окружение процесса обработки `BROKER__*` не получает.
(код 2). Ключ `worker` в `/run/secrets` читает и процесс обработки того же UID — остаточное,
закрывает трек 5 (`track1-worker-compromise`): разделить UID внутри контейнера можно только с
`CAP_SETUID` у worker или вынесением обработки в отдельный контейнер (design change
`container-hardening`, решение 10). Change `container-hardening` сужает, что даёт RCE в процессе
обработки: ни одной capability, `no-new-privileges`, корень только на чтение (запись — только
tmpfs `/tmp` 16m), предел процессов контейнера (`pids` 64); окружение процесса обработки
`BROKER__*` не получает.
- **Relay:** `python -m src.relay` → `src/relay/__main__.py` → `src/relay/main.py`
→ `AttachmentRelayService`. Свой engine (пул 1) и `JobPublisher`; S3 и Pillow
нет. Не в репликах (издатели и пароль у всех), не в worker (остановка worker на