From 8a58bb46a82027b2a09413a41d4af33985cc8ef3 Mon Sep 17 00:00:00 2001 From: nimhbg Date: Mon, 30 Sep 2024 05:51:51 +0200 Subject: [PATCH] Do not destroy webapp users on startup An advanced admin may have created other users in addition to $WIS2BOX_WEBAPP_USERNAME, each with their own Basic Authentication credentials for accessing the webapp. This avoids multiple users sharing the same set of username and password --- wis2box-management/docker/entrypoint.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/wis2box-management/docker/entrypoint.sh b/wis2box-management/docker/entrypoint.sh index 4766c8bd2..38fbd57ea 100755 --- a/wis2box-management/docker/entrypoint.sh +++ b/wis2box-management/docker/entrypoint.sh @@ -65,15 +65,14 @@ if [ ! -d /home/wis2box/.htpasswd/ ]; then fi # create /home/wis2box/.htpasswd/webapp if not exists -# otherwise, delete the file and create it +# otherwise, re-create webapp user credentials from the environment # in case of failure continue if [ ! -f /home/wis2box/.htpasswd/webapp ]; then echo "Creating /home/wis2box/.htpasswd/webapp" htpasswd -bc /home/wis2box/.htpasswd/webapp $WIS2BOX_WEBAPP_USERNAME $WIS2BOX_WEBAPP_PASSWORD || true else - rm /home/wis2box/.htpasswd/webapp - echo "Re-creating /home/wis2box/.htpasswd/webapp" - htpasswd -bc /home/wis2box/.htpasswd/webapp $WIS2BOX_WEBAPP_USERNAME $WIS2BOX_WEBAPP_PASSWORD || true + echo "Re-creating webapp user credentials in /home/wis2box/.htpasswd/webapp" + htpasswd -b /home/wis2box/.htpasswd/webapp $WIS2BOX_WEBAPP_USERNAME $WIS2BOX_WEBAPP_PASSWORD || true fi # Check if the path is restricted and capture the output