I try to prevent my pyOpenSSL client from resuming a TLS / SSL session if several connections (sending HTTP requests) to Tomcat application server are successful. I am sure that everything works fine on the server, as I have several other clients making similar connections, and all of them can do a session resume.
For the first connection, I create an ssl context. Then I just reuse the context for subsequent connections
ssl_context = SSL.Context(SSL.SSLv23_METHOD)
ssl_context.set_options(SSL.OP_NO_SSLv2)
sock = socket.create_connection((self.host, self.port), self.timeout)
sslconn = SSL.Connection(ssl_context, sock)
sslconn.set_connect_state()
sslconn.do_handshake()
source
share