Skip to content

Commit

Permalink
Update ssl context construction for py3.12 compatibility (#72)
Browse files Browse the repository at this point in the history
* Update ssl context construction for py3.12 compatibility

* Update ssl context construction for py3.12 compatibility
  • Loading branch information
bdraco authored Sep 17, 2023
1 parent 849ad6c commit 25d2cb5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion elkm1_lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ def ssl_context_for_scheme(scheme: str) -> ssl.SSLContext:
Since ssl context is expensive to create, cache it
for future use since we only have a few schemes.
"""
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS)
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
if tls := TLS_VERSIONS.get(scheme):
ssl_context.minimum_version = tls
ssl_context.maximum_version = tls

ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE
ssl_context.set_ciphers("DEFAULT:@SECLEVEL=0")

# ssl.OP_LEGACY_SERVER_CONNECT is only available in Python 3.12a4+
Expand Down

0 comments on commit 25d2cb5

Please sign in to comment.