forked from mtusi2026/mtusi2026lab7
Отклонять чужой клиентский сертификат на handshake с API.
Внутренний hop ограничен TLS 1.2: без сертификата и с чужим CA соединение обрывается до HTTP. Отчёт фиксирует прошедшие smoke, mTLS, persistence и failover.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user