How do I restrict access with a self-signed certificate?

I have a python script that wants to communicate over HTTPS with a flash application using a self signed certificate.

I created an SSL certificate with openssl

. I want the flask to only accept connections that use this certificate and discard those that don't.

Anyone have any idea how I can do this?

+3


source to share


1 answer


I don't think I'm flask

capable of that. flask

only takes care of the content building material. It actually uses Werkzeug as a backend in development mode.

During development, the werkzeug embedded server supports SSL for testing purposes:

run_simple('localhost', 4000, application,
       ssl_context=('/path/to/the/key.crt',
                    '/path/to/the/key.key'))

      



Details can be found here .

When it comes to production, the flask project should be depolated with a WSGI backend that is more productive. There are many backends like gunicorn and uWSGI (with nginx ). If you decide to use one of them, you can check their documentation to see how to add HTTPS support.

0


source







All Articles