Skip to content

Commit

Permalink
Cassh web server : Add ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Beguier committed Sep 28, 2017
1 parent 2c6025d commit bee03c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/web/cassh_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
from functools import wraps
from json import dumps, loads
from os import getenv, path
from ssl import PROTOCOL_TLSv1_2, SSLContext

# Third party library imports
from flask import Flask, render_template, request, Response, redirect, url_for, send_from_directory
from urllib3 import disable_warnings
from requests import get, post, put
from requests.exceptions import ConnectionError
from urllib3 import disable_warnings
from werkzeug import secure_filename

# Disable HTTPs warnings
Expand Down Expand Up @@ -172,5 +173,7 @@ def page_not_found(_):
return render_template('404.html'), 404

if __name__ == '__main__':
CONTEXT = SSLContext(PROTOCOL_TLSv1_2)
CONTEXT.load_cert_chain(APP.config['SSL_PUB_KEY'], APP.config['SSL_PRIV_KEY'])
PORT = int(getenv('PORT', 5000))
APP.run(debug=True, host='0.0.0.0', port=PORT)
APP.run(debug=True, host='0.0.0.0', port=PORT, ssl_context=CONTEXT)
1 change: 1 addition & 0 deletions server/web/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ flask==0.10.1
markdown==2.3.1
pyyaml==3.10
waitress==0.8.5
Werkzeug

0 comments on commit bee03c7

Please sign in to comment.