Skip to content

Commit

Permalink
feat: Implement password protection (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Feb 15, 2025
1 parent 724a8cb commit eb2c9cf
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -247,17 +247,23 @@ hasDisk() {
}

user="admin"
pass="$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
echo "$user:{PLAIN}$pass" > /etc/nginx/.htpasswd
echo "$user:{PLAIN}${PASS:-}" > /etc/nginx/.htpasswd

# Start webserver
cp -r /var/www/* /run/shm
html "Starting $APP for Docker..."
nginx -e stderr

return 0

0 comments on commit eb2c9cf

Please sign in to comment.