From d9576e46fe6a2745233aa6bda638f2b1113cace5 Mon Sep 17 00:00:00 2001 From: Alan Anselmo Date: Wed, 7 Feb 2024 11:35:38 -0300 Subject: [PATCH 1/4] Add a condition in installing_deps if running as root --- installing_deps.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/installing_deps.sh b/installing_deps.sh index e6f907a1..3f1b3f5b 100755 --- a/installing_deps.sh +++ b/installing_deps.sh @@ -6,12 +6,18 @@ set -e ## bash debug mode toggle below #set -x -sudo apt-get update +# if running as root (eg inside a base ubuntu docker container) +if [ "$EUID" -eq 0 ]; then + apt-get update + apt-get install -y sudo +else + sudo apt-get update +fi sudo apt-get install python3-pip virtualenv python3-dev python3-tk libfreetype6-dev \ screen g++ unzip libsnappy-dev cmake -qq -sudo apt-get install automake libtool make gcc pkg-config -qq +sudo apt-get install automake libtool make gcc pkg-config git -qq #Needed for downloading jemalloc sudo apt-get install wget -qq From 3c9a0e049b1dc57175df6639524c1e32c464cfe1 Mon Sep 17 00:00:00 2001 From: Alan Anselmo Date: Wed, 7 Feb 2024 11:36:47 -0300 Subject: [PATCH 2/4] Update SESSION_COOKIE_NAME and secret_key to static values --- var/www/Flask_server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/var/www/Flask_server.py b/var/www/Flask_server.py index 63addc22..b3f9fe65 100755 --- a/var/www/Flask_server.py +++ b/var/www/Flask_server.py @@ -107,10 +107,10 @@ # ========= =========# # ========= Cookie name ======== -app.config.update(SESSION_COOKIE_NAME='ail_framework_{}'.format(uuid.uuid4().int)) +app.config.update(SESSION_COOKIE_NAME='ail_session') # ========= session ======== -app.secret_key = str(random.getrandbits(256)) +app.secret_key = os.getenv('AIL_APP_SECRET_KEY', 'ailAppSecretKey') login_manager = LoginManager() login_manager.login_view = 'root.login' login_manager.init_app(app) From 6269a170827498d2313d5b12bd92e3df669b4817 Mon Sep 17 00:00:00 2001 From: Alan Anselmo Date: Wed, 7 Feb 2024 11:38:23 -0300 Subject: [PATCH 3/4] Add env "AIL_APP_SECRET_KEY" to LAUNCH.sh --- bin/LAUNCH.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/LAUNCH.sh b/bin/LAUNCH.sh index 547cd76f..94ac55cc 100755 --- a/bin/LAUNCH.sh +++ b/bin/LAUNCH.sh @@ -24,6 +24,8 @@ else exit 1 fi +export AIL_APP_SECRET_KEY="$(uuidgen)" + export PATH=$AIL_VENV/bin:$PATH export PATH=$AIL_HOME:$PATH export PATH=$AIL_REDIS:$PATH From 09a9af36fa1446d03f27fb2984daa029741a29df Mon Sep 17 00:00:00 2001 From: Alan Anselmo Date: Wed, 7 Feb 2024 15:25:43 -0300 Subject: [PATCH 4/4] Change AIL_APP_SECRET_KEY from uuid to a long random string --- bin/LAUNCH.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/LAUNCH.sh b/bin/LAUNCH.sh index b0a78401..a565fd4c 100755 --- a/bin/LAUNCH.sh +++ b/bin/LAUNCH.sh @@ -24,7 +24,7 @@ else exit 1 fi -export AIL_APP_SECRET_KEY="$(uuidgen)" +export AIL_APP_SECRET_KEY="$(LC_ALL=C tr -dc A-Za-z0-9