【发布时间】:2016-03-05 05:47:51
【问题描述】:
我正在尝试在 CherryPy 3.8.0 上使用 SSL。我的基本示例在 SSL 上实现了 ping 响应。
我是这样设置 SSL 的配置的:
# start Web Service with some configuration
global_conf = {
"global": { "server.environment": "production",
"engine.autoreload.on": True,
"engine.autoreload.frequency": 5,
"server.socket_host": "0.0.0.0",
"server.socket_port": 443,
"cherrypy.server.ssl_module": "builtin",
"cherrypy.server.ssl_certificate": "cert.pem",
"cherrypy.server.ssl_private_key": "privkey.pem",
"environment": "production",
"log.error_file": "site.log"}
}
cherrypy.config.update(global_conf)
conf = {
"/": {
"request.dispatch": cherrypy.dispatch.MethodDispatcher(),
"tools.encode.debug": True,
}
}
但是,当我调用 Web 服务时,我得到了错误。 Httpie、cURL 和 openssl 日志如下。
httpie日志:
> http GET https://<host>:443/ping
http: error: SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:600)
cURL 日志:
> curl -v https://<host>:443/ping
* Connected to <host> (<host>) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
* Closing connection 0
curl: (35) error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
OpenSSL 日志:
> openssl s_client -host <host> -port 443
CONNECTED(00000003)
140197694400160:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:795:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 295 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
---
【问题讨论】:
标签: python ssl curl https cherrypy