带有 CherryPy 的 2 路 SSL
从 CherryPy 3.0 及更高版本开始,只需指向服务器证书和私钥即可打开单向 SSL,如下所示:
import cherrypy
class HelloWorld(object):
def index(self):
return "Hello SSL World!"
index.exposed = True
cherrypy.server.ssl_certificate = "keys/server.crt"
cherrypy.server.ssl_private_key = "keys/server.crtkey"
cherrypy.quickstart(HelloWorld())
这使客户端能够验证服务器的真实性。有谁知道 CherryPy 是否支持 2 路 ssl,例如服务器还可以通过验证客户端证书来检查客户端的真实性?
如果是,有人可以举个例子吗?或者发布一个示例的参考?
From CherryPy 3.0 and onwards, one-way SSL can be turned on simply by pointing to the server certificate and private key, like this:
import cherrypy
class HelloWorld(object):
def index(self):
return "Hello SSL World!"
index.exposed = True
cherrypy.server.ssl_certificate = "keys/server.crt"
cherrypy.server.ssl_private_key = "keys/server.crtkey"
cherrypy.quickstart(HelloWorld())
This enables clients to validate the server's authenticity. Does anyone know whether CherryPy supports 2-way ssl, e.g. where the server can also check client authenticity by validating a client certificate?
If yes, could anyone give an example how is that done? Or post a reference to an example?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它不是开箱即用的。您必须修补 wsgiserver 才能提供该功能。 http://www.cherrypy.org/ticket/1001< 上有一个票证(和补丁)正在处理中< /a>.
It doesn't out of the box. You'd have to patch the wsgiserver to provide that feature. There is a ticket (and patches) in progress at http://www.cherrypy.org/ticket/1001.
我一直在寻找同样的东西。我知道 CherryPy 网站上有一些补丁。
我还在 CherryPy SSL 客户端身份验证 中找到了以下内容。我还没有将其与 CherryPy 补丁进行比较,但也许这些信息会有所帮助。
I have been looking for the same thing. I know there are some patches on the CherryPy site.
I also found the following at CherryPy SSL Client Authentication. I haven't compared this vs the CherryPy patches but maybe the info will be helpful.
如果当前版本的CherryPy不支持客户端证书验证,可以将CherryPy配置为侦听127.0.0.1:80,安装HAProxy以侦听443并验证客户端证书并将流量转发到127.0.0.1:80
HAProxy 简单、轻便、快速且可靠。
HAProxy 配置示例
If the current version of CherryPy does not support client certificate verification, it is possible to configure CherryPy to listen to 127.0.0.1:80, install HAProxy to listen to 443 and verify client side certificates and to forward traffic to 127.0.0.1:80
HAProxy is simple, light, fast and reliable.
An example of HAProxy configuration