Fix setting password for admin panel
This commit is contained in:
parent
af66f8dae7
commit
dacaad5aba
|
@ -40,7 +40,7 @@ apt install --assume-yes \
|
||||||
fuse g++ gcc curl firewalld automake autoconf libtool \
|
fuse g++ gcc curl firewalld automake autoconf libtool \
|
||||||
libcurl3-dev libc-ares-dev zlib1g-dev libncurses-dev make python3-aiohttp \
|
libcurl3-dev libc-ares-dev zlib1g-dev libncurses-dev make python3-aiohttp \
|
||||||
nginx-core certbot python3-certbot-nginx sudo python3-psutil \
|
nginx-core certbot python3-certbot-nginx sudo python3-psutil \
|
||||||
ldc dub libenet-dev
|
ldc dub libenet-dev python3-bcrypt
|
||||||
|
|
||||||
# Create the user for running the game servers
|
# Create the user for running the game servers
|
||||||
if ! getent passwd ${systemuser}; then
|
if ! getent passwd ${systemuser}; then
|
||||||
|
|
|
@ -43,7 +43,7 @@ patch --ignore-whitespace /etc/nginx/sites-available/default <<EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
+ location ^~ /admin {
|
+ location ^~ /admin {
|
||||||
+ auth_basic “Restricted”;
|
+ auth_basic "Restricted";
|
||||||
+ auth_basic_user_file /etc/nginx/htpasswd;
|
+ auth_basic_user_file /etc/nginx/htpasswd;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
@ -82,6 +82,6 @@ EOF
|
||||||
|
|
||||||
# Store password
|
# Store password
|
||||||
echo -n "${systemuser}:" > /etc/nginx/htpasswd
|
echo -n "${systemuser}:" > /etc/nginx/htpasswd
|
||||||
echo "bcrypt.hashpw('${systempassword}'.encode('utf8'),bcrypt.gensalt(rounds=10))" | python3 >> /etc/nginx/htpasswd
|
echo -e "import bcrypt\nprint(bcrypt.hashpw('${systempassword}'.encode('utf8'),bcrypt.gensalt(rounds=10)).decode('utf8'))" | python3 >> /etc/nginx/htpasswd
|
||||||
|
|
||||||
systemctl restart nginx
|
systemctl restart nginx
|
||||||
|
|
Reference in New Issue