Secure Websockets with Client Certificate Authentication using Twisted -
i know if there option implement secure websockets (wss://) , client certificate based authentication twisted ?
i followed instructions on http://twistedmatrix.com/documents/12.3.0/core/howto/ssl.html, in setup of site on https:// , client certificates described. using self signed certs, works fine. however, things tricky when websockets come play.
running whole thing in ie 10 works fine. client authenticates certificate , gains access site , may open websocket. ff , chrome, however, won't work. note webserver , websocket run on same port.
in opinion, seems ie somehow stores authentication of client , uses access websocket. ff , chrome somehow treat websocket different ressource no authentication has happened before.
has experienced same or similiar issues or maybe implemented solution this?
if needed, can provide source code far.
for interested readers having same problem, figured out. solution set session id ssl context. browser seems remember cert authentication subresources websockets.
this should it:
contextfactory = twisted.internet.ssl.defaultopensslcontextfactory('keys/server.key', 'keys/server.crt') ctx = contextfactory.getcontext() ctx.set_verify( openssl.ssl.verify_peer | openssl.ssl.verify_client_once, verifycallback ) ## since have self-signed certs have explicitly ## tell server trust them. ctx.load_verify_locations("keys/ca.crt") ctx.set_session_id("id") lines 1-8 needed anyway. whats new line 9. here have set session id.
Comments
Post a Comment