summaryrefslogtreecommitdiff
path: root/kazoo/tests/test_partitioner.py
diff options
context:
space:
mode:
authorClark Boylan <clark.boylan@gmail.com>2023-02-05 00:36:16 -0800
committerGitHub <noreply@github.com>2023-02-05 00:36:16 -0800
commitbcc96850edca22f3b902af2a3a68026de4ca1a5c (patch)
tree5d89c31b1b05a9b29ad250410538f2dafead3582 /kazoo/tests/test_partitioner.py
parentd7c44cd14b63f08a6ac5be866831b631766427d4 (diff)
downloadkazoo-bcc96850edca22f3b902af2a3a68026de4ca1a5c.tar.gz
Cleanup SSL deprecation warnings under Python 3.10 and newer (#706)
Prior to this commit python would produce these warnings when using kazoo with ssl: /path/to/venv/lib/python3.11/site-packages/kazoo/handlers/utils.py:225: DeprecationWarning: ssl.PROTOCOL_TLS is deprecated context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) The reason for this is that ssl.PROTOCOL_SSLv23 is an alias for ssl.PROTOCOL_TLS and ssl.PROTOCOL_TLS is deprecated since Python 3.10. ssl.PROTOCOL_TLS was replaced with ssl.PROTOCOL_TLS_CLIENT and ssl.PROTOCOL_TLS_SERVER. In kazoo's case we switch to ssl.PROTOCOL_TLS_CLIENT as kazoo is acting as an ssl client to zookeeper servers. There are a few things to note. PROTOCOL_TLS_CLIENT enables context.check_hostname. We explicitly set this to False as this is required to set ssl.CHECK_NONE which kazoo supports, and not everyone may be using SSL certs with proper hostnames configured. For example if making connections to an IP address rather than a name and the certs don't have IP addrs in their altnames. This ensures backward compatibility with these use cases. Changing this should be done in a separate change and should likely be made configurable like verify_certs. Finally, while we are at it we replace ssl.CERT_OPTIONAL with ssl.CERT_REQUIRED as they are equivalent in a client context. This allows us to delete some code. Python documents all of these behaviors as being present since Python 3.6. Kazoo requires Python 3.7 or newer which should make this safe.
Diffstat (limited to 'kazoo/tests/test_partitioner.py')
0 files changed, 0 insertions, 0 deletions