feat: Implement password protection
This commit is contained in:
parent
724a8cb720
commit
60e83e9f7a
1 changed files with 11 additions and 5 deletions
16
src/reset.sh
16
src/reset.sh
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue