Skip to content

Commit

Permalink
Use adhoc ssl context instead of bogus self-signed certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
jywsn committed Sep 24, 2015
1 parent d182288 commit def0202
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 28 deletions.
7 changes: 2 additions & 5 deletions api.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,18 +875,14 @@ def redirect_old_urls(path):
if site_dir not in sys.path:
sys.path.append(site_dir)


ssl_context = None
port = 5000

try:
opts, args = getopt.getopt(sys.argv[1:], "sp:", ["port="])
for opt, arg in opts:
if opt == '-s':
from OpenSSL import SSL
ssl_context = SSL.Context(SSL.SSLv23_METHOD)
ssl_context.use_privatekey_file(os.path.join(site_dir, 'website', 'website.key'))
ssl_context.use_certificate_file(os.path.join(site_dir, 'website', 'website.crt'))
ssl_context = 'adhoc'
elif opt in ('-p', '--port'):
port = int(arg)
else:
Expand All @@ -897,3 +893,4 @@ def redirect_old_urls(path):
sys.exit(1)

app.run(host='0.0.0.0', port=port, debug=True, ssl_context=ssl_context)

11 changes: 0 additions & 11 deletions website/website.crt

This file was deleted.

12 changes: 0 additions & 12 deletions website/website.key

This file was deleted.

0 comments on commit def0202

Please sign in to comment.