-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Use SecureTransport on macOS #4454
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
Conversation
|
So as a note, you may not want to ship this slightly-bastardised Requests in a production version of pip. I'm hoping to get a version of Requests containing the relevant code out this week or next, though it naturally will not be enabled by default. Other than that, I think you've outlined the two best choices for how to handle this on macOS. I can't help the pip team make the choice between them really. I'm just excited to see this progress! |
|
Yea, this is just a temporary thing to allow folks to test it easier on their own machines. |
3ecbbb7 to
32e6231
Compare
|
I think I'm leaning towards only enabling this if we need to, ideally at some point macOS fixes it's system Python so that it can speak TLSv1.2 (this reason we need this) natively with the |
|
I'd also vote for the "only if needed" option, as that means folks will only end up running the new code in cases where the system OpenSSL would have broken entirely, and will otherwise stick to the better tested OpenSSL based implementation. Preferring SecureTransport by default on Mac OS X would then happen whenever the standard library itself is updated to do that, rather than pip having to blaze that trail on its own. |
|
FWIW "only if needed" seems safer to me, too. Differences in behaviour shouldn't be an issue - after all, we already have a difference in those cases, it's just that it's currently "broken" vs "working" 😄 |
|
It was reported that the securetransport code seems to be a lot slower than the previous code, one person measured (in an non-scientific benchmark) that: Took 12 seconds on our latest release and this branch took 56 seconds, which I'm going to guess is due to the ctypes interface. Which further suggests using this only as added. |
32e6231 to
36c5e03
Compare
|
This should be ready to go now. The slow down mentioned above is gone now (It was a bug in the bindings, which @Lukasa has fixed). Even though that has been fixed, I still went ahead and only used this in the case where we actually need to use it in order to reduce the chances this breaks something for someone. |
Older versions of OpenSSL (before 1.0.1) did not support TLSv1.2 and in the near future PyPI will be configured to *only* support TLSv1.2+. This allows us to utilize SecureTransport on these systems where the linked OpenSSL is *not* new enough to handle TLSv1.2.
Use SecureTransport on macOS (cherry picked from commit 9c03780)
The reason of the failures is TLSv1.0/TLSv1.1 brownout on the PyPI side, see [1]. It fixed by updating pip to at least 9.0.2 (tested with 9.0.3), see [2]. [1]: pypa/packaging-problems#130 [2]: pypa/pip#4454
The reason of the failures is TLSv1.0/TLSv1.1 brownout on the PyPI side, see [1]. It fixed by updating pip to at least 9.0.2 (tested with 9.0.3), see [2]. [1]: pypa/packaging-problems#130 [2]: pypa/pip#4454
The reason of the failures is TLSv1.0/TLSv1.1 brownout on the PyPI side, see [1]. It fixed by updating pip to at least 9.0.2 (tested with 9.0.3), see [2]. [1]: pypa/packaging-problems#130 [2]: pypa/pip#4454
The reason of the failures is TLSv1.0/TLSv1.1 brownout on the PyPI side, see [1]. It fixed by updating pip to at least 9.0.2 (tested with 9.0.3), see [2]. [1]: pypa/packaging-problems#130 [2]: pypa/pip#4454
The reason of the failures is TLSv1.0/TLSv1.1 brownout on the PyPI side, see [1]. It fixed by updating pip to at least 9.0.2 (tested with 9.0.3), see [2]. [1]: pypa/packaging-problems#130 [2]: pypa/pip#4454
The reason of the failures is TLSv1.0/TLSv1.1 brownout on the PyPI side, see [1]. It fixed by updating pip to at least 9.0.2 (tested with 9.0.3), see [2]. [1]: pypa/packaging-problems#130 [2]: pypa/pip#4454
The reason of the failures is TLSv1.0/TLSv1.1 brownout on the PyPI side, see [1]. It fixed by updating pip to at least 9.0.2 (tested with 9.0.3), see [2]. [1]: pypa/packaging-problems#130 [2]: pypa/pip#4454
The reason of the failures is TLSv1.0/TLSv1.1 brownout on the PyPI side, see [1]. It fixed by updating pip to at least 9.0.2 (tested with 9.0.3), see [2]. [1]: pypa/packaging-problems#130 [2]: pypa/pip#4454
The OpenSSL available on macOS is really old, so old in fact that in the future it will no longer be able to talk to PyPI. Thanks to the great work of @Lukasa we can utilize the SecureTransport library instead of OpenSSL which is new enough to support this.
Ideally this should not change any user visible behavior, but that cannot be guaranteed. In addition this really only matters for people using a Python that is linking against the system OpenSSL library, which is
/usr/bin/pythonand Python.org prior to 3.6. Homebrew and Python.org 3.6+ installers use their own OpenSSL which is fine.So that means we have a few options here:
Thoughts @pypa/pip-committers?
Note: This is a WIP because I pulled in the branch to test it, this wouldn't actually be merged until both urllib3 and requests are released.