Отклонять чужой клиентский сертификат на handshake с API.

Внутренний hop ограничен TLS 1.2: без сертификата и с чужим CA соединение обрывается до HTTP. Отчёт фиксирует прошедшие smoke, mTLS, persistence и failover.
This commit is contained in:
2026-11-26 20:14:17 +03:00
parent 6d28606c63
commit 9de3b01659
7 changed files with 86 additions and 37 deletions
+4
View File
@@ -83,7 +83,11 @@ def _context() -> ssl.SSLContext:
cert = config.TLS_SERVER_CERT_FILE or config.TLS_CERT_FILE
key = config.TLS_SERVER_KEY_FILE or config.TLS_KEY_FILE
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
# TLS 1.3 in this OpenSSL finishes the handshake before the client
# certificate is checked, so a missing cert or a foreign CA still connects.
# TLS 1.2 rejects both during the handshake. Identity is checked after that.
context.minimum_version = ssl.TLSVersion.TLSv1_2
context.maximum_version = ssl.TLSVersion.TLSv1_2
context.load_cert_chain(cert, key)
context.load_verify_locations(config.TLS_CA_FILE)
context.verify_mode = ssl.CERT_REQUIRED