zeroyu@ubuntu:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal
openssl为最新版且相关信息如下,从信息中可以看到是支持TLS1/TLS1.1的
1 2 3 4 5 6 7
zeroyu@ubuntu:~/Desktop$ openssl s_client -help 2>&1 > /dev/null | egrep "\-(ssl|tls)[^a-z]" -ssl_config val Use specified configuration file -tls1 Just use TLSv1 -tls1_1 Just use TLSv1.1 -tls1_2 Just use TLSv1.2 -tls1_3 Just use TLSv1.3 -ssl_client_engine val Specify engine to be used for client certificate operations
zeroyu@ubuntu:~/Desktop$ python3 headless_ssl_error.py headless_ssl_error.py:5: DeprecationWarning: use setter for headless property instead of set_headless fireFoxOptions.set_headless() headless_ssl_error.py:7: DeprecationWarning: use options instead of firefox_options brower = webdriver.Firefox(firefox_options=fireFoxOptions) Traceback (most recent call last): File "headless_ssl_error.py", line 9, in <module> brower.get('https://IP') File "/home/zeroyu/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 333, in get self.execute(Command.GET, {'url': url}) File "/home/zeroyu/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/home/zeroyu/.local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: Reached error page: about:neterror?e=nssFailure2&u=https%3A//IP/&c=UTF-8&d=%20
如果使用Python的requests库的话,就会出现一下报错信息
1 2 3 4 5 6 7 8 9 10 11
zeroyu@ubuntu:~/Desktop$ python3 ssl_error.py Traceback (most recent call last): File "/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py", line 485, in wrap_socket cnx.do_handshake() File "/home/zeroyu/.local/lib/python3.8/site-packages/OpenSSL/SSL.py", line 1934, in do_handshake self._raise_ssl_error(self._ssl, result) File "/home/zeroyu/.local/lib/python3.8/site-packages/OpenSSL/SSL.py", line 1671, in _raise_ssl_error _raise_current_error() File "/home/zeroyu/.local/lib/python3.8/site-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue raise exception_type(errors) OpenSSL.SSL.Error: [('SSL routines', 'ssl_choose_client_version', 'unsupported protocol')]
造成此问题的代码如下
1 2 3 4 5 6
import requests from urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)