Skip to content

Conversation

@AaronAtDuo
Copy link
Contributor

Since TLS_PROTOCOL is itself deprecated, this is the suggested update. It does technically change the default behavior though:
https://docs.python.org/3/library/ssl.html#ssl.PROTOCOL_TLS_CLIENT

The protocol enables [CERT_REQUIRED](https://docs.python.org/3/library/ssl.html#ssl.CERT_REQUIRED) and [check_hostname](https://docs.python.org/3/library/ssl.html#ssl.SSLContext.check_hostname) by default.
~``

@AaronAtDuo
Copy link
Contributor Author

Also I need to rebase but we can start the discussion.

context.load_verify_locations(cafile=ca_certs)
else:
# Can't check hostnames if we're not requiring server certificates
context.check_hostname = False
Copy link
Contributor Author

@AaronAtDuo AaronAtDuo Jan 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PROTOCOL_TLS_CLIENT automatically makes check_hostname True (side note, that means PROTOCOL_SSLv23 and PROTOCOL_TLS don't?) but if we don't require certs, we obviously can't required hostname checking.

@AaronAtDuo
Copy link
Contributor Author

This would change the default behavior to start enforcing hostname verification when certificates are in use. Is that a concern?

@mbish
Copy link
Contributor

mbish commented Jan 25, 2023

yeah it is. We have a number of tests that disable cert validation

@AaronAtDuo
Copy link
Contributor Author

yeah it is. We have a number of tests that disable cert validation

and those are exactly the tests that failed until I added the line about disabling hostname verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants