feat: Implement password protection

This commit is contained in:
Kroese 2025-02-15 04:34:16 +01:00 committed by GitHub
parent 724a8cb720
commit 60e83e9f7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -247,17 +247,23 @@ hasDisk() {
} }
user="admin" user="admin"
pass="$user"
[ -n "${USER:-}" ] && user="${USER:-}" [ -n "${USER:-}" ] && user="${USER:-}"
[ -n "${PASS:-}" ] && pass="${PASS:-}"
if [ -n "${PASS:-}" ]; then
sed -i "s/auth_basic off/auth_basic \"NoVNC\"/g" /etc/nginx/sites-enabled/web.conf
else
sed -i "s/auth_basic \"NoVNC\"/auth_basic off/g" /etc/nginx/sites-enabled/web.conf
fi
# Set password # Set password
echo "$user:{PLAIN}$pass" > /etc/nginx/.htpasswd echo "$user:{PLAIN}${PASS:-}" > /etc/nginx/.htpasswd
# Start webserver # Start webserver
cp -r /var/www/* /run/shm cp -r /var/www/* /run/shm
html "Starting $APP for Docker..." html "Starting $APP for Docker..."
nginx -e stderr nginx -e stderr
return 0 return 0