简体   繁体   English

Python HTTPS/SSL 错误:1407742E:SSL 例程:SSL23_GET_SERVER_HELLO:tlsv1 警报协议版本

[英]Python HTTPS/SSL error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

I'm attempting to make a simple HTTPS connection to a REST API using python from CentOS 6.5.我正在尝试使用 CentOS 6.5 中的 python 与 REST API 建立简单的 HTTPS 连接。 Installed is python-2.6.6-52.el6.x86_64 and openssl-1.0.1e-16.el6_5.7.x86_64.安装的是 python-2.6.6-52.el6.x86_64 和 openssl-1.0.1e-16.el6_5.7.x86_64。

#!/usr/bin/env python

import httplib, json, urllib, urllib2

# Gets the session ID to host
c = httplib.HTTPSConnection("10.10.1.1")
c.request("GET", "/services/rest/V2/?method=authenticate&username=myusername&password=mypasswd&format=json")
response = c.getresponse()
data = json.loads(response.read())
session_id = data['session_id']

print "Session Created. Session ID: " + session_id

However, its giving me this error:但是,它给了我这个错误:

Traceback (most recent call last):
  File "./test3.py", line 7, in <module>
    c.request("GET", "/services/rest/V2/?method=authenticate&username=myusername&password=mypasswd&format=json")
  File "/usr/lib64/python2.6/httplib.py", line 914, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib64/python2.6/httplib.py", line 951, in _send_request
    self.endheaders()
  File "/usr/lib64/python2.6/httplib.py", line 908, in endheaders
    self._send_output()
  File "/usr/lib64/python2.6/httplib.py", line 780, in _send_output
    self.send(msg)
  File "/usr/lib64/python2.6/httplib.py", line 739, in send
    self.connect()
  File "/usr/lib64/python2.6/httplib.py", line 1116, in connect
    self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file)
  File "/usr/lib64/python2.6/ssl.py", line 342, in wrap_socket
    suppress_ragged_eofs=suppress_ragged_eofs)
  File "/usr/lib64/python2.6/ssl.py", line 120, in __init__
    self.do_handshake()
  File "/usr/lib64/python2.6/ssl.py", line 279, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [Errno 1] _ssl.c:492: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

Is this an openssl/python compatibility issue?这是 openssl/python 兼容性问题吗? I've already got the latest python and openssl RPMs I can find and I'd rather not venture off the RPM reservation by compiling the latest tarball manually.我已经获得了我能找到的最新的 python 和 openssl RPM,我宁愿不通过手动编译最新的 tarball 来冒险取消 RPM 保留。

This might happen if you configured a server to only accept TLS1.2 but don't have support for TLS1.2 on the client side.如果您将服务器配置为仅接受 TLS1.2 但在客户端不支持 TLS1.2,则可能会发生这种情况。 At least Ubuntu has patched their openssl to not provide TLS1.1 on the client side but only on the server side to work around some bugs with some hosts.至少 Ubuntu 已经修补了他们的 openssl 以在客户端不提供 TLS1.1,而只在服务器端解决一些主机的一些错误。 Maybe RHEL/CentOS did too.也许 RHEL/CentOS 也是如此。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 urllib 下载 HTTPS 页面,错误:14077438:SSL 例程:SSL23_GET_SERVER_HELLO:tlsv1 警报内部错误 - Downloading HTTPS pages with urllib, error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error OpenSSL:错误:1409442E:SSL 例程:ssl3_read_bytes:tlsv1 警报协议版本 - OpenSSL: error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version Python httplib SSL23_GET_SERVER_HELLO:未知协议 - Python httplib SSL23_GET_SERVER_HELLO:unknown protocol 带requests.get()的BeautifulSoup错误“ SSL23_GET_SERVER_HELLO:sslv3警报握手失败” - BeautifulSoup error with requests.get() “SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure” ssl.SSLError:tlsv1 警报协议版本 - ssl.SSLError: tlsv1 alert protocol version 代理后面的https GET使用wget + TLSv1成功,但是即使ssl协议被强制使用TLSv1,但请求失败 - https GET behind proxy succeeds with wget + TLSv1, but fails with requests even if ssl protocol is forced to TLSv1 requests.exceptions.SSLError:[SSL:TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version(_ssl.c:590) - requests.exceptions.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) 无法安装 Python 包 [SSL: TLSV1_ALERT_PROTOCOL_VERSION] - Not able to install Python packages [SSL: TLSV1_ALERT_PROTOCOL_VERSION] 看似随机的 ssl.SSLError: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 警报内部错误 - Seemingly Random ssl.SSLError: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (安装Python 3.6.1)SSLError:SSL:TLSV1_ALERT_UNKNOWN_CA tlsv1 alert unknown ca - (Installing Python 3.6.1) SSLError: SSL: TLSV1_ALERT_UNKNOWN_CA tlsv1 alert unknown ca
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM