开发者

Twisted server TLS hanging on connection

I have a twisted webserver with TLS authentication, and it appears to hang when I connect to it over SMTP. Here is the block of twisted code to start the server:

(Note: certificateData is our private key and public key concatenated together, that appeared to be the only way to get a self 开发者_如何转开发signed certificate to work)

customFactory = CustomSMTPFactory(portal)
certificate = PrivateCertificate.loadPEM(certificateData)
contextFactory = certificate.options(certificate)
tlsFactory = TLSMemoryBIOFactory(contextFactory, False, customFactory)

a = service.Application("Custom Server")
internet.TCPServer(5870, tlsFactory).setServiceParent(a)

On the client, this line just hangs waiting to read data:

smtplib.SMTP('localhost',5870)

Any ideas? How do I setup TLS authentication on a twisted webserver?


Your server starts TLS from the beginning of the connection. Try smtplib.SMTP_SSL instead, so your client expects this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜