我有一个使用TLS的扭曲服务器:
from twisted.web.server import Site
from twisted.web.static import Data
from twisted.internet import reactor, ssl
port = 88888
root = Data("", "text/plain")
site = Site(root)
reactor.listenSSL(port, site, ssl.DefaultOpenSSLContextFactory(
'/etc/apache2/ssl/wc.key',
'/etc/apache2/ssl/wc.crt'))
我有2个域名,所以我需要为另一个域名添加另一个ssl证书。我在Twisted listenSSL virtualhosts找到了类似的问题,但我不明白如何修改2个证书的代码。有谁能告诉我如何使用2个certifactes?
P.S。谢谢,我是这样做的:
from twisted.web.server import Site
from twisted.web.static import Data
from twisted.internet import reactor, ssl
from txsni.snimap import SNIMap
from txsni.maputils import Cache
from txsni.snimap import HostDirectoryMap
from twisted.python.filepath import FilePath
from os.path import expanduser
root = Data("", "text/plain")
site = Site(root)
contextFactory = SNIMap(
Cache(HostDirectoryMap(FilePath(expanduser('/home/user/certificates_dir'))))
)
reactor.listenSSL(config.ws_port, site, contextFactory)