From a00034a6a7a12f0fe587b59b34466e063d79912e Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 12 Dec 2016 17:03:53 +0100 Subject: [PATCH 1/4] 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 ":::" From f81dadc5d08c647ca4ddbd72caf1e5c310ea4ac7 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 15 Dec 2016 14:10:55 +0100 Subject: [PATCH 2/4] Fix final message --- automated install/basic-install.sh | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 08963637..b8f0c2dc 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -994,11 +994,7 @@ 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 + if (( ${#1} > 0 )) ; then # 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: @@ -1009,7 +1005,23 @@ 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 -${string}" ${r} ${c} + +Note: As security measure a password has been installed for your web interface +The currently set password is + ${1} +You can always change it using + pihole -a -p new_password" ${r} ${c} + else + whiptail --msgbox --backtitle "Make it so." --title "Installation Complete!" "Configure your devices to use the Pi-hole as their DNS server using: + +IPv4: ${IPV4_ADDRESS%/*} +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} + fi } update_dialogs() { @@ -1129,13 +1141,14 @@ main() { mv ${tmpLog} ${instalLogLoc} # Add password to web UI if there is none + pw="" 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 + displayFinalMessage ${pw} fi echo "::: Restarting services..." From e2898217d21b09d2b5a00f7125cf54dce211d140 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 15 Dec 2016 15:20:41 +0100 Subject: [PATCH 3/4] Made message shorter --- automated install/basic-install.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index b8f0c2dc..23d57cff 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1005,12 +1005,7 @@ 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 - -Note: As security measure a password has been installed for your web interface -The currently set password is - ${1} -You can always change it using - pihole -a -p new_password" ${r} ${c} +The currently set password is ${1}" ${r} ${c} else whiptail --msgbox --backtitle "Make it so." --title "Installation Complete!" "Configure your devices to use the Pi-hole as their DNS server using: @@ -1169,7 +1164,7 @@ main() { echo "::: View the web interface at http://pi.hole/admin or http://${IPV4_ADDRESS%/*}/admin" else echo "::: Update complete!" - if [ ! -z $pw ]; then + if (( ${#pw} > 0 )) ; then echo ":::" echo "::: Note: As security measure a password has been installed for your web interface" echo "::: The currently set password is" From 1eeaa012347e5e7ed76eda6e4e4f92402e58b490 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 15 Dec 2016 15:22:18 +0100 Subject: [PATCH 4/4] Always put the information that we added a password if we did (not only on update but also on fresh install) --- automated install/basic-install.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 23d57cff..d96c7eb4 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1164,15 +1164,16 @@ main() { echo "::: View the web interface at http://pi.hole/admin or http://${IPV4_ADDRESS%/*}/admin" else echo "::: Update complete!" - if (( ${#pw} > 0 )) ; 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 + + if (( ${#pw} > 0 )) ; 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 echo ":::"