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
bpo-31429: Define TLS cipher suite on build time #3532
Conversation
Is there any way I can help move this forward? |
I'm not yet sure this patch can land in 3.7. LibreSSL is messing up my plans. |
c111937
to
4f4c506
Compare
This PR can be merged after #3462 has landed or we forcefully unsupport OpenSSL < 1.0.2. |
4f4c506
to
b33e892
Compare
fddbdb2
to
236097d
Compare
@ned-deily Fedora upstream would love have this PR in 3.7. It's also going to make your life as 3.7 security maintainer easier. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok minus these comments, but I'm not really qualified to review configure changes.
Lib/ssl.py
Outdated
@@ -531,7 +489,7 @@ def create_default_context(purpose=Purpose.SERVER_AUTH, *, cafile=None, | |||
context.verify_mode = CERT_REQUIRED | |||
context.check_hostname = True | |||
elif purpose == Purpose.CLIENT_AUTH: | |||
context.set_ciphers(_RESTRICTED_SERVER_CIPHERS) | |||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just remove this elif
block entirely :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1 @@ | |||
[WIP] Add --with-ssl-default-suites |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably needs the WIP removed :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I forgot to update the old blurb. I have created a new one and also added 3.7 whatsnew.
Modules/_ssl.c
Outdated
@@ -74,6 +74,10 @@ static PySocketModule_APIObject PySocketModule; | |||
# endif | |||
#endif | |||
|
|||
#if OPENSSL_VERSION_NUMBER < 0x1000200fL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still needed after the other change to require 1.0.2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, I added it for doubleplusgood paranoia reasons and just removed it.
ed16875
to
724de80
Compare
Until now Python used a hard coded white list of default TLS cipher suites. The old approach has multiple downsides. OpenSSL's default selection was completely overruled. Python did neither benefit from new cipher suites (ChaCha20, TLS 1.3 suites) nor blacklisted cipher suites. For example we used to re-enable 3DES. Python now defaults to OpenSSL DEFAULT cipher suite selection and black lists all unwanted ciphers. Downstream vendors can override the default cipher list with --with-ssl-default-suites. Signed-off-by: Christian Heimes <christian@python.org>
724de80
to
ea6427f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks both fine and useful to me.
@tiran: Please replace |
Based off of python/cpython#3532, we use OpenSSL's default cipher list and turn of things we don't like. This can't be used with 1.0.1, however, which had a poor default set. There, we use the old defaults, with the bits that aren't implemented in 1.0.1 removed (namely TLSv1.3 suites and ChaCha).
Based off of python/cpython#3532, we use OpenSSL's default cipher list and turn of things we don't like. This can't be used with 1.0.1, however, which had a poor default set. There, we use the old defaults, with the bits that aren't implemented in 1.0.1 removed (namely TLSv1.3 suites and ChaCha).
Until now Python used a hard coded white list of default TLS cipher
suites. The old approach has multiple downsides. OpenSSL's default
selection was completely overruled. Python did neither benefit from new
cipher suites (ChaCha20, TLS 1.3 suites) nor blacklisted cipher suites.
For example we used to re-enable 3DES.
Python now defaults to OpenSSL DEFAULT cipher suite selection and black
lists all unwanted ciphers. Downstream vendors can override the default
cipher list with --with-ssl-default-suites.
Signed-off-by: Christian Heimes christian@python.org
https://bugs.python.org/issue31429