1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 23:08:07 +00:00

Add password to webUI after update if there is none

This commit is contained in:
DL6ER 2016-12-12 17:03:53 +01:00
parent 7fd9ff43af
commit a00034a6a7

View File

@ -994,6 +994,11 @@ configureSelinux() {
}
displayFinalMessage() {
if [ ! -z $pw ]; then
pwstring="Note: As security measure a password has been installed for your web interface\n The currently set password is\n ${pw}\n\n You can always change it using\n pihole -a -p new_password"
else
pswsting=""
fi
# Final completion message to user
whiptail --msgbox --backtitle "Make it so." --title "Installation Complete!" "Configure your devices to use the Pi-hole as their DNS server using:
@ -1003,7 +1008,8 @@ IPv6: ${IPV6_ADDRESS}
If you set a new IP address, you should restart the Pi.
The install log is in /etc/pihole.
View the web interface at http://pi.hole/admin or http://${IPV4_ADDRESS%/*}/admin" ${r} ${c}
View the web interface at http://pi.hole/admin or http://${IPV4_ADDRESS%/*}/admin
${string}" ${r} ${c}
}
update_dialogs() {
@ -1122,6 +1128,12 @@ main() {
# Move the log file into /etc/pihole for storage
mv ${tmpLog} ${instalLogLoc}
# Add password to web UI if there is none
if [[ $(grep 'WEBPASSWORD' -c /etc/pihole/setupVars.conf) == 0 ]] ; then
pw=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8)
pihole -a -p ${pw}
fi
if [[ "${useUpdateVars}" == false ]]; then
displayFinalMessage
fi
@ -1144,6 +1156,15 @@ main() {
echo "::: View the web interface at http://pi.hole/admin or http://${IPV4_ADDRESS%/*}/admin"
else
echo "::: Update complete!"
if [ ! -z $pw ]; then
echo ":::"
echo "::: Note: As security measure a password has been installed for your web interface"
echo "::: The currently set password is"
echo "::: ${pw}"
echo ":::"
echo "::: You can always change it using"
echo "::: pihole -a -p new_password"
fi
fi
echo ":::"