Created
April 22, 2016 12:54
-
-
Save Rich5/782116e5598d8a0cfa43a69e615369ed to your computer and use it in GitHub Desktop.
Quick SSL Python server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import BaseHTTPServer, SimpleHTTPServer | |
import ssl | |
# | |
# $openssl req -x509 -days 365 -nodes -newkey rsa:2048 -keyout key.pem -out cert.pem | |
# | |
httpd = BaseHTTPServer.HTTPServer(('0.0.0.0', 4443), SimpleHTTPServer.SimpleHTTPRequestHandler) | |
httpd.socket = ssl.wrap_socket(httpd.socket, certfile='cert.pem', keyfile='key.pem', server_side=True) | |
httpd.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment