Skip to content

Commit

Permalink
Do not use deprecated ssl.PROTOCOL_TLS
Browse files Browse the repository at this point in the history
This has been deprecated in Python 3.10[1] and will be removed in the
future.

[1] https://docs.python.org/3/library/ssl.html#ssl.PROTOCOL_TLS
  • Loading branch information
CyrilRoelandteNovance committed Jul 31, 2024
1 parent 18ca4fd commit c65f09d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion salt/transport/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,13 +441,14 @@ def ssl_context(ssl_options, server_side=False):
backwards compatability older ssl config settings but adds verify_locations
and verify_flags options.
"""
default_version = ssl.PROTOCOL_TLS
if server_side:
default_version = ssl.PROTOCOL_TLS_SERVER
purpose = ssl.Purpose.CLIENT_AUTH
elif server_side is not None:
default_version = ssl.PROTOCOL_TLS_CLIENT
purpose = ssl.Purpose.SERVER_AUTH
else:
raise ValueError("server_side must be True or False")
# Use create_default_context to start with what Python considers resonably
# secure settings.
context = ssl.create_default_context(purpose)
Expand Down

0 comments on commit c65f09d

Please sign in to comment.