我正在为我的公司维护一个使用 pysphere 连接到 vCenter 的 Python 应用程序。如果我们的用户选择仅允许通过 TLSv1 传入请求的选项(默认为 TLSv1 和 SSLv3,并且设置很少更改),那么我们会看到以下堆栈跟踪:
2015-05-08 13:19:38,000 vcenterutils 72 Encountered exception Errno 8 _ssl.c:504: EOF occurred in violation of protocol at Traceback (most recent call last):
File "vcenterutils.pyo", line 68, in run
File "vcenterutils.pyo", line 127, in connect
File "vcenterutils.pyo", line 140, in login
File "pysphere\vi_server.pyo", line 101, in connect
File "pysphere\resources\VimService_services.pyo", line 2170, in RetrieveServiceContent
File "pysphere\ZSI\client.pyo", line 295, in Send
File "httplib.pyo", line 1161, in connect
File "ssl.pyo", line 381, in wrap_socket
File "ssl.pyo", line 143, in _init
File "ssl.pyo", line 305, in do_handshake
SSLError: Errno 8 _ssl.c:504: EOF occurred in violation of protocol
这使我相信代码中明确使用了 SSLv3。有没有办法将其作为全局默认值覆盖,因此始终使用 ssl.PROTOCOL_SSLv23?