forked from mtusi2026/mtusi2026lab7
feat: require mTLS with certificate login for RabbitMQ and split relay and worker rights
Broker accepts only TLS 1.3 with a client certificate checked against the stand CRL; login is EXTERNAL by certificate DNS SAN, broker passwords are gone. Relay may declare its queue and publish, worker may only consume. Definitions and TLS material checks come from infra/rabbitmq/start.sh; temporary stands, CI, bench and the fault hook use the same mTLS identities. Adds make broker_mtls_check [REPORT=1] and drops the rollback broker compose. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+73
-1
@@ -105,14 +105,41 @@ services:
|
||||
gid: "1000"
|
||||
mode: 0444
|
||||
|
||||
# брокер (change messaging-telemetry-mtls, design, решение 9): четыре файла
|
||||
# конфигурации — configs (entrypoint sh читает start.sh, исполняемый бит не
|
||||
# нужен), tmpfs /run/rabbitmq — из основного файла; пара rabbitmq — владелец
|
||||
# rabbitmq (999), ключ 0400 (start.sh от root копирует её в tmpfs)
|
||||
rabbitmq:
|
||||
ports: !reset []
|
||||
# !override: bind mount конфига заменяют configs, volume данных остаётся
|
||||
# !override: bind mount конфигов заменяют configs, volume данных остаётся
|
||||
volumes: !override
|
||||
- rabbitmq_data:/var/lib/rabbitmq
|
||||
configs:
|
||||
- source: rabbitmq_conf
|
||||
target: /etc/rabbitmq/conf.d/90-messenger.conf
|
||||
- source: rabbitmq_advanced
|
||||
target: /etc/rabbitmq/advanced.config
|
||||
- source: rabbitmq_plugins
|
||||
target: /etc/rabbitmq/enabled_plugins
|
||||
- source: rabbitmq_start
|
||||
target: /opt/rabbitmq-start/start.sh
|
||||
secrets: !override
|
||||
- source: ca.crt
|
||||
uid: "999"
|
||||
gid: "999"
|
||||
mode: 0444
|
||||
- source: crl.pem
|
||||
uid: "999"
|
||||
gid: "999"
|
||||
mode: 0444
|
||||
- source: rabbitmq.crt
|
||||
uid: "999"
|
||||
gid: "999"
|
||||
mode: 0444
|
||||
- source: rabbitmq.key
|
||||
uid: "999"
|
||||
gid: "999"
|
||||
mode: 0400
|
||||
|
||||
migrate:
|
||||
image: &ci-image mtusi-messenger:${CI_IMAGE_TAG:?CI_IMAGE_TAG is not set}
|
||||
@@ -173,6 +200,8 @@ services:
|
||||
gid: "10001"
|
||||
mode: 0444
|
||||
|
||||
# relay и worker (change messaging-telemetry-mtls): CA, CRL и своя пара
|
||||
# identity у брокера, владелец app (10001), ключ 0400
|
||||
relay:
|
||||
image: *ci-image
|
||||
volumes: !reset []
|
||||
@@ -182,6 +211,18 @@ services:
|
||||
uid: "10001"
|
||||
gid: "10001"
|
||||
mode: 0444
|
||||
- source: crl.pem
|
||||
uid: "10001"
|
||||
gid: "10001"
|
||||
mode: 0444
|
||||
- source: relay.crt
|
||||
uid: "10001"
|
||||
gid: "10001"
|
||||
mode: 0444
|
||||
- source: relay.key
|
||||
uid: "10001"
|
||||
gid: "10001"
|
||||
mode: 0400
|
||||
|
||||
worker:
|
||||
image: *ci-image
|
||||
@@ -192,6 +233,18 @@ services:
|
||||
uid: "10001"
|
||||
gid: "10001"
|
||||
mode: 0444
|
||||
- source: crl.pem
|
||||
uid: "10001"
|
||||
gid: "10001"
|
||||
mode: 0444
|
||||
- source: worker.crt
|
||||
uid: "10001"
|
||||
gid: "10001"
|
||||
mode: 0444
|
||||
- source: worker.key
|
||||
uid: "10001"
|
||||
gid: "10001"
|
||||
mode: 0400
|
||||
|
||||
haproxy:
|
||||
ports: !reset []
|
||||
@@ -279,6 +332,12 @@ configs:
|
||||
environment: CI_S3_BOOTSTRAP
|
||||
rabbitmq_conf:
|
||||
environment: CI_RABBITMQ_CONF
|
||||
rabbitmq_advanced:
|
||||
environment: CI_RABBITMQ_ADVANCED
|
||||
rabbitmq_plugins:
|
||||
environment: CI_RABBITMQ_PLUGINS
|
||||
rabbitmq_start:
|
||||
environment: CI_RABBITMQ_START
|
||||
postgres_hba:
|
||||
environment: CI_POSTGRES_HBA
|
||||
haproxy_cfg:
|
||||
@@ -329,3 +388,16 @@ secrets: !override
|
||||
environment: CI_PKI_S3_CRT
|
||||
s3.key:
|
||||
environment: CI_PKI_S3_KEY
|
||||
# брокер и его клиенты (change messaging-telemetry-mtls)
|
||||
rabbitmq.crt:
|
||||
environment: CI_PKI_RABBITMQ_CRT
|
||||
rabbitmq.key:
|
||||
environment: CI_PKI_RABBITMQ_KEY
|
||||
relay.crt:
|
||||
environment: CI_PKI_RELAY_CRT
|
||||
relay.key:
|
||||
environment: CI_PKI_RELAY_KEY
|
||||
worker.crt:
|
||||
environment: CI_PKI_WORKER_CRT
|
||||
worker.key:
|
||||
environment: CI_PKI_WORKER_KEY
|
||||
|
||||
+16
-1
@@ -14,12 +14,17 @@ CI_HAPROXY_CFG="$(cat infra/haproxy/haproxy.cfg)$nl"
|
||||
# TLS 1.3 на ingress)
|
||||
CI_HAPROXY_OPENSSL_CNF="$(cat infra/haproxy/openssl.cnf)$nl"
|
||||
CI_RABBITMQ_CONF="$(cat infra/rabbitmq/rabbitmq.conf)$nl"
|
||||
# TLS, плагины и скрипт старта брокера (change messaging-telemetry-mtls)
|
||||
CI_RABBITMQ_ADVANCED="$(cat infra/rabbitmq/advanced.config)$nl"
|
||||
CI_RABBITMQ_PLUGINS="$(cat infra/rabbitmq/enabled_plugins)$nl"
|
||||
CI_RABBITMQ_START="$(cat infra/rabbitmq/start.sh)$nl"
|
||||
# pg_hba.conf стенда (change storage-tls): по сети — только TLS
|
||||
CI_POSTGRES_HBA="$(cat infra/postgres/pg_hba.conf)$nl"
|
||||
# скрипт старта Valkey с файлом ACL (change storage-roles)
|
||||
CI_VALKEY_START="$(cat infra/valkey/start.sh)$nl"
|
||||
export CI_CONFIG_TOML CI_VALKEY_CONF CI_S3_BOOTSTRAP CI_HAPROXY_CFG \
|
||||
CI_HAPROXY_OPENSSL_CNF CI_RABBITMQ_CONF CI_POSTGRES_HBA CI_VALKEY_START
|
||||
CI_HAPROXY_OPENSSL_CNF CI_RABBITMQ_CONF CI_POSTGRES_HBA CI_VALKEY_START \
|
||||
CI_RABBITMQ_ADVANCED CI_RABBITMQ_PLUGINS CI_RABBITMQ_START
|
||||
# наблюдаемость (design change otel-telemetry, решение 20)
|
||||
CI_OTEL_COLLECTOR="$(cat infra/otel/collector.yaml)$nl"
|
||||
CI_PROMETHEUS_YML="$(cat infra/otel/prometheus/prometheus.yml)$nl"
|
||||
@@ -57,6 +62,16 @@ CI_PKI_S3_CRT="$(cat "$ci_pki_dir/s3.crt")$nl"
|
||||
CI_PKI_S3_KEY="$(cat "$ci_pki_dir/s3.key")$nl"
|
||||
export CI_PKI_POSTGRES_CRT CI_PKI_POSTGRES_KEY CI_PKI_VALKEY_CRT \
|
||||
CI_PKI_VALKEY_KEY CI_PKI_S3_CRT CI_PKI_S3_KEY
|
||||
# брокер и его клиенты (change messaging-telemetry-mtls): пары rabbitmq, relay,
|
||||
# worker
|
||||
CI_PKI_RABBITMQ_CRT="$(cat "$ci_pki_dir/rabbitmq.crt")$nl"
|
||||
CI_PKI_RABBITMQ_KEY="$(cat "$ci_pki_dir/rabbitmq.key")$nl"
|
||||
CI_PKI_RELAY_CRT="$(cat "$ci_pki_dir/relay.crt")$nl"
|
||||
CI_PKI_RELAY_KEY="$(cat "$ci_pki_dir/relay.key")$nl"
|
||||
CI_PKI_WORKER_CRT="$(cat "$ci_pki_dir/worker.crt")$nl"
|
||||
CI_PKI_WORKER_KEY="$(cat "$ci_pki_dir/worker.key")$nl"
|
||||
export CI_PKI_RABBITMQ_CRT CI_PKI_RABBITMQ_KEY CI_PKI_RELAY_CRT \
|
||||
CI_PKI_RELAY_KEY CI_PKI_WORKER_CRT CI_PKI_WORKER_KEY
|
||||
|
||||
# готовность стенда через LB: /health/ready отвечает 200 от API_REPLICAS
|
||||
# (из .env, по умолчанию 2) разных реплик — X-Instance-Id. Срок 60 с:
|
||||
|
||||
Reference in New Issue
Block a user