1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-24 02:04:09 +03:00

Small fix to requests sessions context creation

This commit is contained in:
Adolfo Gómez García 2023-04-03 22:53:32 +02:00
parent 31104c3fc2
commit 636b72a471
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23

View File

@ -60,12 +60,12 @@ def createClientSslContext(verify: bool = True) -> ssl.SSLContext:
if verify:
sslContext = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH, cafile=certifi.where())
else:
sslContext = (
ssl._create_unverified_context()
) # pylint: disable=protected-access
sslContext = ssl._create_unverified_context(purpose=ssl.Purpose.SERVER_AUTH, check_hostname=False)
# Disable TLS1.0 and TLS1.1
sslContext.options |= ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1
# Redundant, only use minimum_version
# sslContext.options |= ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1
sslContext.minimum_version = ssl.TLSVersion.TLSv1_2
return sslContext