From a00034a6a7a12f0fe587b59b34466e063d79912e Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 12 Dec 2016 17:03:53 +0100 Subject: [PATCH] Add password to webUI after update if there is none --- automated install/basic-install.sh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 33444873..08963637 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -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 ":::"