Reputation: 715
I am writing a server in Python+Twisted that uses the endpoints [1] to allow configuring the listening connection. The documentation doesn't show any obvious (to me!) way to set options for an SSL context object using an endpoint string. I poked around in the source, and it looks like the IStreamServerEndpoint
object returned for an SSL connection has something like a _context
attribute I could fiddle with, but that seems kind of kludgy. I was wondering if there is some way for me to set the SSL context options without having to hack the endpoint internals. (I want to set the context up to be able to verify a client certificate).
Thanks, Carl
[1] https://twistedmatrix.com/documents/current/core/howto/endpoints.html
Upvotes: 2
Views: 644
Reputation: 48335
twisted.internet.endpoints.SSL4ServerEndpoint
accepts an argument to its initializer, sslContextFactory
. This object is used to create the TLS context used by connections established to that server endpoint.
If you supply your own context factory then it can configure the context objects in any way you like prior to giving them back to the endpoint.
Upvotes: 1