fix: [Flask server + cookie session] chg default cookie name (also use port number) + add Flask port number to config

This commit is contained in:
Terrtia 2020-01-21 11:39:08 +01:00
parent f139e9564e
commit 7f278bd315
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
2 changed files with 11 additions and 1 deletions

View file

@ -36,6 +36,8 @@ sender_pw = None
[Flask]
#Proxying requests to the app
baseUrl = /
#Flask server port
port = 7000
#Number of logs to display in the dashboard
max_dashboard_logs = 15
#Maximum number of character to display in the toolip

View file

@ -51,6 +51,11 @@ baseUrl = baseUrl.replace('/', '')
if baseUrl != '':
baseUrl = '/'+baseUrl
try:
FLASK_PORT = config_loader.get_config_int("Flask", "port")
except Exception:
FLASK_PORT = 7000
# ========= REDIS =========#
r_serv_db = config_loader.get_redis_conn("ARDB_DB")
r_serv_tags = config_loader.get_redis_conn("ARDB_Tags")
@ -90,6 +95,9 @@ app.register_blueprint(correlation, url_prefix=baseUrl)
app.register_blueprint(tags_ui, url_prefix=baseUrl)
# ========= =========#
# ========= Cookie name ========
app.config.update(SESSION_COOKIE_NAME='ail_framework_{}'.format(FLASK_PORT))
# ========= session ========
app.secret_key = str(random.getrandbits(256))
login_manager = LoginManager()
@ -242,4 +250,4 @@ r_serv_db.sadd('list_export_tags', 'infoleak:submission="manual"')
# ============ MAIN ============
if __name__ == "__main__":
app.run(host='0.0.0.0', port=7000, threaded=True, ssl_context=ssl_context)
app.run(host='0.0.0.0', port=FLASK_PORT, threaded=True, ssl_context=ssl_context)