Python 3.2 Cherrypy 3.2.3 ssl_module pyopenssl 错误

标签 python ssl cherrypy raspbian python-3.2

我正在使用 Raspberry PiSSL 协议(protocol)和 Gandi 的签名证书 运行网络服务器。

服务器使用配置中的 ssl_module = 'builtin'。 但是由于浏览器在识别证书颁发者方面存在问题,我需要通过 ssl_certificate_chain 属性提供中间证书,这只能通过使用 ssl_module = 'pyopenssl' .但是这个配置不起作用。 (查看错误信息)

ENGINE Error in 'start' listener <bound method Server.start of <cherrypy._cpserver.Server object at 0xe435b0>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.2/dist-packages/cherrypy/process/wspbus.py", line 205, in publish
    output.append(listener(*args, **kwargs))
  File "/usr/local/lib/python3.2/dist-packages/cherrypy/_cpserver.py", line 167, in start
    self.httpserver, self.bind_addr = self.httpserver_from_self()
  File "/usr/local/lib/python3.2/dist-packages/cherrypy/_cpserver.py", line 158, in httpserver_from_self
    httpserver = _cpwsgi_server.CPWSGIServer(self)
  File "/usr/local/lib/python3.2/dist-packages/cherrypy/_cpwsgi_server.py", line 60, in __init__
    adapter_class = wsgiserver.get_ssl_adapter_class(ssl_module)
  File "/usr/local/lib/python3.2/dist-packages/cherrypy/wsgiserver/wsgiserver3.py", line 1882, in get_ssl_adapter_class
    adapter = ssl_adapters[name.lower()]
KeyError: 'pyopenssl'

[31/Jul/2015:16:04:18] ENGINE Shutting down due to error in start listener:
Traceback (most recent call last):
  File "/usr/local/lib/python3.2/dist-packages/cherrypy/process/wspbus.py", line 243, in start
    self.publish('start')
  File "/usr/local/lib/python3.2/dist-packages/cherrypy/process/wspbus.py", line 223, in publish
    raise exc
cherrypy.process.wspbus.ChannelFailures: KeyError('pyopenssl',)

pyOpenSSL 已安装。 但是当我做测试时:

'>>>import ssl

'>>>import socket

'>>>hasattr(socket, 'ssl')

False

我还尝试在使用 pip-3.2 安装 libssl-dev 后重建 Python3.2。但是我没有成功,不得不恢复整个系统。

感谢您的帮助!

最佳答案

至少对于几个 CherryPy 版本 ssl_builtin supports certificate_chain .从 Cheese Shop 安装 CherryPy 3.7+(即 pip install CherryPy),而不是从 Debian Pacakges。 Python 3.2 本身是一个很好的更新候选者(例如,许多库是 3.3+)。

另请查看 this answer了解当前的 CherryPy SSL 问题。或者 this section直接,因为 CherryPy 目前不支持 Python 3 的 PyOpenSSL。

关于Python 3.2 Cherrypy 3.2.3 ssl_module pyopenssl 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31749996/

相关文章:

ssl - Openssl 重新协商失败

Python CherryPy 服务器,cherrypy.Application 是做什么的?

javascript - 类型错误 : 'Undefined' object is not iterable?

python - 除非需要,否则阻止以类作为值的字典实例化?

java - IDE 内部的 Jython 正常,IDE 外部, "no os specific module found"?

python - 如何解决错误 : Failed building wheel for h5py

java - Eclipse 中的 Tomcat 给出 java.security.UnrecoverableKeyException- 无法恢复 key 错误

iis - 如何使用客户端证书访问网站

python - python (cherrypy) Web 应用程序的持久性?

python - 如何使用python dxfwrite绘制六边形形状