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"
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue