How to create secure server client application using python-socketio?
See original GitHub issueI need to create secure connections over https/wss. I was going through this python-grpc-ssl library and I need something similar. WebSockets’ secure example offers similar functionality, but I can’t use it as I need event-based communication that this library offer.
For my simple tests, I have generated my own certificate and key. I am using aiohttp server where I am passing the above to ssl_context
argument like so:
ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
ssl_context.load_cert_chain('myRootCA.pem','myRootCA.key')
web.run_app(self.app, port=8080, ssl_context=ssl_context)
This creates an https server on port 8443 which I intend to connect to. I am unable to figure out how to go about this with the python socket-io client. For my use case, I need the server and client to verify each other and hence passing ssl_verify=False
is not an option for me. Please help me understand how I can go about this.
Thanks.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
I personally prefer to handle the encryption outside of the Python server. Nginx works really well for this. So there are ways to support TLS and certificates, just not in the same server.
@Ivaylo-Korakov Are you interested in server-side SSL support? This issue is for client-side, and as I said above, it can be implemented by passing an initialized requests or aiohttp session. For server-side SSL you can enable SSL in your web server, this package does not have its own web server.