如何为python应用程序全局设置SSL协议?

时间:2015-05-22 15:41:01

标签: python ssl pysphere

我正在为我的公司维护一个使用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?

0 个答案:

没有答案