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:
2026-11-19 21:34:47 +03:00
co-authored by Claude Opus 5.5
parent 2474e4cb28
commit 8236027e92
52 changed files with 3888 additions and 243 deletions
+11 -2
View File
@@ -36,7 +36,7 @@ from src.core import exceptions
from src.core.services.attachment_relay import AttachmentRelayService
from src.core.services.attachment_replay import AttachmentReplayService
from src.infra import early_stop, telemetry
from src.infra.broker import JobPublisher
from src.infra.broker import JobPublisher, broker_context
from src.infra.db import create_engine, create_session_factory
from src.infra.db.uow import SqlAlchemyUnitOfWork
from src.infra.logger import AbstractLogger, get_logger
@@ -194,7 +194,16 @@ async def run() -> int:
)
telemetry.instrument_engine(engine)
session_factory = create_session_factory(engine)
publisher = JobPublisher(settings.broker, namespace=namespace)
# контекст mTLS — один раз при старте: CA, CRL и пара читаются при старте
# процесса (change messaging-telemetry-mtls, «Уточнения apply», п. 14)
publisher = JobPublisher(
settings.broker,
namespace=namespace,
context=broker_context(
settings.broker,
ca_file=settings.client_tls.ca_file,
),
)
service = AttachmentRelayService(
uow=SqlAlchemyUnitOfWork(
session_factory,