requests: SSLV3_ALERT_HANDSHAKE_FAILURE after upgrade from 2.31.0 to 2.32.2
After upgrading to requests 2.32.* our custom SSL adapter doesn’t seem to working anymore. This is how it looks like
class CustomSSLAdapter(HTTPAdapter):
def __init__(self):
self.context = ssl.create_default_context()
certfile = ...
keyfile = ...
password = ...
self.context.load_cert_chain(certfile=certfile, keyfile=keyfile, password=password)
super().__init__()
def init_poolmanager(self, *args, **kwargs):
kwargs['ssl_context'] = self.context
return super().init_poolmanager(*args, **kwargs)
We have tried to mount this only for the target url but also for “http://”. The code was working find with version 2.31.0.
Expected Result
The adapter should still work.
Actual Result
We got the following error:
SSLError: HTTPSConnectionPool(host=..., port=543): Max retries exceeded with url: ... (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1007)')))
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 23 (8 by maintainers)
Commits related to this issue
- Allow for overriding of specific pool key params This re-enables the use case of providing a custom SSLContext via a Transport Adapter as broken in #6655 and reported in #6715 Closes #6715 — committed to sigmavirus24/requests by sigmavirus24 2 years ago
- Skip buggy `requests` versions and resolve "certificate verify failed: self-signed certificate in certificate chain" error `requests` versions 2.32.0 to 2.32.3 (included) are affected by a bug breaki... — committed to rbignon/woob by llange 2 years ago
@nateprewitt this is a different side-effect of #6655. I think to enable this particular use case we need to expose a way for sub-classes to muck with the pool kwargs, something like
That way a subclass like this could do something like:
Thoughts? I’m not particularly fond of this but it seems like the least intrusive way to preserve the fix for the CVE while giving people the ability to use custom SSLContexts the way they already were