Hi,
I am creating a simple SMTP server that would handle TLS
connections as well. I am doing this to test some stuff at office. I
am using twisted, and the basic plain text part works fine. But I run
into issues when I use STARTTLS. When I use starttls(I tried with
openssl s_client), openssl says SSL Handshake failure. Captures show
that the script sends a FIN, ACK.
My code for tls looks like this.
tls_context = SMTPTLSContext(privateKeyFileName = something.key,
certificateFileName=somthing.pem)
self.transport.startTLS(tls_context, SMTPServerFactory())
SMTPServerFactory inherits Factory and runs the SMTPServer class. This
Factory class works fine(when tested with plain text emails)
SMTPTLSContext is like this:
class SMTPTLSContext(ssl.DefaultOpenSSLContextFactory):
def __init__(self, *args, **kw):
kw['sslmethod'] = SSL.TLSv1_METHOD
ssl.DefaultOpenSSLContextFactory.__init__(self, *args, **kw)
I guess the FIN,ACK is because of the self.transport.startTLS() method
starting off a new SMTPServerFactory instance. Can someone help me on
how to implement the STARTTLS part of it ? Thanks
--
Thank you
Balachandran Sivakumar
Arise Awake and stop not till the goal is reached.
- Swami Vivekananda
Mail: benignbala at gmail.com
Blog: http://benignbala.wordpress.com/