Fix ssl DeprecationWarnings (#97623)

This commit is contained in:
Marc Mueller 2023-08-03 09:11:41 +02:00 committed by GitHub
parent 3c2cebea72
commit ad0873549d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 9 deletions

View file

@ -127,14 +127,9 @@ def server_context_modern() -> ssl.SSLContext:
Modern guidelines are followed.
"""
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.minimum_version = ssl.TLSVersion.TLSv1_2
context.options |= (
ssl.OP_NO_SSLv2
| ssl.OP_NO_SSLv3
| ssl.OP_NO_TLSv1
| ssl.OP_NO_TLSv1_1
| ssl.OP_CIPHER_SERVER_PREFERENCE
)
context.options |= ssl.OP_CIPHER_SERVER_PREFERENCE
if hasattr(ssl, "OP_NO_COMPRESSION"):
context.options |= ssl.OP_NO_COMPRESSION