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
+6 -3
View File
@@ -2,7 +2,10 @@
# Старт брокера стенда (change messaging-telemetry-mtls, design, решения 5, 7, 9;
# правило .claude/rules/tls.md, раздел брокера).
#
# От root до entrypoint образа:
# От пользователя rabbitmq (с change container-hardening — `user: "999:999"`
# сервиса, ни одного шага от root, без capabilities, корень только на чтение;
# tmpfs /run/rabbitmq с владельцем 999 — chown и chmod на себя capability не
# требуют), до entrypoint образа:
# 1. проверки окружения: RABBITMQ_QUEUE_NAMESPACE (имя базы, ^[a-z0-9_]+$),
# RABBITMQ_PORT, tmpfs /run/rabbitmq;
# 2. проверка материалов TLS openssl образа: сертификат и ключ брокера
@@ -19,8 +22,8 @@
# тегов, их права (relay — объявить свою очередь и публиковать через
# default exchange, worker — только получать), рабочая очередь (classic,
# durable, без аргументов — как её объявляет код);
# 5. exec docker-entrypoint.sh rabbitmq-server (сервер — от пользователя
# rabbitmq).
# 5. exec docker-entrypoint.sh rabbitmq-server (не от root entrypoint образа
# gosu не вызывает: сервер — от того же пользователя rabbitmq).
# Ошибка — код 1 и строка с именем файла или переменной без содержимого.
#
# `sh start.sh --print-definitions` — только определения в stdout (проверка