Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate default TLS ciphers for pyOpenSSL #2090

Closed
sethmlarson opened this issue Nov 24, 2020 · 7 comments · Fixed by #2082
Closed

Investigate default TLS ciphers for pyOpenSSL #2090

sethmlarson opened this issue Nov 24, 2020 · 7 comments · Fixed by #2082
Milestone

Comments

@sethmlarson
Copy link
Member

#2082 makes system ciphers the default with stdlib SSLContext implementation. Can we take a similar approach with pyOpenSSL or should we still rely on urllib3's default list?

If we're relying on urllib3's default list we only need to make pyopenssl.inject_into_urllib3() set USE_SYSTEM_SSL_CIPHERS to False unconditionally.

cc @tiran @alex

@sethmlarson sethmlarson added this to the v2.0 milestone Nov 24, 2020
@sethmlarson sethmlarson changed the title Investigate default TLS Ciphers for pyOpenSSL Investigate default TLS ciphers for pyOpenSSL Nov 24, 2020
@alex
Copy link
Contributor

alex commented Nov 24, 2020

pyOpenSSL doesn't provide its own default list, so it's a matter of whether you're happy with OpenSSL's defaults (across a wide variety of OpenSSL, naturally).

My memory of "which OpenSSL versions have acceptable defaults" is kind of hazy, so I don't have a better suggestion than to flip the setting, and hit https://www.howsmyssl.com/s/api.html from a few different linux distros with different OpenSSL versions and see if the settings look ok.

@sethmlarson
Copy link
Member Author

@alex Thanks for the reply, it looks like the best way to determine the OpenSSL version of pyOpenSSL to use cryptography.hazmat.backends.openssl.backend.backend.openssl_version_number().

We're planning on using OpenSSL-configured defaults on OpenSSL 1.1.1+, so would be >= 0x10101000

@tiran
Copy link
Contributor

tiran commented Nov 25, 2020

Caution, >= 0x10101000 is no good with LibreSSL. It always reports OpenSSL version 0x20000000.

@sethmlarson
Copy link
Member Author

@tiran Yikes, is there a canonical way to detect OpenSSL & v1.1.1+?

@tiran
Copy link
Contributor

tiran commented Nov 25, 2020

IS_LIBRESSL = ssl.OPENSSL_VERSION.startswith('LibreSSL')
IS_OPENSSL_1_1_1 = not IS_LIBRESSL and ssl.OPENSSL_VERSION_INFO >= (1, 1, 1)

@sethmlarson
Copy link
Member Author

sethmlarson commented Nov 25, 2020

@tiran Instead of filtering out LibreSSL should we instead only use OpenSSL? ssl.OPENSSL_VERSION.startswith("OpenSSL")?

@tiran
Copy link
Contributor

tiran commented Nov 25, 2020

IMO it makes more sense to special case LibreSSL as they decided to redefine OPENSSL_VERSION_NUMBER. CPython code and PyCA cryptography code have been checking for either LIBRESSL_VERSION_NUMBER C macro or ssl.OPENSSL_VERSION.startswith('LibreSSL') for years, too.

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 a pull request may close this issue.

3 participants