wkeeling / selenium-wire

Extends Selenium's Python bindings to give you the ability to inspect requests made by the browser.
MIT License
1.9k stars 254 forks source link

SSL Handshake Error when using Selenium Wire #543

Closed mdp18 closed 2 years ago

mdp18 commented 2 years ago

Hi All, I'm attempting to open a webpage at ea.com/register using HTTP proxies with selenium-wire.

This is the error I get: TlsProtocolException('Cannot establish TLS with accounts.ea.com:443 (sni: accounts.ea.com): TlsException("SSL handshake error: Error([(\'SSL routines\', \'\', \'unsafe legacy renegotiation disabled\')])")')

Is there any known workaround for this?

wkeeling commented 2 years ago

I've not seen this error before. What platform are you using - Linux/Mac or Windows?

Can you share the version of OpenSSL and pyOpenSSL that you're using? You can get that with:

openssl version

and

pip show pyopenssl
lusi1990 commented 2 years ago

I got this problem too.

openssl version: OpenSSL 1.1.1m 14 Dec 2021

pip show pyopenssl :

Name: pyOpenSSL
Version: 22.0.0
Summary: Python wrapper module around the OpenSSL library
Home-page: https://pyopenssl.org/
Author: The pyOpenSSL developers
Author-email: cryptography-dev@python.org
License: Apache License, Version 2.0
Location: c:\users\xxx\pycharmprojects\xxxxx\venv\lib\site-packages
Requires: cryptography
Required-by: selenium-wire

I solved by this answer:https://stackoverflow.com/questions/71603314/ssl-error-unsafe-legacy-renegotiation-disabled.

wkeeling commented 2 years ago

This seems to be a compatibility issue with newer versions of OpenSSL and servers that don't support secure renegotiation. The SO thread above goes into more details and suggested solutions.