From 4301b9a12a472f0e82ac64c421793ffa7145abf3 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 25 Jan 2017 10:33:25 +0100 Subject: [PATCH 01/97] Add static DHCP leases to new file --- advanced/Scripts/webpage.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 02610d85..10d53045 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -12,6 +12,8 @@ readonly setupVars="/etc/pihole/setupVars.conf" readonly dnsmasqconfig="/etc/dnsmasq.d/01-pihole.conf" readonly dhcpconfig="/etc/dnsmasq.d/02-pihole-dhcp.conf" +# 03 -> wildcards +readonly dhcpstaticconfig="/etc/dnsmasq.d/04-pihole-static-dhcp.conf" helpFunc() { cat << EOM @@ -313,6 +315,24 @@ ResolutionSettings() { fi } +AddDHCPStaticAddress() { + + mac="${args[2]}" + ip="${args[3]}" + host="${args[4]}" + + if [[ "${ip}" == "noip" ]]; then + # Static host name + echo "dhcp-host=${mac},${host}" >> "dhcpstaticconfig" + elif [[ "${host}" == "nohost" ]]; then + # Static IP + echo "dhcp-host=${mac},${ip}" >> "dhcpstaticconfig" + else + # Full info given + echo "dhcp-host=${mac},${ip},${host}" >> "dhcpstaticconfig" + fi +} + main() { args=("$@") @@ -334,6 +354,7 @@ main() { "-h" | "--help" ) helpFunc;; "privacymode" ) SetPrivacyMode;; "resolve" ) ResolutionSettings;; + "addstatic" ) AddDHCPStaticAddress;; * ) helpFunc;; esac From 5c95c4074b404cb6022c4d381b92a4db53a160ab Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 25 Jan 2017 10:35:03 +0100 Subject: [PATCH 02/97] Remove static leases from DHCP static leases file --- advanced/Scripts/webpage.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 10d53045..f10f79f3 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -323,16 +323,23 @@ AddDHCPStaticAddress() { if [[ "${ip}" == "noip" ]]; then # Static host name - echo "dhcp-host=${mac},${host}" >> "dhcpstaticconfig" + echo "dhcp-host=${mac},${host}" >> "${dhcpstaticconfig}" elif [[ "${host}" == "nohost" ]]; then # Static IP - echo "dhcp-host=${mac},${ip}" >> "dhcpstaticconfig" + echo "dhcp-host=${mac},${ip}" >> "${dhcpstaticconfig}" else # Full info given - echo "dhcp-host=${mac},${ip},${host}" >> "dhcpstaticconfig" + echo "dhcp-host=${mac},${ip},${host}" >> "${dhcpstaticconfig}" fi } +RemoveDHCPStaticAddress() { + + mac="${args[2]}" + sed -i "/dhcp-host=${mac}.*/d" "${dhcpstaticconfig}" + +} + main() { args=("$@") @@ -355,6 +362,7 @@ main() { "privacymode" ) SetPrivacyMode;; "resolve" ) ResolutionSettings;; "addstatic" ) AddDHCPStaticAddress;; + "removestatic" ) RemoveDHCPStaticAddress;; * ) helpFunc;; esac From dad18dc5def0753a27f2c631fbd3a8686ab9a32f Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 25 Jan 2017 10:35:45 +0100 Subject: [PATCH 03/97] Changed keywords --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index f10f79f3..fd882bd3 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -361,8 +361,8 @@ main() { "-h" | "--help" ) helpFunc;; "privacymode" ) SetPrivacyMode;; "resolve" ) ResolutionSettings;; - "addstatic" ) AddDHCPStaticAddress;; - "removestatic" ) RemoveDHCPStaticAddress;; + "addstaticdhcp" ) AddDHCPStaticAddress;; + "removestaticdhcp" ) RemoveDHCPStaticAddress;; * ) helpFunc;; esac From e2b87759d8237c70118e30363a0998ca03769452 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 28 Jan 2017 14:27:08 +0000 Subject: [PATCH 04/97] split out web dependencies --- automated install/basic-install.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index a98eb3aa..861f5c35 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -78,7 +78,8 @@ if command -v apt-get &> /dev/null; then fi # ######################################### INSTALLER_DEPS=(apt-utils debconf dhcpcd5 git whiptail) - PIHOLE_DEPS=(bc cron curl dnsmasq dnsutils ${iproute_pkg} iputils-ping lighttpd lsof netcat ${phpVer}-common ${phpVer}-cgi sudo unzip wget) + PIHOLE_DEPS=(bc cron curl dnsmasq dnsutils ${iproute_pkg} iputils-ping lsof netcat sudo unzip wget) + PIHOLE_WEB_DEPS=(lighttpd ${phpVer}-common ${phpVer}-cgi} LIGHTTPD_USER="www-data" LIGHTTPD_GROUP="www-data" LIGHTTPD_CFG="lighttpd.conf.debian" @@ -97,8 +98,8 @@ elif command -v rpm &> /dev/null; then PKG_INSTALL=(${PKG_MANAGER} install -y) PKG_COUNT="${PKG_MANAGER} check-update | egrep '(.i686|.x86|.noarch|.arm|.src)' | wc -l" INSTALLER_DEPS=(git iproute net-tools newt procps-ng) - PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq findutils lighttpd lighttpd-fastcgi nmap-ncat php php-common php-cli sudo unzip wget) - + PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq findutils nmap-ncat sudo unzip wget) + PIHOLE_WEB_DEPS=(lighttpd lighttpd-fastcgi php php-common php-cli) if ! grep -q 'Fedora' /etc/redhat-release; then INSTALLER_DEPS=("${INSTALLER_DEPS[@]}" "epel-release"); fi @@ -1144,6 +1145,7 @@ main() { { echo "!!! Unable to clone ${piholeGitUrl} into ${PI_HOLE_LOCAL_REPO}, unable to continue."; \ exit 1; \ } + #TODO: Check if web flag is set here getGitFiles ${webInterfaceDir} ${webInterfaceGitUrl} || \ { echo "!!! Unable to clone ${webInterfaceGitUrl} into ${webInterfaceDir}, unable to continue."; \ exit 1; \ From d9ec3d2c22240070b529e357c1b7c0a42bc75c6e Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 28 Jan 2017 14:28:18 +0000 Subject: [PATCH 05/97] spelling --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 861f5c35..40292da9 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -63,7 +63,7 @@ if command -v apt-get &> /dev/null; then # grep -c will return 1 retVal on 0 matches, block this throwing the set -e with an OR TRUE PKG_COUNT="${PKG_MANAGER} -s -o Debug::NoLocking=true upgrade | grep -c ^Inst || true" # ######################################### - # fixes for dependancy differences + # fixes for dependency differences # Debian 7 doesn't have iproute2 use iproute if ${PKG_MANAGER} install --dry-run iproute2 > /dev/null 2>&1; then iproute_pkg="iproute2" From f588c6f93c8f8bc7b61ff5ebf539f2f17b56831b Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 28 Jan 2017 14:38:54 +0000 Subject: [PATCH 06/97] introduce web toggle flag --- automated install/basic-install.sh | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 40292da9..97c43b4d 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -34,6 +34,8 @@ useUpdateVars=false IPV4_ADDRESS="" IPV6_ADDRESS="" QUERY_LOGGING=true +INSTALL_WEB=true + # Find the rows and columns will default to 80x24 is it can not be detected screen_size=$(stty size 2>/dev/null || echo 24 80) @@ -70,7 +72,7 @@ if command -v apt-get &> /dev/null; then else iproute_pkg="iproute" fi - # Prefer the php metapackage if it's there, fall back on the php5 pacakges + # Prefer the php metapackage if it's there, fall back on the php5 packages if ${PKG_MANAGER} install --dry-run php > /dev/null 2>&1; then phpVer="php" else @@ -543,6 +545,27 @@ setLogging() { esac } +setAdminFlag() { + local WebToggleCommand + local WebChooseOptions + local WebChoices + + WebToggleCommand=(whiptail --separate-output --radiolist "Do you wish to install the web admin interface?" ${r} ${c} 6) + WebChooseOptions=("On (Recommended)" "" on + Off "" off) + WebChoices=$("${WebToggleCommand[@]}" "${WebChooseOptions[@]}" 2>&1 >/dev/tty) || (echo "::: Cancel selected. Exiting..." && exit 1) + case ${WebChoices} in + "On (Recommended)") + echo "::: Web Interface On." + INSTALL_WEB=true + ;; + Off) + echo "::: Web Interface off." + INSTALL_WEB=false + ;; + esac +} + version_check_dnsmasq() { # Check if /etc/dnsmasq.conf is from pihole. If so replace with an original and install new in .d directory @@ -920,6 +943,7 @@ finalExports() { echo "PIHOLE_DNS_1=${PIHOLE_DNS_1}" echo "PIHOLE_DNS_2=${PIHOLE_DNS_2}" echo "QUERY_LOGGING=${QUERY_LOGGING}" + echo "INSTALL_WEB=${INSTALL_WEB}" }>> "${setupVars}" # Look for DNS server settings which would have to be reapplied @@ -1168,6 +1192,8 @@ main() { setDNS # Let the user decide if they want to block ads over IPv4 and/or IPv6 use4andor6 + # Let the user decide if they want the web interface to be installed automatically + setAdminFlag # Let the user decide if they want query logging enabled... setLogging From bd07d7f32eba63a1d18d76213bdb8f82c3bd87a6 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 28 Jan 2017 15:11:39 +0000 Subject: [PATCH 07/97] Only install web dependenices if flag is true --- automated install/basic-install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 97c43b4d..bf5afe69 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1169,7 +1169,6 @@ main() { { echo "!!! Unable to clone ${piholeGitUrl} into ${PI_HOLE_LOCAL_REPO}, unable to continue."; \ exit 1; \ } - #TODO: Check if web flag is set here getGitFiles ${webInterfaceDir} ${webInterfaceGitUrl} || \ { echo "!!! Unable to clone ${webInterfaceGitUrl} into ${webInterfaceDir}, unable to continue."; \ exit 1; \ @@ -1199,12 +1198,18 @@ main() { # Install packages used by the Pi-hole install_dependent_packages PIHOLE_DEPS[@] + if [[ ${INSTALL_WEB} == true ]]; then + install_dependent_packages PIHOLE_WEB_DEPS[@] + fi # Install and log everything to a file installPihole | tee ${tmpLog} else # update packages used by the Pi-hole install_dependent_packages PIHOLE_DEPS[@] + if [[ ${INSTALL_WEB} == true ]]; then + install_dependent_packages PIHOLE_WEB_DEPS[@] + fi updatePihole | tee ${tmpLog} fi From dfdb9e393b91aa8dfaae4add43c2625df0741975 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 28 Jan 2017 15:15:42 +0000 Subject: [PATCH 08/97] move repo clone to function --- automated install/basic-install.sh | 36 +++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index bf5afe69..079f11e7 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1096,6 +1096,25 @@ update_dialogs() { esac } +clone_or_update_repos() { +if [[ "${reconfigure}" == true ]]; then + echo "::: --reconfigure passed to install script. Not downloading/updating local repos" + else + # Get Git files for Core and Admin + getGitFiles ${PI_HOLE_LOCAL_REPO} ${piholeGitUrl} || \ + { echo "!!! Unable to clone ${piholeGitUrl} into ${PI_HOLE_LOCAL_REPO}, unable to continue."; \ + exit 1; \ + } + + if [[ ${INSTALL_WEB} == true ]]; then + getGitFiles ${webInterfaceDir} ${webInterfaceGitUrl} || \ + { echo "!!! Unable to clone ${webInterfaceGitUrl} into ${webInterfaceDir}, unable to continue."; \ + exit 1; \ + } + fi + fi +} + main() { ######## FIRST CHECK ######## @@ -1161,19 +1180,6 @@ main() { # Check if SELinux is Enforcing checkSelinux - if [[ "${reconfigure}" == true ]]; then - echo "::: --reconfigure passed to install script. Not downloading/updating local repos" - else - # Get Git files for Core and Admin - getGitFiles ${PI_HOLE_LOCAL_REPO} ${piholeGitUrl} || \ - { echo "!!! Unable to clone ${piholeGitUrl} into ${PI_HOLE_LOCAL_REPO}, unable to continue."; \ - exit 1; \ - } - getGitFiles ${webInterfaceDir} ${webInterfaceGitUrl} || \ - { echo "!!! Unable to clone ${webInterfaceGitUrl} into ${webInterfaceDir}, unable to continue."; \ - exit 1; \ - } - fi if [[ ${useUpdateVars} == false ]]; then # Display welcome dialogs @@ -1195,6 +1201,8 @@ main() { setAdminFlag # Let the user decide if they want query logging enabled... setLogging + # Clone/Update the repos + clone_or_update_repos # Install packages used by the Pi-hole install_dependent_packages PIHOLE_DEPS[@] @@ -1205,6 +1213,8 @@ main() { # Install and log everything to a file installPihole | tee ${tmpLog} else + # Clone/Update the repos + clone_or_update_repos # update packages used by the Pi-hole install_dependent_packages PIHOLE_DEPS[@] if [[ ${INSTALL_WEB} == true ]]; then From f8322cc2d46fed92cc394a174c919d3ef7bc7964 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 28 Jan 2017 15:25:02 +0000 Subject: [PATCH 09/97] use the web install flag. Could be optimised --- automated install/basic-install.sh | 62 +++++++++++++++++++----------- 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 079f11e7..52763f25 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -994,7 +994,9 @@ installPihole() { installScripts installConfigs CreateLogFile - installPiholeWeb + if [[ ${INSTALL_WEB} == true ]]; then + installPiholeWeb + fi installCron installLogrotate configureFirewall @@ -1025,7 +1027,9 @@ updatePihole() { installScripts installConfigs CreateLogFile - installPiholeWeb + if [[ ${INSTALL_WEB} == true ]]; then + installPiholeWeb + fi installCron installLogrotate finalExports #re-export setupVars.conf to account for any new vars added in new versions @@ -1188,7 +1192,9 @@ main() { mkdir -p /etc/pihole/ # Stop resolver and webserver while installing proceses stop_service dnsmasq - stop_service lighttpd + if [[ ${INSTALL_WEB} == true ]]; then + stop_service lighttpd + fi # Determine available interfaces get_available_interfaces # Find interfaces and let the user choose one @@ -1227,25 +1233,31 @@ main() { # Move the log file into /etc/pihole for storage 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) - /usr/local/bin/pihole -a -p "${pw}" - fi - - if [[ "${useUpdateVars}" == false ]]; then - displayFinalMessage "${pw}" + if [[ ${INSTALL_WEB} == true ]]; then + # 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) + /usr/local/bin/pihole -a -p "${pw}" + fi fi echo "::: Restarting services..." # Start services start_service dnsmasq enable_service dnsmasq - start_service lighttpd - enable_service lighttpd + + if [[ ${INSTALL_WEB} == true ]]; then + start_service lighttpd + enable_service lighttpd + fi + echo "::: done." + if [[ "${useUpdateVars}" == false ]]; then + displayFinalMessage "${pw}" + fi + echo ":::" if [[ "${useUpdateVars}" == false ]]; then echo "::: Installation Complete! Configure your devices to use the Pi-hole as their DNS server using:" @@ -1253,19 +1265,23 @@ main() { echo "::: ${IPV6_ADDRESS}" echo ":::" echo "::: If you set a new IP address, you should restart the Pi." - echo "::: View the web interface at http://pi.hole/admin or http://${IPV4_ADDRESS%/*}/admin" + if [[ ${INSTALL_WEB} == true ]]; then + echo "::: View the web interface at http://pi.hole/admin or http://${IPV4_ADDRESS%/*}/admin" + fi else echo "::: Update complete!" 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" + if [[ ${INSTALL_WEB} == true ]]; 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" + echo "::: ${pw}" + echo ":::" + echo "::: You can always change it using" + echo "::: pihole -a -p new_password" + fi fi echo ":::" From f0bd7fae5c6c08ea9987e25fb092d69b70f3bcaa Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 28 Jan 2017 15:32:07 +0000 Subject: [PATCH 10/97] ) not } --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 52763f25..6476f0c6 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -81,7 +81,7 @@ if command -v apt-get &> /dev/null; then # ######################################### INSTALLER_DEPS=(apt-utils debconf dhcpcd5 git whiptail) PIHOLE_DEPS=(bc cron curl dnsmasq dnsutils ${iproute_pkg} iputils-ping lsof netcat sudo unzip wget) - PIHOLE_WEB_DEPS=(lighttpd ${phpVer}-common ${phpVer}-cgi} + PIHOLE_WEB_DEPS=(lighttpd ${phpVer}-common ${phpVer}-cgi) LIGHTTPD_USER="www-data" LIGHTTPD_GROUP="www-data" LIGHTTPD_CFG="lighttpd.conf.debian" From 731d15f9b574eefc6760bb6a3b1e88354705c131 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 28 Jan 2017 15:43:33 +0000 Subject: [PATCH 11/97] don't display web admin info in final dialog if it's not selected --- automated install/basic-install.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 6476f0c6..54020ecb 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1055,6 +1055,13 @@ checkSelinux() { } displayFinalMessage() { + + if [[ ${INSTALL_WEB} == true ]]; then + additional="View the web interface at http://pi.hole/admin or http://${IPV4_ADDRESS%/*}/admin + +Your Admin Webpage login password is ${1:-"NOT SET"}" + 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: @@ -1064,9 +1071,8 @@ IPv6: ${IPV6_ADDRESS:-"Not Configured"} 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 -Your Admin Webpage login password is ${1:-"NOT SET"}" ${r} ${c} +${additional}" ${r} ${c} } update_dialogs() { From 01429d59bd57ee731ae3eb5ca11343fa50659d87 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 28 Jan 2017 15:45:14 +0000 Subject: [PATCH 12/97] more web checks --- automated install/basic-install.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 54020ecb..ae7e8c4d 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -980,16 +980,19 @@ installLogrotate() { installPihole() { # Install base files and web interface create_pihole_user - if [ ! -d "/var/www/html" ]; then - mkdir -p /var/www/html - fi - chown ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} /var/www/html - chmod 775 /var/www/html - usermod -a -G ${LIGHTTPD_GROUP} pihole - if [ -x "$(command -v lighty-enable-mod)" ]; then - lighty-enable-mod fastcgi fastcgi-php > /dev/null || true - else - printf "\n:::\tWarning: 'lighty-enable-mod' utility not found. Please ensure fastcgi is enabled if you experience issues.\n" + + if [[ ${INSTALL_WEB} == true ]]; then + if [ ! -d "/var/www/html" ]; then + mkdir -p /var/www/html + fi + chown ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} /var/www/html + chmod 775 /var/www/html + usermod -a -G ${LIGHTTPD_GROUP} pihole + if [ -x "$(command -v lighty-enable-mod)" ]; then + lighty-enable-mod fastcgi fastcgi-php > /dev/null || true + else + printf "\n:::\tWarning: 'lighty-enable-mod' utility not found. Please ensure fastcgi is enabled if you experience issues.\n" + fi fi installScripts installConfigs From bc4762f270673251b2a673b363044d485fc157ad Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 28 Jan 2017 16:27:02 +0000 Subject: [PATCH 13/97] no need to stop dnsmasq/lighttpt if we're going to reload them at the end anyway. --- automated install/basic-install.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index ae7e8c4d..fd135fb7 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1199,11 +1199,7 @@ main() { welcomeDialogs # Create directory for Pi-hole storage mkdir -p /etc/pihole/ - # Stop resolver and webserver while installing proceses - stop_service dnsmasq - if [[ ${INSTALL_WEB} == true ]]; then - stop_service lighttpd - fi + # Determine available interfaces get_available_interfaces # Find interfaces and let the user choose one From 5fede23cf7f344d70c669969b8ddc603c82696a6 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 28 Jan 2017 18:39:15 +0000 Subject: [PATCH 14/97] trying another tactic --- automated install/basic-install.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index fd135fb7..3192c9a7 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1216,21 +1216,27 @@ main() { clone_or_update_repos # Install packages used by the Pi-hole - install_dependent_packages PIHOLE_DEPS[@] if [[ ${INSTALL_WEB} == true ]]; then - install_dependent_packages PIHOLE_WEB_DEPS[@] + DEPS=("${PIHOLE_DEPS}" "${PIHOLE_WEB_DEPS}") + else + DEPS=("${PIHOLE_DEPS}") fi + install_dependent_packages DEPS[@] + # Install and log everything to a file installPihole | tee ${tmpLog} else # Clone/Update the repos clone_or_update_repos - # update packages used by the Pi-hole - install_dependent_packages PIHOLE_DEPS[@] + + # Install packages used by the Pi-hole if [[ ${INSTALL_WEB} == true ]]; then - install_dependent_packages PIHOLE_WEB_DEPS[@] + DEPS=("${PIHOLE_DEPS}" "${PIHOLE_WEB_DEPS}") + else + DEPS=("${PIHOLE_DEPS}") fi + install_dependent_packages DEPS[@] updatePihole | tee ${tmpLog} fi From 90af12fdb8c2779b63ae06b72f0a10fa189caefd Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 28 Jan 2017 18:41:37 +0000 Subject: [PATCH 15/97] Remember the [@] --- automated install/basic-install.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 3192c9a7..053c09d3 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1215,11 +1215,11 @@ main() { # Clone/Update the repos clone_or_update_repos - # Install packages used by the Pi-hole + # Install packages used by the Pi-hole if [[ ${INSTALL_WEB} == true ]]; then - DEPS=("${PIHOLE_DEPS}" "${PIHOLE_WEB_DEPS}") + DEPS=("${PIHOLE_DEPS[@]}" "${PIHOLE_WEB_DEPS[@]}") else - DEPS=("${PIHOLE_DEPS}") + DEPS=("${PIHOLE_DEPS[@]}") fi install_dependent_packages DEPS[@] @@ -1232,9 +1232,9 @@ main() { # Install packages used by the Pi-hole if [[ ${INSTALL_WEB} == true ]]; then - DEPS=("${PIHOLE_DEPS}" "${PIHOLE_WEB_DEPS}") + DEPS=("${PIHOLE_DEPS[@]}" "${PIHOLE_WEB_DEPS[@]}") else - DEPS=("${PIHOLE_DEPS}") + DEPS=("${PIHOLE_DEPS[@]}") fi install_dependent_packages DEPS[@] From 35828f9cea495e486e7c7cdbfede230f27bdc1b7 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 28 Jan 2017 19:05:55 +0000 Subject: [PATCH 16/97] Source setupvars earlier in update/repair process --- automated install/basic-install.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 053c09d3..d7e51ffc 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1024,8 +1024,6 @@ accountForRefactor() { updatePihole() { accountForRefactor - # Source ${setupVars} for use in the rest of the functions. - source ${setupVars} # Install base files and web interface installScripts installConfigs @@ -1230,7 +1228,10 @@ main() { # Clone/Update the repos clone_or_update_repos - # Install packages used by the Pi-hole + # Source ${setupVars} for use in the rest of the functions. + source ${setupVars} + + # Install packages used by the Pi-hole if [[ ${INSTALL_WEB} == true ]]; then DEPS=("${PIHOLE_DEPS[@]}" "${PIHOLE_WEB_DEPS[@]}") else From c31b4383e6a0520fcedce65265a9b7241b8cc186 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 28 Jan 2017 21:37:21 +0000 Subject: [PATCH 17/97] add back in code to stop `dnsmasq` and `lighttpd` during install. --- automated install/basic-install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index d7e51ffc..e8595065 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1198,6 +1198,10 @@ main() { # Create directory for Pi-hole storage mkdir -p /etc/pihole/ + stop_service dnsmasq + if [[ ${INSTALL_WEB} == true ]]; then + stop_service lighttpd + fi # Determine available interfaces get_available_interfaces # Find interfaces and let the user choose one From 297d4eec57ae6be66b4bc28a274744c0516655a5 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 15:44:31 -0800 Subject: [PATCH 18/97] Start test templates. --- automated install/basic-install.sh | 5 +++-- test/test_automated_install.py | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 9fed0bca..1b643c18 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -701,8 +701,9 @@ update_pacakge_cache() { echo ":::" echo -n "::: Updating local cache of available packages..." - ${UPDATE_PKG_CACHE} &> /dev/null - echo " done!" + if ${UPDATE_PKG_CACHE}; then + echo " done!" + fi } notify_package_updates_available() { diff --git a/test/test_automated_install.py b/test/test_automated_install.py index f8e2ec3d..203c7521 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -274,6 +274,15 @@ def test_installPiholeWeb_already_populated_no_errors(Pihole): assert 'index.js' in web_directory assert 'blockingpage.css' in web_directory +def test_update_package_cache_success_no_errors(Pihole): + ''' confirms package cache was updated without any errors''' + updateCache = Pihole.run(''' + source /opt/pihole/basick-install.sh + update_pacakge_cache + ''') + assert 'Updating local cache of available packages...' in updateCache.stdout + assert 'done!' in updateCache.stdout + # Helper functions def mock_command(script, args, container): ''' Allows for setup of commands we don't really want to have to run for real in unit tests ''' From 153a9d8ac71c51bdf4d211d2117af6fb123fa06d Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 15:45:25 -0800 Subject: [PATCH 19/97] Start test templates. --- test/test_automated_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_automated_install.py b/test/test_automated_install.py index 203c7521..7f287c8f 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -277,7 +277,7 @@ def test_installPiholeWeb_already_populated_no_errors(Pihole): def test_update_package_cache_success_no_errors(Pihole): ''' confirms package cache was updated without any errors''' updateCache = Pihole.run(''' - source /opt/pihole/basick-install.sh + source /opt/pihole/basic-install.sh update_pacakge_cache ''') assert 'Updating local cache of available packages...' in updateCache.stdout From 96c59fada44ef451a979d41fe1df8c89d8d1ac81 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 15:47:27 -0800 Subject: [PATCH 20/97] Spelling check. --- automated install/basic-install.sh | 4 ++-- test/test_automated_install.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 1b643c18..003cd312 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -692,7 +692,7 @@ enable_service() { echo " done." } -update_pacakge_cache() { +update_package_cache() { #Running apt-get update/upgrade with minimal output can cause some issues with #requiring user input (e.g password for phpmyadmin see #218) @@ -1128,7 +1128,7 @@ main() { fi # Update package cache - update_pacakge_cache + update_package_cache # Notify user of package availability notify_package_updates_available diff --git a/test/test_automated_install.py b/test/test_automated_install.py index 7f287c8f..c502aef6 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -278,7 +278,7 @@ def test_update_package_cache_success_no_errors(Pihole): ''' confirms package cache was updated without any errors''' updateCache = Pihole.run(''' source /opt/pihole/basic-install.sh - update_pacakge_cache + update_package_cache ''') assert 'Updating local cache of available packages...' in updateCache.stdout assert 'done!' in updateCache.stdout From f65a9dbfd281b3f7e37e3c63d50a06c52bce3929 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 15:49:28 -0800 Subject: [PATCH 21/97] Test for failure. --- test/test_automated_install.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/test_automated_install.py b/test/test_automated_install.py index c502aef6..7096ad91 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -283,6 +283,16 @@ def test_update_package_cache_success_no_errors(Pihole): assert 'Updating local cache of available packages...' in updateCache.stdout assert 'done!' in updateCache.stdout +def test_update_package_cache_failure_no_errors(Pihole): + ''' confirms package cache was updated without any errors''' + mock_command(apt-get, {'*':('', '1')}, Pihole) + updateCache = Pihole.run(''' + source /opt/pihole/basic-install.sh + update_package_cache + ''') + assert 'Updating local cache of available packages...' in updateCache.stdout + assert 'done!' not in updateCache.stdout + # Helper functions def mock_command(script, args, container): ''' Allows for setup of commands we don't really want to have to run for real in unit tests ''' From f9cfed5aff68a53a062c225720bc3534d813d0f5 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 15:56:43 -0800 Subject: [PATCH 22/97] Test for failure. --- test/test_automated_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_automated_install.py b/test/test_automated_install.py index 7096ad91..4ab6e3a3 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -285,7 +285,7 @@ def test_update_package_cache_success_no_errors(Pihole): def test_update_package_cache_failure_no_errors(Pihole): ''' confirms package cache was updated without any errors''' - mock_command(apt-get, {'*':('', '1')}, Pihole) + mock_command('apt-get', {'*':('', '1')}, Pihole) updateCache = Pihole.run(''' source /opt/pihole/basic-install.sh update_package_cache From a7130e6530ac4fbf4b5649ef5aff7be21859418f Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 16:03:48 -0800 Subject: [PATCH 23/97] Eval variable. (Not a fan.) --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 003cd312..9245ff81 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -701,7 +701,7 @@ update_package_cache() { echo ":::" echo -n "::: Updating local cache of available packages..." - if ${UPDATE_PKG_CACHE}; then + if eval ${UPDATE_PKG_CACHE}; then echo " done!" fi } From 737819b56e0d1cf736ac4cc8d73aa5273330f431 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 16:08:43 -0800 Subject: [PATCH 24/97] Populate all required variables with a distro check. --- test/test_automated_install.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/test_automated_install.py b/test/test_automated_install.py index 4ab6e3a3..04db4f1b 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -278,6 +278,7 @@ def test_update_package_cache_success_no_errors(Pihole): ''' confirms package cache was updated without any errors''' updateCache = Pihole.run(''' source /opt/pihole/basic-install.sh + distro_check update_package_cache ''') assert 'Updating local cache of available packages...' in updateCache.stdout @@ -288,6 +289,7 @@ def test_update_package_cache_failure_no_errors(Pihole): mock_command('apt-get', {'*':('', '1')}, Pihole) updateCache = Pihole.run(''' source /opt/pihole/basic-install.sh + distro_check update_package_cache ''') assert 'Updating local cache of available packages...' in updateCache.stdout From 585f8422066df137d2f288a39d2fd0ed7689ac5e Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 16:33:40 -0800 Subject: [PATCH 25/97] Error check. --- automated install/basic-install.sh | 2 ++ test/test_automated_install.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 9245ff81..00635e89 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -703,6 +703,8 @@ update_package_cache() { echo -n "::: Updating local cache of available packages..." if eval ${UPDATE_PKG_CACHE}; then echo " done!" + else + echo -n "\n!!! ERROR - Unable to update package cache. Please try \"${UPDATE_PKG_CACHE}\"" fi } diff --git a/test/test_automated_install.py b/test/test_automated_install.py index 04db4f1b..29bb56d2 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -285,14 +285,15 @@ def test_update_package_cache_success_no_errors(Pihole): assert 'done!' in updateCache.stdout def test_update_package_cache_failure_no_errors(Pihole): - ''' confirms package cache was updated without any errors''' - mock_command('apt-get', {'*':('', '1')}, Pihole) + ''' confirms package cache was not updated''' + mock_command('apt-get', {'update':('', '1')}, Pihole) updateCache = Pihole.run(''' source /opt/pihole/basic-install.sh distro_check update_package_cache ''') assert 'Updating local cache of available packages...' in updateCache.stdout + assert 'ERROR' in updateCache.stdout assert 'done!' not in updateCache.stdout # Helper functions From 2d18b2d7846b154fa48f113efb6a805ce546ecc6 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 15:44:31 -0800 Subject: [PATCH 26/97] Start test templates. --- automated install/basic-install.sh | 9 +++++---- test/test_automated_install.py | 9 +++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 9fed0bca..003cd312 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -692,7 +692,7 @@ enable_service() { echo " done." } -update_pacakge_cache() { +update_package_cache() { #Running apt-get update/upgrade with minimal output can cause some issues with #requiring user input (e.g password for phpmyadmin see #218) @@ -701,8 +701,9 @@ update_pacakge_cache() { echo ":::" echo -n "::: Updating local cache of available packages..." - ${UPDATE_PKG_CACHE} &> /dev/null - echo " done!" + if ${UPDATE_PKG_CACHE}; then + echo " done!" + fi } notify_package_updates_available() { @@ -1127,7 +1128,7 @@ main() { fi # Update package cache - update_pacakge_cache + update_package_cache # Notify user of package availability notify_package_updates_available diff --git a/test/test_automated_install.py b/test/test_automated_install.py index f8e2ec3d..c502aef6 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -274,6 +274,15 @@ def test_installPiholeWeb_already_populated_no_errors(Pihole): assert 'index.js' in web_directory assert 'blockingpage.css' in web_directory +def test_update_package_cache_success_no_errors(Pihole): + ''' confirms package cache was updated without any errors''' + updateCache = Pihole.run(''' + source /opt/pihole/basic-install.sh + update_package_cache + ''') + assert 'Updating local cache of available packages...' in updateCache.stdout + assert 'done!' in updateCache.stdout + # Helper functions def mock_command(script, args, container): ''' Allows for setup of commands we don't really want to have to run for real in unit tests ''' From 2a5587f23677bc65667b89ed7af93c540422201c Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 15:49:28 -0800 Subject: [PATCH 27/97] Test for failure. --- test/test_automated_install.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/test_automated_install.py b/test/test_automated_install.py index c502aef6..4ab6e3a3 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -283,6 +283,16 @@ def test_update_package_cache_success_no_errors(Pihole): assert 'Updating local cache of available packages...' in updateCache.stdout assert 'done!' in updateCache.stdout +def test_update_package_cache_failure_no_errors(Pihole): + ''' confirms package cache was updated without any errors''' + mock_command('apt-get', {'*':('', '1')}, Pihole) + updateCache = Pihole.run(''' + source /opt/pihole/basic-install.sh + update_package_cache + ''') + assert 'Updating local cache of available packages...' in updateCache.stdout + assert 'done!' not in updateCache.stdout + # Helper functions def mock_command(script, args, container): ''' Allows for setup of commands we don't really want to have to run for real in unit tests ''' From a281d87315b4fea1ae3b4e023c050a3a1efe5ad9 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 16:03:48 -0800 Subject: [PATCH 28/97] Eval variable. (Not a fan.) --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 003cd312..9245ff81 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -701,7 +701,7 @@ update_package_cache() { echo ":::" echo -n "::: Updating local cache of available packages..." - if ${UPDATE_PKG_CACHE}; then + if eval ${UPDATE_PKG_CACHE}; then echo " done!" fi } From 54e2c6181a5e5934f84453839e48b86be57712b1 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 16:08:43 -0800 Subject: [PATCH 29/97] Populate all required variables with a distro check. --- test/test_automated_install.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/test_automated_install.py b/test/test_automated_install.py index 4ab6e3a3..04db4f1b 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -278,6 +278,7 @@ def test_update_package_cache_success_no_errors(Pihole): ''' confirms package cache was updated without any errors''' updateCache = Pihole.run(''' source /opt/pihole/basic-install.sh + distro_check update_package_cache ''') assert 'Updating local cache of available packages...' in updateCache.stdout @@ -288,6 +289,7 @@ def test_update_package_cache_failure_no_errors(Pihole): mock_command('apt-get', {'*':('', '1')}, Pihole) updateCache = Pihole.run(''' source /opt/pihole/basic-install.sh + distro_check update_package_cache ''') assert 'Updating local cache of available packages...' in updateCache.stdout From 409f76aa34ea4c3d3b53f87e29ca9854c90c300d Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 16:33:40 -0800 Subject: [PATCH 30/97] Error check. --- automated install/basic-install.sh | 2 ++ test/test_automated_install.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 9245ff81..00635e89 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -703,6 +703,8 @@ update_package_cache() { echo -n "::: Updating local cache of available packages..." if eval ${UPDATE_PKG_CACHE}; then echo " done!" + else + echo -n "\n!!! ERROR - Unable to update package cache. Please try \"${UPDATE_PKG_CACHE}\"" fi } diff --git a/test/test_automated_install.py b/test/test_automated_install.py index 04db4f1b..29bb56d2 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -285,14 +285,15 @@ def test_update_package_cache_success_no_errors(Pihole): assert 'done!' in updateCache.stdout def test_update_package_cache_failure_no_errors(Pihole): - ''' confirms package cache was updated without any errors''' - mock_command('apt-get', {'*':('', '1')}, Pihole) + ''' confirms package cache was not updated''' + mock_command('apt-get', {'update':('', '1')}, Pihole) updateCache = Pihole.run(''' source /opt/pihole/basic-install.sh distro_check update_package_cache ''') assert 'Updating local cache of available packages...' in updateCache.stdout + assert 'ERROR' in updateCache.stdout assert 'done!' not in updateCache.stdout # Helper functions From 7291aa07cabccf2727577a505fb8d42465d05177 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 16:46:37 -0800 Subject: [PATCH 31/97] Silenc cache updater. --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 00635e89..5540166f 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -701,7 +701,7 @@ update_package_cache() { echo ":::" echo -n "::: Updating local cache of available packages..." - if eval ${UPDATE_PKG_CACHE}; then + if eval ${UPDATE_PKG_CACHE} &> /dev/null; then echo " done!" else echo -n "\n!!! ERROR - Unable to update package cache. Please try \"${UPDATE_PKG_CACHE}\"" From 439999cb6274a26985f8e6701bb2a0c5461beaf9 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 16:47:53 -0800 Subject: [PATCH 32/97] Last rule check. --- test/test_automated_install.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_automated_install.py b/test/test_automated_install.py index 29bb56d2..89d9a0e0 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -282,6 +282,7 @@ def test_update_package_cache_success_no_errors(Pihole): update_package_cache ''') assert 'Updating local cache of available packages...' in updateCache.stdout + assert 'ERROR' not in updateCache.stdout assert 'done!' in updateCache.stdout def test_update_package_cache_failure_no_errors(Pihole): From 3861b57dc6bd5144d11a8f53d649dfd1ec4829fe Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 17:32:42 -0800 Subject: [PATCH 33/97] Start moving reused utility functions to one script. --- advanced/Scripts/update.sh | 69 +++--------------------------- automated install/basic-install.sh | 22 ++++++---- 2 files changed, 20 insertions(+), 71 deletions(-) diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh index df71e9a9..426d3580 100755 --- a/advanced/Scripts/update.sh +++ b/advanced/Scripts/update.sh @@ -19,70 +19,13 @@ readonly ADMIN_INTERFACE_DIR="/var/www/html/admin" readonly PI_HOLE_GIT_URL="https://github.com/pi-hole/pi-hole.git" readonly PI_HOLE_FILES_DIR="/etc/.pihole" -is_repo() { - # Use git to check if directory is currently under VCS, return the value - local directory="${1}" - local curdir - local rc +PH_TEST=true +source ${PI_HOLE_GIT_URL}/automated\ install/basic-install.sh - curdir="${PWD}" - cd "${directory}" &> /dev/null || return 1 - git status --short &> /dev/null - rc=$? - cd "${curdir}" &> /dev/null || return 1 - return "${rc}" -} - -prep_repo() { - # Prepare directory for local repository building - local directory="${1}" - - rm -rf "${directory}" &> /dev/null - return -} - -make_repo() { - # Remove the non-repod interface and clone the interface - local remoteRepo="${2}" - local directory="${1}" - - (prep_repo "${directory}" && git clone -q --depth 1 "${remoteRepo}" "${directory}") - return -} - -update_repo() { - local directory="${1}" - local curdir - - curdir="${PWD}" - cd "${directory}" &> /dev/null || return 1 - # Pull the latest commits - # Stash all files not tracked for later retrieval - git stash --all --quiet - # Force a clean working directory for cloning - git clean --force -d - # Fetch latest changes and apply - git pull --quiet - cd "${curdir}" &> /dev/null || return 1 -} - -getGitFiles() { - # Setup git repos for directory and repository passed - # as arguments 1 and 2 - local directory="${1}" - local remoteRepo="${2}" - echo ":::" - echo "::: Checking for existing repository..." - if is_repo "${directory}"; then - echo -n "::: Updating repository in ${directory}..." - update_repo "${directory}" || (echo "*** Error: Could not update local repository. Contact support."; exit 1) - echo " done!" - else - echo -n "::: Cloning ${remoteRepo} into ${directory}..." - make_repo "${directory}" "${remoteRepo}" || (echo "Unable to clone repository, please contact support"; exit 1) - echo " done!" - fi -} +# is_repo() sourced from basic-install.sh +# make_repo() sourced from basic-install.sh +# update_repo() source from basic-install.sh +# getGitFiles() sourced from basic-install.sh GitCheckUpdateAvail() { local directory="${1}" diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 9fed0bca..7d1e09b3 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -149,15 +149,17 @@ make_repo() { update_repo() { local directory="${1}" + local curdir + curdir="${PWD}" + cd "${directory}" &> /dev/null || return 1 # Pull the latest commits echo -n "::: Updating repo in ${1}..." - if [[ -d "${directory}" ]]; then - cd "${directory}" - git stash -q &> /dev/null || true # Okay for stash failure - git pull -q &> /dev/null || return $? - echo " done!" - fi + git stash --all --quiet &> /dev/null || true # Okay for stash failure + git clean --force -d || true # Okay for already clean directory + git pull --quiet &> /dev/null || return $? + echo " done!" + cd "${curdir}" &> /dev/null || return 1 return 0 } @@ -169,9 +171,13 @@ getGitFiles() { echo ":::" echo "::: Checking for existing repository..." if is_repo "${directory}"; then - update_repo "${directory}" || return 1 + echo -n "::: Updating repository in ${directory}..." + update_repo "${directory}" || { echo "*** Error: Could not update local repository. Contact support."; exit 1; } + echo " done!" else - make_repo "${directory}" "${remoteRepo}" || return 1 + echo -n "::: Cloning ${remoteRepo} into ${directory}..." + make_repo "${directory}" "${remoteRepo}" || { echo "Unable to clone repository, please contact support"; exit 1; } + echo " done!" fi return 0 } From 745adabb05a839c942b0a961e9c77aeaa7292f60 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 17:38:14 -0800 Subject: [PATCH 34/97] Path to source basic-install.sh --- advanced/Scripts/update.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh index 426d3580..1db9cfc9 100755 --- a/advanced/Scripts/update.sh +++ b/advanced/Scripts/update.sh @@ -20,7 +20,7 @@ readonly PI_HOLE_GIT_URL="https://github.com/pi-hole/pi-hole.git" readonly PI_HOLE_FILES_DIR="/etc/.pihole" PH_TEST=true -source ${PI_HOLE_GIT_URL}/automated\ install/basic-install.sh +source ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh # is_repo() sourced from basic-install.sh # make_repo() sourced from basic-install.sh @@ -29,7 +29,7 @@ source ${PI_HOLE_GIT_URL}/automated\ install/basic-install.sh GitCheckUpdateAvail() { local directory="${1}" - curdir=$PWD; + curdir=$PWD cd "${directory}" # Fetch latest changes in this repo From 3d9d13222b08a49c7b2b78142a6cce5781501258 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 17:42:55 -0800 Subject: [PATCH 35/97] Use constants for leading paths. --- advanced/Scripts/update.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh index 1db9cfc9..3b32fa73 100755 --- a/advanced/Scripts/update.sh +++ b/advanced/Scripts/update.sh @@ -128,13 +128,13 @@ main() { echo ":::" echo "::: Pi-hole core files out of date" getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}" - /etc/.pihole/automated\ install/basic-install.sh --reconfigure --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 + ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --reconfigure --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 elif ${core_update} && ${web_update} ; then echo ":::" echo "::: Updating Everything" getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}" - /etc/.pihole/automated\ install/basic-install.sh --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 + ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 else echo "*** Update script has malfunctioned, fallthrough reached. Please contact support" exit 1 From 72a1fc3f6438f3346c382991a85275f52857433e Mon Sep 17 00:00:00 2001 From: Markus Napp Date: Wed, 1 Feb 2017 00:07:47 +0100 Subject: [PATCH 36/97] Fix output for wildcards in gravity.sh --- gravity.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gravity.sh b/gravity.sh index 31bc6bd0..c1938229 100755 --- a/gravity.sh +++ b/gravity.sh @@ -239,12 +239,12 @@ gravity_Blacklist() { gravity_Wildcard() { # Return number of wildcards in output - don't actually handle wildcards if [[ -f "${wildcardlist}" ]]; then - num=$(grep -c ^ "${wildcardlist}") + numWildcards=$(grep -c ^ "${wildcardlist}") if [[ -n "${IPV4_ADDRESS}" && -n "${IPV6_ADDRESS}" ]];then - let num/=2 + let numWildcards/=2 fi plural=; [[ "$num" != "1" ]] && plural=s - echo "::: Wildcard blocked domain${plural}: $numBlacklisted" + echo "::: Wildcard blocked domain${plural}: $numWildcards" else echo "::: No wildcards used!" fi From 66616eb0f05fa9cc775dea46d42f0ffd84093841 Mon Sep 17 00:00:00 2001 From: Markus Napp Date: Wed, 1 Feb 2017 19:55:33 +0100 Subject: [PATCH 37/97] Rename missing plurals check --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index c1938229..1c9da96a 100755 --- a/gravity.sh +++ b/gravity.sh @@ -243,7 +243,7 @@ gravity_Wildcard() { if [[ -n "${IPV4_ADDRESS}" && -n "${IPV6_ADDRESS}" ]];then let numWildcards/=2 fi - plural=; [[ "$num" != "1" ]] && plural=s + plural=; [[ "$numWildcards" != "1" ]] && plural=s echo "::: Wildcard blocked domain${plural}: $numWildcards" else echo "::: No wildcards used!" From 26ad23f01ef66d017ce46b72c13b17661e7adfc9 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 1 Feb 2017 18:33:42 -0800 Subject: [PATCH 38/97] Remove comment leaders from DHCPCD interface We need to set the interface in DHCPCD, comments were inadvertently added a while ago. --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 94f26be9..20934618 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -361,7 +361,7 @@ It is also possible to use a DHCP reservation, but if you are going to do that, setDHCPCD() { # Append these lines to dhcpcd.conf to enable a static IP - echo "## interface ${PIHOLE_INTERFACE} + echo "interface ${PIHOLE_INTERFACE} static ip_address=${IPV4_ADDRESS} static routers=${IPv4gw} static domain_name_servers=${IPv4gw}" | tee -a /etc/dhcpcd.conf >/dev/null From f767f066ada9fd2adef5a78895f50842570fa23a Mon Sep 17 00:00:00 2001 From: Jacob Salmela Date: Fri, 3 Feb 2017 15:18:28 -0600 Subject: [PATCH 39/97] Update outdated text and describe features from recent versions --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 561e4f09..6ae8d628 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ wget -O basic-install.sh https://install.pi-hole.net bash basic-install.sh ``` -Once installed, [configure your router to have **DHCP clients use the Pi as their DNS server**](https://discourse.pi-hole.net/t/how-do-i-configure-my-devices-to-use-pi-hole-as-their-dns-server/245) and then any device that connects to your network will have ads blocked without any further configuration. Alternatively, you can manually set each device to [use the Raspberry Pi as its DNS server](http://pi-hole.net/faq/how-do-i-use-the-pi-hole-as-my-dns-server/). +Once installed, [configure your router to have **DHCP clients use the Pi as their DNS server**](https://discourse.pi-hole.net/t/how-do-i-configure-my-devices-to-use-pi-hole-as-their-dns-server/245) and then any device that connects to your network will have ads blocked without any further configuration. Alternatively, you can manually set each device to use Pi-hole as their DNS server. ## What is Pi-hole and how do I install it?

@@ -100,6 +100,17 @@ Domains can be whitelisted and blacklisted using either the web interface or the

+### Settings + +The settings page lets you control and configure your Pi-hole. You can do things like: + +- enable Pi-hole's built-in DHCP server +- exclude domains from the graphs +- configure upstream DNS servers +- and more! + + + ## API A basic read-only API can be accessed at `/admin/api.php`. It returns the following JSON: From fcdd33b585bc941c2d87f190b8264064dcd64687 Mon Sep 17 00:00:00 2001 From: Jacob Salmela Date: Fri, 3 Feb 2017 15:21:42 -0600 Subject: [PATCH 40/97] Update and remove old FAQ links --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6ae8d628..c9f16d9e 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ Once installed, [configure your router to have **DHCP clients use the Pi as thei ## Technical Details -The Pi-hole is an **advertising-aware DNS/Web server**. If an ad domain is queried, a small Web page or GIF is delivered in place of the advertisement. You can also [replace ads with any image you want](http://pi-hole.net/faq/is-it-possible-to-change-the-blank-page-that-takes-place-of-the-ads-to-something-else/) since it is just a simple Webpage taking place of the ads. +The Pi-hole is an **advertising-aware DNS/Web server**. If an ad domain is queried, a small Web page or GIF is delivered in place of the advertisement. ### Gravity @@ -103,7 +103,7 @@ Domains can be whitelisted and blacklisted using either the web interface or the ### Settings The settings page lets you control and configure your Pi-hole. You can do things like: - + - enable Pi-hole's built-in DHCP server - exclude domains from the graphs - configure upstream DNS servers @@ -128,7 +128,7 @@ The same output can be achieved on the CLI by running `chronometer.sh -j` ## Real-time Statistics -You can view [real-time stats](http://pi-hole.net/faq/install-the-real-time-lcd-monitor-chronometer/) via `ssh` or on an [2.8" LCD screen](http://amzn.to/1P0q1Fj). This is accomplished via [`chronometer.sh`](https://github.com/pi-hole/pi-hole/blob/master/advanced/Scripts/chronometer.sh). ![Pi-hole LCD](http://i.imgur.com/nBEqycp.jpg) +You can view [real-time stats](https://discourse.pi-hole.net/t/how-do-i-view-my-pi-holes-stats-over-ssh-or-on-an-lcd-using-chronometer/240) via `ssh` or on an [2.8" LCD screen](http://amzn.to/1P0q1Fj). This is accomplished via [`chronometer.sh`](https://github.com/pi-hole/pi-hole/blob/master/advanced/Scripts/chronometer.sh). ![Pi-hole LCD](http://i.imgur.com/nBEqycp.jpg) ## Pi-hole Projects From ad5c011b6c3d8d933310f1aa697aa3a9f0e1a259 Mon Sep 17 00:00:00 2001 From: Jacob Salmela Date: Fri, 3 Feb 2017 15:33:44 -0600 Subject: [PATCH 41/97] Add new screenshots from latest version --- README.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c9f16d9e..429fc275 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Once installed, [configure your router to have **DHCP clients use the Pi as thei ## What is Pi-hole and how do I install it?

- +

@@ -73,7 +73,7 @@ Once installed, [configure your router to have **DHCP clients use the Pi as thei ## Technical Details -The Pi-hole is an **advertising-aware DNS/Web server**. If an ad domain is queried, a small Web page or GIF is delivered in place of the advertisement. +The Pi-hole is an **advertising-aware DNS/Web server**. If an ad domain is queried, a small Web page or GIF is delivered in place of the advertisement. ### Gravity @@ -91,13 +91,13 @@ The [Web interface](https://github.com/pi-hole/AdminLTE#pi-hole-admin-dashboard) `http://192.168.1.x/admin/index.php` or `http://pi.hole/admin` -![Pi-hole Advanced Stats Dashboard](https://assets.pi-hole.net/static/dashboard.png) +![Pi-hole Advanced Stats Dashboard](https://assets.pi-hole.net/static/dashboard212.png) ### Whitelist and blacklist Domains can be whitelisted and blacklisted using either the web interface or the command line. See [the wiki page](https://github.com/pi-hole/pi-hole/wiki/Whitelisting-and-Blacklisting) for more details

- +

### Settings @@ -109,7 +109,14 @@ The settings page lets you control and configure your Pi-hole. You can do thing - configure upstream DNS servers - and more! +![Settings page](https://assets.pi-hole.net/static/settings212.png) +#### Built-in DHCP Server + +Pi-hole ships with a built-in DHCP server. This allows you to let your network devices use Pi-hole as their DNS server if your router does not let you adjust the DHCP options. +

+ +

## API From e57425df5fc84fbef31e8eb69584ce4238f90e5e Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 4 Feb 2017 15:25:11 +0000 Subject: [PATCH 42/97] 0.0.0.0 instead of pi-holes IP address for redirect purposes --- automated install/basic-install.sh | 39 +++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index e8595065..7bce614e 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -663,19 +663,23 @@ installConfigs() { echo ":::" echo "::: Installing configs..." version_check_dnsmasq - if [ ! -d "/etc/lighttpd" ]; then - mkdir /etc/lighttpd - chown "${USER}":root /etc/lighttpd - elif [ -f "/etc/lighttpd/lighttpd.conf" ]; then - mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig + + #Only mess with lighttpd configs if user has chosen to install web interface + if [[ ${INSTALL_WEB} == true ]]; then + if [ ! -d "/etc/lighttpd" ]; then + mkdir /etc/lighttpd + chown "${USER}":root /etc/lighttpd + elif [ -f "/etc/lighttpd/lighttpd.conf" ]; then + mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig + fi + cp /etc/.pihole/advanced/${LIGHTTPD_CFG} /etc/lighttpd/lighttpd.conf + mkdir -p /var/run/lighttpd + chown ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} /var/run/lighttpd + mkdir -p /var/cache/lighttpd/compress + chown ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} /var/cache/lighttpd/compress + mkdir -p /var/cache/lighttpd/uploads + chown ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} /var/cache/lighttpd/uploads fi - cp /etc/.pihole/advanced/${LIGHTTPD_CFG} /etc/lighttpd/lighttpd.conf - mkdir -p /var/run/lighttpd - chown ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} /var/run/lighttpd - mkdir -p /var/cache/lighttpd/compress - chown ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} /var/cache/lighttpd/compress - mkdir -p /var/cache/lighttpd/uploads - chown ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} /var/cache/lighttpd/uploads } stop_service() { @@ -932,6 +936,17 @@ configureFirewall() { } finalExports() { + + if [[ ${INSTALL_WEB} == false ]]; then + #No web interface installed, and therefore no block page set IPV4/6 to 0.0.0.0 and ::/0 + if [ ${IPV4_ADDRESS} ]; then + IPV4_ADDRESS="0.0.0.0" + fi + if [ ${IPV6_ADDRESS} ]; then + IPV6_ADDRESS="::/0" + fi + fi + # Update variables in setupVars.conf file if [ -e "${setupVars}" ]; then sed -i.update.bak '/PIHOLE_INTERFACE/d;/IPV4_ADDRESS/d;/IPV6_ADDRESS/d;/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;/QUERY_LOGGING/d;' "${setupVars}" From 1428b58dde3d5be8b185139f89875eda0a00c70b Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 5 Feb 2017 19:07:04 +0000 Subject: [PATCH 43/97] source setupVars and only check admin repo if it is enabled --- advanced/Scripts/update.sh | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh index df71e9a9..a77d0bc4 100755 --- a/advanced/Scripts/update.sh +++ b/advanced/Scripts/update.sh @@ -19,6 +19,8 @@ readonly ADMIN_INTERFACE_DIR="/var/www/html/admin" readonly PI_HOLE_GIT_URL="https://github.com/pi-hole/pi-hole.git" readonly PI_HOLE_FILES_DIR="/etc/.pihole" +source /etc/pihole/setupVars.conf + is_repo() { # Use git to check if directory is currently under VCS, return the value local directory="${1}" @@ -137,8 +139,8 @@ main() { local web_version_current #This is unlikely - if ! is_repo "${PI_HOLE_FILES_DIR}" || ! is_repo "${ADMIN_INTERFACE_DIR}" ; then - echo "::: Critical Error: One or more Pi-Hole repos are missing from system!" + if ! is_repo "${PI_HOLE_FILES_DIR}" ; then + echo "::: Critical Error: Core Pi-Hole repo is missing from system!" echo "::: Please re-run install script from https://github.com/pi-hole/pi-hole" exit 1; fi @@ -153,12 +155,20 @@ main() { echo "::: Pi-hole Core: up to date" fi - if GitCheckUpdateAvail "${ADMIN_INTERFACE_DIR}" ; then - web_update=true - echo "::: Web Interface: update available" - else - web_update=false - echo "::: Web Interface: up to date" + if [[ ${INSTALL_WEB} == true ]]; then + if ! is_repo "${ADMIN_INTERFACE_DIR}" ; then + echo "::: Critical Error: Web Admin repo is missing from system!" + echo "::: Please re-run install script from https://github.com/pi-hole/pi-hole" + exit 1; + fi + + if GitCheckUpdateAvail "${ADMIN_INTERFACE_DIR}" ; then + web_update=true + echo "::: Web Interface: update available" + else + web_update=false + echo "::: Web Interface: up to date" + fi fi # Logic From ba0abdb88d9ad67f02467c5d6d7285e1ce61077a Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 5 Feb 2017 19:12:09 +0000 Subject: [PATCH 44/97] wrap update logic in admin_installed bool check --- advanced/Scripts/update.sh | 96 ++++++++++++++++++++++---------------- 1 file changed, 55 insertions(+), 41 deletions(-) diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh index a77d0bc4..436a5ae6 100755 --- a/advanced/Scripts/update.sh +++ b/advanced/Scripts/update.sh @@ -169,57 +169,71 @@ main() { web_update=false echo "::: Web Interface: up to date" fi - fi - # Logic - # If Core up to date AND web up to date: - # Do nothing - # If Core up to date AND web NOT up to date: - # Pull web repo - # If Core NOT up to date AND web up to date: - # pull pihole repo, run install --unattended -- reconfigure - # if Core NOT up to date AND web NOT up to date: - # pull pihole repo run install --unattended + # Logic + # If Core up to date AND web up to date: + # Do nothing + # If Core up to date AND web NOT up to date: + # Pull web repo + # If Core NOT up to date AND web up to date: + # pull pihole repo, run install --unattended -- reconfigure + # if Core NOT up to date AND web NOT up to date: + # pull pihole repo run install --unattended - if ! ${core_update} && ! ${web_update} ; then - echo ":::" - echo "::: Everything is up to date!" - exit 0 + if ! ${core_update} && ! ${web_update} ; then + echo ":::" + echo "::: Everything is up to date!" + exit 0 - elif ! ${core_update} && ${web_update} ; then - echo ":::" - echo "::: Pi-hole Web Admin files out of date" - getGitFiles "${ADMIN_INTERFACE_DIR}" "${ADMIN_INTERFACE_GIT_URL}" + elif ! ${core_update} && ${web_update} ; then + echo ":::" + echo "::: Pi-hole Web Admin files out of date" + getGitFiles "${ADMIN_INTERFACE_DIR}" "${ADMIN_INTERFACE_GIT_URL}" - elif ${core_update} && ! ${web_update} ; then - echo ":::" - echo "::: Pi-hole core files out of date" - getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}" - /etc/.pihole/automated\ install/basic-install.sh --reconfigure --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 + elif ${core_update} && ! ${web_update} ; then + echo ":::" + echo "::: Pi-hole core files out of date" + getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}" + /etc/.pihole/automated\ install/basic-install.sh --reconfigure --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 - elif ${core_update} && ${web_update} ; then - echo ":::" - echo "::: Updating Everything" - getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}" - /etc/.pihole/automated\ install/basic-install.sh --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 + elif ${core_update} && ${web_update} ; then + echo ":::" + echo "::: Updating Everything" + getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}" + /etc/.pihole/automated\ install/basic-install.sh --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 + else + echo "*** Update script has malfunctioned, fallthrough reached. Please contact support" + exit 1 + fi else - echo "*** Update script has malfunctioned, fallthrough reached. Please contact support" - exit 1 + + if ! ${core_update}; then + echo ":::" + echo "::: Everything is up to date!" + exit 0 + else + echo ":::" + echo "::: Pi-hole core files out of date" + getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}" + /etc/.pihole/automated\ install/basic-install.sh --reconfigure --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 + fi fi if [[ "${web_update}" == true ]]; then - web_version_current="$(/usr/local/bin/pihole version --admin --current)" - echo ":::" - echo "::: Web Admin version is now at ${web_version_current}" - echo "::: If you had made any changes in '/var/www/html/admin/', they have been stashed using 'git stash'" - fi + web_version_current="$(/usr/local/bin/pihole version --admin --current)" + echo ":::" + echo "::: Web Admin version is now at ${web_version_current}" + echo "::: If you had made any changes in '/var/www/html/admin/', they have been stashed using 'git stash'" + fi + + if [[ "${core_update}" == true ]]; then + pihole_version_current="$(/usr/local/bin/pihole version --pihole --current)" + echo ":::" + echo "::: Pi-hole version is now at ${pihole_version_current}" + echo "::: If you had made any changes in '/etc/.pihole/', they have been stashed using 'git stash'" + fi + - if [[ "${core_update}" == true ]]; then - pihole_version_current="$(/usr/local/bin/pihole version --pihole --current)" - echo ":::" - echo "::: Pi-hole version is now at ${pihole_version_current}" - echo "::: If you had made any changes in '/etc/.pihole/', they have been stashed using 'git stash'" - fi echo "" exit 0 From b764d17c64700ccd52670e2c336a83fc52ffdd73 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 5 Feb 2017 19:15:27 +0000 Subject: [PATCH 45/97] comment --- advanced/Scripts/update.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh index 436a5ae6..eef0ede5 100755 --- a/advanced/Scripts/update.sh +++ b/advanced/Scripts/update.sh @@ -18,8 +18,9 @@ readonly ADMIN_INTERFACE_GIT_URL="https://github.com/pi-hole/AdminLTE.git" readonly ADMIN_INTERFACE_DIR="/var/www/html/admin" readonly PI_HOLE_GIT_URL="https://github.com/pi-hole/pi-hole.git" readonly PI_HOLE_FILES_DIR="/etc/.pihole" - -source /etc/pihole/setupVars.conf +INSTALL_WEB="" +readonly SETUP_VARS="/etc/pihole/setupVars.conf" +source ${SETUP_VARS} is_repo() { # Use git to check if directory is currently under VCS, return the value @@ -205,7 +206,8 @@ main() { echo "*** Update script has malfunctioned, fallthrough reached. Please contact support" exit 1 fi - else + + else # Web Admin not installed, so only verify if core is up to date if ! ${core_update}; then echo ":::" @@ -220,20 +222,18 @@ main() { fi if [[ "${web_update}" == true ]]; then - web_version_current="$(/usr/local/bin/pihole version --admin --current)" - echo ":::" - echo "::: Web Admin version is now at ${web_version_current}" - echo "::: If you had made any changes in '/var/www/html/admin/', they have been stashed using 'git stash'" - fi - - if [[ "${core_update}" == true ]]; then - pihole_version_current="$(/usr/local/bin/pihole version --pihole --current)" - echo ":::" - echo "::: Pi-hole version is now at ${pihole_version_current}" - echo "::: If you had made any changes in '/etc/.pihole/', they have been stashed using 'git stash'" - fi - + web_version_current="$(/usr/local/bin/pihole version --admin --current)" + echo ":::" + echo "::: Web Admin version is now at ${web_version_current}" + echo "::: If you had made any changes in '/var/www/html/admin/', they have been stashed using 'git stash'" + fi + if [[ "${core_update}" == true ]]; then + pihole_version_current="$(/usr/local/bin/pihole version --pihole --current)" + echo ":::" + echo "::: Pi-hole version is now at ${pihole_version_current}" + echo "::: If you had made any changes in '/etc/.pihole/', they have been stashed using 'git stash'" + fi echo "" exit 0 From 1206dda34769d221edc7914f50d5e009ee97a54d Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 5 Feb 2017 19:23:04 +0000 Subject: [PATCH 46/97] testing putting `runGravity` at a different part of the script --- automated install/basic-install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 7bce614e..9dcceab2 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1019,7 +1019,7 @@ installPihole() { installLogrotate configureFirewall finalExports - runGravity + #runGravity } accountForRefactor() { @@ -1049,7 +1049,7 @@ updatePihole() { installCron installLogrotate finalExports #re-export setupVars.conf to account for any new vars added in new versions - runGravity + #runGravity } @@ -1283,6 +1283,8 @@ main() { enable_service lighttpd fi + runGravity + echo "::: done." if [[ "${useUpdateVars}" == false ]]; then From 10a30344e5cd8959c74cb79c52fed33950907dd0 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 5 Feb 2017 19:29:56 +0000 Subject: [PATCH 47/97] No need to source setupVars, as basic-install.sh is sourced, which sources setupVars itself. Sourception. --- advanced/Scripts/update.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh index eef0ede5..4e1f63a9 100755 --- a/advanced/Scripts/update.sh +++ b/advanced/Scripts/update.sh @@ -18,9 +18,6 @@ readonly ADMIN_INTERFACE_GIT_URL="https://github.com/pi-hole/AdminLTE.git" readonly ADMIN_INTERFACE_DIR="/var/www/html/admin" readonly PI_HOLE_GIT_URL="https://github.com/pi-hole/pi-hole.git" readonly PI_HOLE_FILES_DIR="/etc/.pihole" -INSTALL_WEB="" -readonly SETUP_VARS="/etc/pihole/setupVars.conf" -source ${SETUP_VARS} is_repo() { # Use git to check if directory is currently under VCS, return the value From 8fb6ba19a10c95312a163a47d4fb390ac9951c54 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 6 Feb 2017 12:06:38 +0100 Subject: [PATCH 48/97] Remove double echos --- automated install/basic-install.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 70c27fc9..7995d1dd 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -171,11 +171,9 @@ getGitFiles() { echo ":::" echo "::: Checking for existing repository..." if is_repo "${directory}"; then - echo -n "::: Updating repository in ${directory}..." update_repo "${directory}" || { echo "*** Error: Could not update local repository. Contact support."; exit 1; } echo " done!" else - echo -n "::: Cloning ${remoteRepo} into ${directory}..." make_repo "${directory}" "${remoteRepo}" || { echo "Unable to clone repository, please contact support"; exit 1; } echo " done!" fi From a48317883dd6ddc06c79113471433a2cdac48b7f Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Tue, 7 Feb 2017 18:14:41 -0500 Subject: [PATCH 49/97] Fix indentation --- advanced/Scripts/update.sh | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh index ecd9e86b..10847ead 100755 --- a/advanced/Scripts/update.sh +++ b/advanced/Scripts/update.sh @@ -131,24 +131,22 @@ main() { echo "::: Pi-hole Web Admin files out of date" getGitFiles "${ADMIN_INTERFACE_DIR}" "${ADMIN_INTERFACE_GIT_URL}" - elif ${core_update} && ! ${web_update} ; then - echo ":::" - echo "::: Pi-hole core files out of date" - getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}" - ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --reconfigure --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 - - elif ${core_update} && ${web_update} ; then - echo ":::" - echo "::: Updating Everything" - getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}" - ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 - else - echo "*** Update script has malfunctioned, fallthrough reached. Please contact support" - exit 1 - fi + elif ${core_update} && ! ${web_update} ; then + echo ":::" + echo "::: Pi-hole core files out of date" + getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}" + ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --reconfigure --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 + elif ${core_update} && ${web_update} ; then + echo ":::" + echo "::: Updating Everything" + getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}" + ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 + else + echo "*** Update script has malfunctioned, fallthrough reached. Please contact support" + exit 1 + fi else # Web Admin not installed, so only verify if core is up to date - if ! ${core_update}; then echo ":::" echo "::: Everything is up to date!" From afe5176e017bcb9861a48d182cae5d19ce96209f Mon Sep 17 00:00:00 2001 From: Markus Napp Date: Wed, 8 Feb 2017 12:41:53 +0100 Subject: [PATCH 50/97] Justify help output to match main script --- advanced/Scripts/list.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/advanced/Scripts/list.sh b/advanced/Scripts/list.sh index 7cbe6beb..b465bdb6 100755 --- a/advanced/Scripts/list.sh +++ b/advanced/Scripts/list.sh @@ -42,11 +42,11 @@ helpFunc() { ::: Usage: pihole -${letter} domain1 [domain2 ...] ::: ::: Options: -::: -d, --delmode Remove domains from the ${word}list -::: -nr, --noreload Update ${word}list without refreshing dnsmasq -::: -q, --quiet output is less verbose -::: -h, --help Show this help dialog -::: -l, --list Display your ${word}listed domains +::: -d, --delmode Remove domains from the ${word}list +::: -nr, --noreload Update ${word}list without refreshing dnsmasq +::: -q, --quiet Output is less verbose +::: -h, --help Show this help dialog +::: -l, --list Display your ${word}listed domains EOM if [[ "${letter}" == "b" ]]; then echo "::: -wild, --wildcard Add whitecard entry (only blacklist)" @@ -229,4 +229,3 @@ PoplistFile if ${reload}; then Reload fi - From 19e30b829ab913fae62001842443ee70aafae710 Mon Sep 17 00:00:00 2001 From: Markus Napp Date: Wed, 8 Feb 2017 12:42:14 +0100 Subject: [PATCH 51/97] Add wildcard description to help text, improve other help texts --- pihole | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pihole b/pihole index 89c22ec8..b3fc2367 100755 --- a/pihole +++ b/pihole @@ -274,19 +274,20 @@ helpFunc() { ::: Add -h after -w (whitelist), -b (blacklist), -c (chronometer), or -a (admin) for more information on usage ::: ::: Options: -::: -w, whitelist Whitelist domains -::: -b, blacklist Blacklist domains -::: -d, debug Start a debugging session if having trouble -::: -f, flush Flush the pihole.log file -::: -t, tail Output the last lines of the pihole.log file. Lines are appended as the file grows -::: -up, updatePihole Update Pi-hole +::: -w, whitelist Whitelist domain(s) +::: -b, blacklist Blacklist domain(s) (exact match) +::: -wild, wildcard Blacklist whole domain(s) (wildcard) +::: -d, debug Start a debugging session +::: -f, flush Flush the 'pihole.log' file +::: -t, tail Output the last lines of the 'pihole.log' file. Lines are appended as the file grows +::: -up, updatePihole Update Pi-hole components ::: -r, reconfigure Reconfigure or Repair Pi-hole ::: -g, updateGravity Update the list of ad-serving domains ::: -c, chronometer Calculates stats and displays to an LCD ::: -h, help Show this help dialog -::: -v, version Show current versions +::: -v, version Show installed versions of Pi-Hole and Web-Admin ::: -q, query Query the adlists for a specific domain -::: Use pihole -q domain -exact if you want to see exact matches only +::: Use 'pihole -q domain -exact' if you want to see exact matches only ::: -l, logging Enable or Disable logging (pass 'on' or 'off') ::: -a, admin Admin webpage options ::: uninstall Uninstall Pi-Hole from your system :(! @@ -294,7 +295,7 @@ helpFunc() { ::: enable Enable Pi-Hole DNS Blocking ::: disable Disable Pi-Hole DNS Blocking ::: Blocking can also be disabled only temporarily, e.g., -::: pihole disable 5m - will disable blocking for 5 minutes +::: 'pihole disable 5m' - will disable blocking for 5 minutes ::: restartdns Restart dnsmasq EOM exit 0 From 8037f3e3323a20c01725979f0f5b0be787d64fbb Mon Sep 17 00:00:00 2001 From: Markus Napp Date: Wed, 8 Feb 2017 12:55:14 +0100 Subject: [PATCH 52/97] Fix spacing for wildcard help in list script --- advanced/Scripts/list.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/list.sh b/advanced/Scripts/list.sh index b465bdb6..64a24bf3 100755 --- a/advanced/Scripts/list.sh +++ b/advanced/Scripts/list.sh @@ -49,7 +49,7 @@ helpFunc() { ::: -l, --list Display your ${word}listed domains EOM if [[ "${letter}" == "b" ]]; then - echo "::: -wild, --wildcard Add whitecard entry (only blacklist)" + echo "::: -wild, --wildcard Add wildcard entry (only blacklist)" fi exit 0 } From 01f643e5eb2f5c851fdbdbcaace81ecae459c0ab Mon Sep 17 00:00:00 2001 From: Markus Napp Date: Wed, 8 Feb 2017 12:56:28 +0100 Subject: [PATCH 53/97] fixup! Fix spacing for wildcard help in list script --- advanced/Scripts/list.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/list.sh b/advanced/Scripts/list.sh index 64a24bf3..4634837a 100755 --- a/advanced/Scripts/list.sh +++ b/advanced/Scripts/list.sh @@ -49,7 +49,7 @@ helpFunc() { ::: -l, --list Display your ${word}listed domains EOM if [[ "${letter}" == "b" ]]; then - echo "::: -wild, --wildcard Add wildcard entry (only blacklist)" + echo "::: -wild, --wildcard Add wildcard entry (only blacklist)" fi exit 0 } From 34f326c55970e57f9ff2675696291af29b4bfada Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 8 Feb 2017 14:13:49 -0800 Subject: [PATCH 54/97] Update basic-install.sh --- automated install/basic-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 7995d1dd..469cd393 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -77,8 +77,8 @@ if command -v apt-get &> /dev/null; then phpVer="php5" fi # ######################################### - INSTALLER_DEPS=(apt-utils debconf dhcpcd5 git whiptail) - PIHOLE_DEPS=(bc cron curl dnsmasq dnsutils ${iproute_pkg} iputils-ping lighttpd lsof netcat ${phpVer}-common ${phpVer}-cgi sudo unzip wget) + INSTALLER_DEPS=(apt-utils debconf dhcpcd5 git ${iproute_pkg} whiptail) + PIHOLE_DEPS=(bc cron curl dnsmasq dnsutils iputils-ping lighttpd lsof netcat ${phpVer}-common ${phpVer}-cgi sudo unzip wget) LIGHTTPD_USER="www-data" LIGHTTPD_GROUP="www-data" LIGHTTPD_CFG="lighttpd.conf.debian" From 357f5a2cfd2a4eb0a98fcbfaec80a369e43d1d90 Mon Sep 17 00:00:00 2001 From: ProtoFoo Date: Thu, 9 Feb 2017 16:46:55 +0100 Subject: [PATCH 55/97] Add manual edit warning Added text block from dns config file to warn user that manual changes to lighttpd config will be overwritten. Slight cosmetic adjustments (tabs -> spaces). --- advanced/lighttpd.conf.debian | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/advanced/lighttpd.conf.debian b/advanced/lighttpd.conf.debian index 01f52a85..53db2167 100644 --- a/advanced/lighttpd.conf.debian +++ b/advanced/lighttpd.conf.debian @@ -9,6 +9,14 @@ # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. +############################################################################### +# FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE. # +# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE # +# # +# CHANGES SHOULD BE MADE IN A SEPERATE CONFIG FILE: # +# /etc/lighttpd/external.conf # +############################################################################### + server.modules = ( "mod_access", "mod_accesslog", @@ -21,15 +29,15 @@ server.modules = ( ) server.document-root = "/var/www/html" -server.error-handler-404 = "pihole/index.php" +server.error-handler-404 = "pihole/index.php" server.upload-dirs = ( "/var/cache/lighttpd/uploads" ) server.errorlog = "/var/log/lighttpd/error.log" server.pid-file = "/var/run/lighttpd.pid" server.username = "www-data" server.groupname = "www-data" server.port = 80 -accesslog.filename = "/var/log/lighttpd/access.log" -accesslog.format = "%{%s}t|%V|%r|%s|%b" +accesslog.filename = "/var/log/lighttpd/access.log" +accesslog.format = "%{%s}t|%V|%r|%s|%b" index-file.names = ( "index.php", "index.html", "index.lighttpd.html" ) From 162d9d7d57aaabd1ca5a91b4a9826f9951616169 Mon Sep 17 00:00:00 2001 From: ProtoFoo Date: Thu, 9 Feb 2017 17:00:52 +0100 Subject: [PATCH 56/97] Add manual edit warning Added text block from 01-pihole.conf to warn user that manual changes to lighttpd config will be overwritten. Slight cosmetic adjustments (tabs -> spaces). --- advanced/lighttpd.conf.fedora | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/advanced/lighttpd.conf.fedora b/advanced/lighttpd.conf.fedora index d2af5bd4..6c5b035b 100644 --- a/advanced/lighttpd.conf.fedora +++ b/advanced/lighttpd.conf.fedora @@ -9,6 +9,14 @@ # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. +############################################################################### +# FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE. # +# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE # +# # +# CHANGES SHOULD BE MADE IN A SEPERATE CONFIG FILE: # +# /etc/lighttpd/external.conf # +############################################################################### + server.modules = ( "mod_access", "mod_auth", @@ -22,15 +30,15 @@ server.modules = ( ) server.document-root = "/var/www/html" -server.error-handler-404 = "pihole/index.php" +server.error-handler-404 = "pihole/index.php" server.upload-dirs = ( "/var/cache/lighttpd/uploads" ) server.errorlog = "/var/log/lighttpd/error.log" server.pid-file = "/var/run/lighttpd.pid" server.username = "lighttpd" server.groupname = "lighttpd" server.port = 80 -accesslog.filename = "/var/log/lighttpd/access.log" -accesslog.format = "%{%s}t|%V|%r|%s|%b" +accesslog.filename = "/var/log/lighttpd/access.log" +accesslog.format = "%{%s}t|%V|%r|%s|%b" index-file.names = ( "index.php", "index.html", "index.lighttpd.html" ) From 692292b1d48c35b6b1574f8e8a680c81b5a65d9e Mon Sep 17 00:00:00 2001 From: Ian Oliver Date: Fri, 10 Feb 2017 11:22:14 +0000 Subject: [PATCH 57/97] Spelling corrections in comments --- adlists.default | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adlists.default b/adlists.default index 3c4ea8ed..0249ee54 100644 --- a/adlists.default +++ b/adlists.default @@ -23,7 +23,7 @@ https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt # hosts-file.net list. Updated frequently, but has been known to block legitimate sites. https://hosts-file.net/ad_servers.txt -# Mahakala list. Has been known to block legitimage domains including the entire .com range. +# Mahakala list. Has been known to block legitimate domains including the entire .com range. # Warning: Due to the sheer size of this list, the web admin console will be unresponsive. #http://adblock.mahakala.is/ @@ -49,5 +49,5 @@ https://hosts-file.net/ad_servers.txt # Following two lists should be used simultaneously: (readme https://github.com/notracking/hosts-blocklists/) #https://raw.github.com/notracking/hosts-blocklists/master/hostnames.txt #https://raw.github.com/notracking/hosts-blocklists/master/domains.txt -# Combination of serveral host files on the internet (warning some facebook domains are also blocked but you can go to facebook.com). See https://github.com/mat1th/Dns-add-block for more information. +# Combination of several host files on the internet (warning some facebook domains are also blocked but you can go to facebook.com). See https://github.com/mat1th/Dns-add-block for more information. #https://raw.githubusercontent.com/mat1th/Dns-add-block/master/hosts From 99fab7e52ace24302530a992bec44164e64fb280 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 10 Feb 2017 17:42:37 +0100 Subject: [PATCH 58/97] Scan whole dnsmasq.d directory for cofigurations files --- advanced/Scripts/piholeDebug.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index f763d2b8..43d78750 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -16,7 +16,7 @@ set -o pipefail VARSFILE="/etc/pihole/setupVars.conf" DEBUG_LOG="/var/log/pihole_debug.log" DNSMASQFILE="/etc/dnsmasq.conf" -DNSMASQCONFFILE="/etc/dnsmasq.d/01-pihole.conf" +DNSMASQCONFDIR="/etc/dnsmasq.d/*" LIGHTTPDFILE="/etc/lighttpd/lighttpd.conf" LIGHTTPDERRFILE="/var/log/lighttpd/error.log" GRAVITYFILE="/etc/pihole/gravity.list" @@ -132,15 +132,27 @@ version_check() { return "${error_found}" } +dir_check() { + header_write "Detecting contents of ${1}:" + for file in $1*; do + header_write "File ${file} found" + echo -n "::: Parsing..." + file_parse "${file}" + echo "done" + done + echo ":::" +} + files_check() { #Check non-zero length existence of ${1} header_write "Detecting existence of ${1}:" local search_file="${1}" if [[ -s ${search_file} ]]; then - echo "::: File exists" + echo -n "::: File exists, parsing..." file_parse "${search_file}" + echo "done" return 0 - else + else log_echo "${1} not found!" return 1 fi @@ -353,7 +365,7 @@ testResolver debugLighttpd files_check "${DNSMASQFILE}" -files_check "${DNSMASQCONFFILE}" +dir_check "${DNSMASQCONFDIR}" files_check "${WHITELISTFILE}" files_check "${BLACKLISTFILE}" files_check "${ADLISTFILE}" From 01f980d49ccdcb1296d36591a917ec5bd5fbff9e Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 10 Feb 2017 17:45:20 +0100 Subject: [PATCH 59/97] Change description as we want to save the debug log for 48h instead of only 24h --- advanced/Scripts/piholeDebug.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index f763d2b8..ca8c629d 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -35,7 +35,7 @@ cat << EOM ::: This process collects information from your Pi-hole, and optionally uploads ::: it to a unique and random directory on tricorder.pi-hole.net. ::: -::: NOTE: All log files auto-delete after 24 hours and ONLY the Pi-hole developers +::: NOTE: All log files auto-delete after 48 hours and ONLY the Pi-hole developers ::: can access your data via the given token. We have taken these extra steps to ::: secure your data and will work to further reduce any personal information gathered. ::: From 26cb6a19292fcfc3e4241dce9ecfb4ebc24ade96 Mon Sep 17 00:00:00 2001 From: Jacob Salmela Date: Sat, 11 Feb 2017 20:46:27 -0600 Subject: [PATCH 60/97] redirect pi.hole to pi.hole/admin --- advanced/lighttpd.conf.debian | 5 +++++ advanced/lighttpd.conf.fedora | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/advanced/lighttpd.conf.debian b/advanced/lighttpd.conf.debian index 53db2167..f9c96221 100644 --- a/advanced/lighttpd.conf.debian +++ b/advanced/lighttpd.conf.debian @@ -70,5 +70,10 @@ $HTTP["url"] =~ "^(?!/admin)/.*" { setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." ) } +$HTTP["host"] =~ "pi.hole$" { + setenv.add-response-header = ( "X-Pi-hole" => "Redirecting pi.hole to /admin." ) + url.rewrite = ( "^(.*)" => "/admin$1" ) +} + # Add user chosen options held in external file include_shell "cat external.conf 2>/dev/null" diff --git a/advanced/lighttpd.conf.fedora b/advanced/lighttpd.conf.fedora index 6c5b035b..2dec05e4 100644 --- a/advanced/lighttpd.conf.fedora +++ b/advanced/lighttpd.conf.fedora @@ -87,5 +87,10 @@ $HTTP["url"] =~ "^(?!/admin)/.*" { setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." ) } +$HTTP["host"] =~ "pi.hole$" { + setenv.add-response-header = ( "X-Pi-hole" => "Redirecting pi.hole to /admin." ) + url.rewrite = ( "^(.*)" => "/admin$1" ) +} + # Add user chosen options held in external file include_shell "cat external.conf 2>/dev/null" From 6b8240d4de8df4156b59a55a43b345cfc474590f Mon Sep 17 00:00:00 2001 From: Jacob Salmela Date: Tue, 14 Feb 2017 20:25:11 -0600 Subject: [PATCH 61/97] add magic mirror project link to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 429fc275..48ce7af0 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,7 @@ You can view [real-time stats](https://discourse.pi-hole.net/t/how-do-i-view-my- ## Pi-hole Projects +- [An ad blocking Magic Mirror](https://zonksec.com/blog/magic-mirror-dns-filtering/#dnssoftware) - [Pi-hole stats in your Mac's menu bar](https://getbitbar.com/plugins/Network/pi-hole.1m.py) - [Get LED alerts for each blocked ad](http://thetimmy.silvernight.org/pages/endisbutton/) - [Pi-hole on Ubuntu 14.04 on VirtualBox](http://hbalagtas.blogspot.com/2016/02/adblocking-with-pi-hole-and-ubuntu-1404.html) From c89bca6ec8acb12d8656fe61f7252df7a61101b2 Mon Sep 17 00:00:00 2001 From: Ian Oliver Date: Wed, 15 Feb 2017 21:31:42 +0000 Subject: [PATCH 62/97] Update malwaredomains.com and mahakala.is URLs to HTTPS --- adlists.default | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adlists.default b/adlists.default index 3c4ea8ed..a7f2ce97 100644 --- a/adlists.default +++ b/adlists.default @@ -14,7 +14,7 @@ https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts # Other lists we consider safe: -http://mirror1.malwaredomains.com/files/justdomains +https://mirror1.malwaredomains.com/files/justdomains http://sysctl.org/cameleon/hosts https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt @@ -25,7 +25,7 @@ https://hosts-file.net/ad_servers.txt # Mahakala list. Has been known to block legitimage domains including the entire .com range. # Warning: Due to the sheer size of this list, the web admin console will be unresponsive. -#http://adblock.mahakala.is/ +#https://adblock.mahakala.is/ # ADZHOSTS list. Has been known to block legitimate domains #http://pilotfiber.dl.sourceforge.net/project/adzhosts/HOSTS.txt From cfed3d59e9d86d6c623424ad2d4fe6af70fbd011 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 16 Feb 2017 16:49:14 -0800 Subject: [PATCH 63/97] Begin fixing IP detection functions. --- advanced/Scripts/piholeDebug.sh | 36 ++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 74d2f05c..d374cfad 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -26,7 +26,7 @@ ADLISTFILE="/etc/pihole/adlists.list" PIHOLELOG="/var/log/pihole.log" WHITELISTMATCHES="/tmp/whitelistmatches.list" -IPV6_READY=false +IPV6_READY TIMEOUT=60 # Header info and introduction cat << EOM @@ -180,7 +180,7 @@ processor_check() { ipv6_check() { # Check if system is IPv6 enabled, for use in other functions - if [[ $IPv6_address ]]; then + if [[ $IPV6_ADDRESS ]]; then ls /proc/net/if_inet6 &>/dev/null && IPV6_READY=true return 0 else @@ -196,21 +196,30 @@ ip_check() { # Check if IPv6 enabled local IPv6_interface local IPv4_interface - ipv6_check && IPv6_interface=${piholeInterface:-$(ip -6 r | grep default | cut -d ' ' -f 5)} + if ipv6_check; then + IPv6_interface=${PIHOLE_INTERFACE:-$(ip -6 r | grep default | cut -d ' ' -f 5)} + echo ${PIHOLE_INTERFACE} + echo ${IPv6_interface} + fi # If declared in setupVars.conf use it, otherwise defer to default # http://stackoverflow.com/questions/2013547/assigning-default-values-to-shell-variables-with-a-single-command-in-bash - IPv4_interface=${piholeInterface:-$(ip r | grep default | cut -d ' ' -f 5)} + IPv4_interface=${PIHOLE_INTERFACE:-$(ip r | grep default | cut -d ' ' -f 5)} - if [[ IPV6_READY ]]; then - local IPv6_addr_list="$(ip a | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "inet6") print $(i+1) }')" \ - && (log_write "${IPv6_addr_list}" && echo "::: IPv6 addresses located") \ - || log_echo "No IPv6 addresses found." + if [[ "$IPV6_READY" = true ]]; then + local IPv6_addr_list="$(ip a | awk -F ' ' '{ for(i=1;i<=NF;i++) if ($i == "inet6") print $(i+1) }')" + if [[ -n ${IPv6_addr_list} ]]; then + log_write "${IPv6_addr_list}" + echo "::: IPv6 addresses located" + else + log_echo "No IPv6 addresses found." + return 0 + fi local IPv6_def_gateway=$(ip -6 r | grep default | cut -d ' ' -f 3) if [[ $? = 0 ]] && [[ -n ${IPv6_def_gateway} ]]; then echo -n "::: Pinging default IPv6 gateway: " - local IPv6_def_gateway_check="$(ping6 -q -W 3 -c 3 -n "${IPv6_def_gateway}" -I "${IPv6_interface}"| tail -n3)" \ + local IPv6_def_gateway_check="$(ping6 -q -W 3 -c 3 -n ${IPv6_def_gateway} -I ${IPv6_interface} | tail -n3)" \ && echo "Gateway Responded." \ || echo "Gateway did not respond." block_parse "${IPv6_def_gateway_check}" @@ -223,27 +232,26 @@ ip_check() { else log_echo="No IPv6 Gateway Detected" fi + fi -local IPv4_addr_list="$(ip a | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "inet") print $(i+1) }')" \ + local IPv4_addr_list="$(ip a | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "inet") print $(i+1) }')" \ && (block_parse "${IPv4_addr_list}" && echo "::: IPv4 addresses located")\ || log_echo "No IPv4 addresses found." local IPv4_def_gateway=$(ip r | grep default | cut -d ' ' -f 3) if [[ $? = 0 ]]; then echo -n "::: Pinging default IPv4 gateway: " - local IPv4_def_gateway_check="$(ping -q -w 3 -c 3 -n "${IPv4_def_gateway}" -I "${IPv4_interface}" | tail -n3)" \ + local IPv4_def_gateway_check="$(ping -q -w 3 -c 3 -n ${IPv4_def_gateway} -I ${IPv4_interface} | tail -n3)" \ && echo "Gateway responded." \ || echo "Gateway did not respond." block_parse "${IPv4_def_gateway_check}" echo -n "::: Pinging Internet via IPv4: " - local IPv4_inet_check="$(ping -q -w 5 -c 3 -n 8.8.8.8 -I "${IPv4_interface}" | tail -n3)" \ + local IPv4_inet_check="$(ping -q -w 5 -c 3 -n 8.8.8.8 -I ${IPv4_interface} | tail -n3)" \ && echo "Query responded." \ || echo "Query did not respond." block_parse "${IPv4_inet_check}" fi - - fi } port_check() { From 472708376df99cdf707c92611c92601cf98a5c56 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 16 Feb 2017 18:30:15 -0800 Subject: [PATCH 64/97] Split out IP checks. --- advanced/Scripts/piholeDebug.sh | 97 ++++++++++++++------------------- 1 file changed, 40 insertions(+), 57 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index d374cfad..97f9112a 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -26,7 +26,6 @@ ADLISTFILE="/etc/pihole/adlists.list" PIHOLELOG="/var/log/pihole.log" WHITELISTMATCHES="/tmp/whitelistmatches.list" -IPV6_READY TIMEOUT=60 # Header info and introduction cat << EOM @@ -181,77 +180,61 @@ processor_check() { ipv6_check() { # Check if system is IPv6 enabled, for use in other functions if [[ $IPV6_ADDRESS ]]; then - ls /proc/net/if_inet6 &>/dev/null && IPV6_READY=true + ls /proc/net/if_inet6 &>/dev/null return 0 else return 1 fi } - ip_check() { - header_write "IP Address Information" - # Get the current interface for Internet traffic + local protocol=${1} - # Check if IPv6 enabled - local IPv6_interface - local IPv4_interface - if ipv6_check; then - IPv6_interface=${PIHOLE_INTERFACE:-$(ip -6 r | grep default | cut -d ' ' -f 5)} - echo ${PIHOLE_INTERFACE} - echo ${IPv6_interface} - fi - # If declared in setupVars.conf use it, otherwise defer to default - # http://stackoverflow.com/questions/2013547/assigning-default-values-to-shell-variables-with-a-single-command-in-bash - IPv4_interface=${PIHOLE_INTERFACE:-$(ip r | grep default | cut -d ' ' -f 5)} + local ip_addr_list="$(ip -${protocol} addr show dev ${PIHOLE_INTERFACE} | awk -F ' ' '{ for(i=1;i<=NF;i++) if ($i ~ '/^inet/') print $(i+1) }')" + if [[ -n ${ip_addr_list} ]]; then + log_write "IPv${protocol} on ${PIHOLE_INTERFACE}" + log_write "${ip_addr_list}" + echo "::: IPv${protocol} addresses located on ${PIHOLE_INTERFACE}" + ip_ping_check ${protocol} + return $(( 0 + $? )) + else + log_echo "No IPv${protocol} found on ${PIHOLE_INTERFACE}" + return 1 + fi +} +ip_ping_check() { - if [[ "$IPV6_READY" = true ]]; then - local IPv6_addr_list="$(ip a | awk -F ' ' '{ for(i=1;i<=NF;i++) if ($i == "inet6") print $(i+1) }')" - if [[ -n ${IPv6_addr_list} ]]; then - log_write "${IPv6_addr_list}" - echo "::: IPv6 addresses located" - else - log_echo "No IPv6 addresses found." - return 0 - fi + local protocol=${1} + local cmd - local IPv6_def_gateway=$(ip -6 r | grep default | cut -d ' ' -f 3) - if [[ $? = 0 ]] && [[ -n ${IPv6_def_gateway} ]]; then - echo -n "::: Pinging default IPv6 gateway: " - local IPv6_def_gateway_check="$(ping6 -q -W 3 -c 3 -n ${IPv6_def_gateway} -I ${IPv6_interface} | tail -n3)" \ - && echo "Gateway Responded." \ - || echo "Gateway did not respond." - block_parse "${IPv6_def_gateway_check}" - - echo -n "::: Pinging Internet via IPv6: " - local IPv6_inet_check=$(ping6 -q -W 3 -c 3 -n 2001:4860:4860::8888 -I "${IPv6_interface}"| tail -n3) \ - && echo "Query responded." \ - || echo "Query did not respond." - block_parse "${IPv6_inet_check}" - else - log_echo="No IPv6 Gateway Detected" - fi + if [[ ${protocol} == "6" ]]; then + cmd="ping6" + else + cmd="ping" fi - local IPv4_addr_list="$(ip a | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "inet") print $(i+1) }')" \ - && (block_parse "${IPv4_addr_list}" && echo "::: IPv4 addresses located")\ - || log_echo "No IPv4 addresses found." + local ip_def_gateway=$(ip -${protocol} route | grep default | cut -d ' ' -f 3) + if [[ -n ${ip_def_gateway} ]]; then + echo -n "::: Pinging default IPv${protocol} gateway: " + if ! ping_gateway="$(${cmd} -q -W 3 -c 3 -n ${ip_def_gateway} -I ${PIHOLE_INTERFACE} | tail -n 3)"; then + echo "Gateway did not respond." + return 1 + else + echo "Gateway responded." + log_write "${ping_gateway}" + return 0 + fi + fi +} - local IPv4_def_gateway=$(ip r | grep default | cut -d ' ' -f 3) - if [[ $? = 0 ]]; then - echo -n "::: Pinging default IPv4 gateway: " - local IPv4_def_gateway_check="$(ping -q -w 3 -c 3 -n ${IPv4_def_gateway} -I ${IPv4_interface} | tail -n3)" \ - && echo "Gateway responded." \ - || echo "Gateway did not respond." - block_parse "${IPv4_def_gateway_check}" +ip_check_wrapper() { + header_write "IP Address Information" - echo -n "::: Pinging Internet via IPv4: " - local IPv4_inet_check="$(ping -q -w 5 -c 3 -n 8.8.8.8 -I ${IPv4_interface} | tail -n3)" \ - && echo "Query responded." \ - || echo "Query did not respond." - block_parse "${IPv4_inet_check}" + if ipv6_check; then + ip_check "6" fi + ip_check "4" } port_check() { @@ -364,7 +347,7 @@ distro_check || echo "Distro Check soft fail" # Gather processor type processor_check || echo "Processor Check soft fail" -ip_check +ip_check_wrapper daemon_check lighttpd http daemon_check dnsmasq domain From 2aa3a109a0f8eb9693754ab9a01ac859ad47f83d Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 16 Feb 2017 18:38:05 -0800 Subject: [PATCH 65/97] Ping gateways and Internet. --- advanced/Scripts/piholeDebug.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 97f9112a..2733aeaa 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -210,8 +210,10 @@ ip_ping_check() { if [[ ${protocol} == "6" ]]; then cmd="ping6" + g_addr="2001:4860:4860::8888" else cmd="ping" + g_addr="8.8.8.8" fi local ip_def_gateway=$(ip -${protocol} route | grep default | cut -d ' ' -f 3) @@ -223,9 +225,17 @@ ip_ping_check() { else echo "Gateway responded." log_write "${ping_gateway}" - return 0 + fi + echo -n "::: Pinging Internet via IPv${protocol}: " + if ! ping_inet="$(${cmd} -q -W 3 -c 3 -n ${g_addr} -I ${PIHOLE_INTERFACE} | tail -n 3)"; then + echo "Query did not respond." + return 1 + else + echo "Query responded." + log_write "${ping_inet}" fi fi + return 0 } ip_check_wrapper() { From 053b38e0bd16cdb57a69fbce15a2fffeaf14b588 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 16 Feb 2017 19:45:44 -0800 Subject: [PATCH 66/97] Set up for IP matching in detection. --- advanced/Scripts/piholeDebug.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 2733aeaa..1415d975 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -189,10 +189,13 @@ ipv6_check() { ip_check() { local protocol=${1} + local gravity=${2} local ip_addr_list="$(ip -${protocol} addr show dev ${PIHOLE_INTERFACE} | awk -F ' ' '{ for(i=1;i<=NF;i++) if ($i ~ '/^inet/') print $(i+1) }')" if [[ -n ${ip_addr_list} ]]; then log_write "IPv${protocol} on ${PIHOLE_INTERFACE}" + log_write "Gravity configured for: ${2:-NOT CONFIGURED}" + log_write "----" log_write "${ip_addr_list}" echo "::: IPv${protocol} addresses located on ${PIHOLE_INTERFACE}" ip_ping_check ${protocol} @@ -204,7 +207,6 @@ ip_check() { } ip_ping_check() { - local protocol=${1} local cmd @@ -234,19 +236,12 @@ ip_ping_check() { echo "Query responded." log_write "${ping_inet}" fi + else + log_echo " No gateway detected." fi return 0 } -ip_check_wrapper() { - header_write "IP Address Information" - - if ipv6_check; then - ip_check "6" - fi - ip_check "4" -} - port_check() { local lsof_value @@ -357,7 +352,8 @@ distro_check || echo "Distro Check soft fail" # Gather processor type processor_check || echo "Processor Check soft fail" -ip_check_wrapper +ip_check 6 ${IPV6_ADDRESS} +ip_check 4 ${IPV4_ADDRESS} daemon_check lighttpd http daemon_check dnsmasq domain From 9e5795bf5505a0f3f87ebbc640f85e5811ac7a46 Mon Sep 17 00:00:00 2001 From: Skittels Date: Sat, 18 Feb 2017 13:03:40 +0100 Subject: [PATCH 67/97] Added DNS.WATCH to default dns servers --- automated install/basic-install.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 94f26be9..f29d3957 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -444,6 +444,7 @@ setDNS() { Level3 "" Norton "" Comodo "" + DNS.WATCH "" Custom "") DNSchoices=$(whiptail --separate-output --menu "Select Upstream DNS Provider. To use your own, select Custom." ${r} ${c} 6 \ "${DNSChooseOptions[@]}" 2>&1 >/dev/tty) || \ @@ -474,6 +475,11 @@ setDNS() { PIHOLE_DNS_1="8.26.56.26" PIHOLE_DNS_2="8.20.247.20" ;; + DNS.WATCH) + echo "::: Using DNS.WATCH servers." + PIHOLE_DNS_1="84.200.69.80" + PIHOLE_DNS_2="84.200.70.40" + ;; Custom) until [[ ${DNSSettingsCorrect} = True ]]; do strInvalid="Invalid" From 4e7a485e2379ee781651e083a2005b212132d2dd Mon Sep 17 00:00:00 2001 From: Skittels Date: Sat, 18 Feb 2017 13:42:13 +0100 Subject: [PATCH 68/97] Update basic-install.sh --- automated install/basic-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index f29d3957..08e2a2d1 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -444,7 +444,7 @@ setDNS() { Level3 "" Norton "" Comodo "" - DNS.WATCH "" + DNSWatch "" Custom "") DNSchoices=$(whiptail --separate-output --menu "Select Upstream DNS Provider. To use your own, select Custom." ${r} ${c} 6 \ "${DNSChooseOptions[@]}" 2>&1 >/dev/tty) || \ @@ -475,7 +475,7 @@ setDNS() { PIHOLE_DNS_1="8.26.56.26" PIHOLE_DNS_2="8.20.247.20" ;; - DNS.WATCH) + DNSWatch) echo "::: Using DNS.WATCH servers." PIHOLE_DNS_1="84.200.69.80" PIHOLE_DNS_2="84.200.70.40" From a7def771c893d81c5de66ca661a49b3ff8fcacbc Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 19 Feb 2017 20:12:32 +0000 Subject: [PATCH 69/97] Revert "redirect pi.hole to pi.hole/admin" --- advanced/lighttpd.conf.debian | 5 ----- advanced/lighttpd.conf.fedora | 5 ----- 2 files changed, 10 deletions(-) diff --git a/advanced/lighttpd.conf.debian b/advanced/lighttpd.conf.debian index f9c96221..53db2167 100644 --- a/advanced/lighttpd.conf.debian +++ b/advanced/lighttpd.conf.debian @@ -70,10 +70,5 @@ $HTTP["url"] =~ "^(?!/admin)/.*" { setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." ) } -$HTTP["host"] =~ "pi.hole$" { - setenv.add-response-header = ( "X-Pi-hole" => "Redirecting pi.hole to /admin." ) - url.rewrite = ( "^(.*)" => "/admin$1" ) -} - # Add user chosen options held in external file include_shell "cat external.conf 2>/dev/null" diff --git a/advanced/lighttpd.conf.fedora b/advanced/lighttpd.conf.fedora index 2dec05e4..6c5b035b 100644 --- a/advanced/lighttpd.conf.fedora +++ b/advanced/lighttpd.conf.fedora @@ -87,10 +87,5 @@ $HTTP["url"] =~ "^(?!/admin)/.*" { setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." ) } -$HTTP["host"] =~ "pi.hole$" { - setenv.add-response-header = ( "X-Pi-hole" => "Redirecting pi.hole to /admin." ) - url.rewrite = ( "^(.*)" => "/admin$1" ) -} - # Add user chosen options held in external file include_shell "cat external.conf 2>/dev/null" From 7da076df18c7f6ea68ddf323976e84920495e96c Mon Sep 17 00:00:00 2001 From: Massimiliano Monaro Date: Mon, 20 Feb 2017 10:04:14 +0100 Subject: [PATCH 70/97] Added my personal project Pi-hole Droid to the Projects's list Pi-hole Droid is an unofficial client that connects to your Pi-hole to show charts and statistics. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 48ce7af0..0a5f7f4c 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,7 @@ You can view [real-time stats](https://discourse.pi-hole.net/t/how-do-i-view-my- - [Windows Tray Stat Application](https://github.com/goldbattle/copernicus) - [Let your blink1 device blink when Pi-hole filters ads](https://gist.github.com/elpatron68/ec0b4c582e5abf604885ac1e068d233f) - [Pi-Hole Prometheus exporter](https://github.com/nlamirault/pihole_exporter) : a [Prometheus](https://prometheus.io/) exporter for Pi-Hole +- [Pi-hole Droid - open source Android client](https://github.com/friimaind/pi-hole-droid) ## Coverage From 763b51fe22dc2320115c614e368613840976903e Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 20 Feb 2017 21:12:04 +0000 Subject: [PATCH 71/97] linux style line endings enforced --- .gitattributes | 2 +- .idea/codeStyleSettings.xml | 25 ------------------------- 2 files changed, 1 insertion(+), 26 deletions(-) delete mode 100644 .idea/codeStyleSettings.xml diff --git a/.gitattributes b/.gitattributes index 57faaa8b..1ed54473 100644 --- a/.gitattributes +++ b/.gitattributes @@ -35,4 +35,4 @@ GitHub.Tests.Integration/Resources/* binary # Catch all for anything we forgot. Add rules if you get CRLF -> LF warnings. -* text=auto +* text eol=lf diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml deleted file mode 100644 index 1028340e..00000000 --- a/.idea/codeStyleSettings.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - \ No newline at end of file From 86c6e0e826e909bdb92180aff5bad011cfc15185 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 20 Feb 2017 21:36:27 +0000 Subject: [PATCH 72/97] accidentally the idea file --- .idea/codeStyleSettings.xml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .idea/codeStyleSettings.xml diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 00000000..6ad75d68 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,25 @@ + + + + + + \ No newline at end of file From b2d78edae93c0762403e7beceac898c1d2b741ae Mon Sep 17 00:00:00 2001 From: ProtoFoo Date: Tue, 21 Feb 2017 20:36:59 +0100 Subject: [PATCH 73/97] Redirect pi.hole to pi.hole/admin/ --- advanced/lighttpd.conf.debian | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/advanced/lighttpd.conf.debian b/advanced/lighttpd.conf.debian index 53db2167..9e554242 100644 --- a/advanced/lighttpd.conf.debian +++ b/advanced/lighttpd.conf.debian @@ -70,5 +70,13 @@ $HTTP["url"] =~ "^(?!/admin)/.*" { setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." ) } +# Entering just "pi.hole" into a browser redirects to "pi.hole/admin/" +$HTTP["host"] == "pi.hole" { + $HTTP["url"] == "/" { + setenv.add-response-header = ( "X-Pi-hole" => "Redirecting pi.hole to /admin/." ) + url.redirect = ( "" => "/admin/" ) + } +} + # Add user chosen options held in external file include_shell "cat external.conf 2>/dev/null" From 3fab34687c5fb7fd85e0cd8e95db6eaeae9f0847 Mon Sep 17 00:00:00 2001 From: ProtoFoo Date: Tue, 21 Feb 2017 20:38:09 +0100 Subject: [PATCH 74/97] Redirect pi.hole to pi.hole/admin/ --- advanced/lighttpd.conf.fedora | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/advanced/lighttpd.conf.fedora b/advanced/lighttpd.conf.fedora index 6c5b035b..d7bc823f 100644 --- a/advanced/lighttpd.conf.fedora +++ b/advanced/lighttpd.conf.fedora @@ -87,5 +87,13 @@ $HTTP["url"] =~ "^(?!/admin)/.*" { setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." ) } +# Entering just "pi.hole" into a browser redirects to "pi.hole/admin/" +$HTTP["host"] == "pi.hole" { + $HTTP["url"] == "/" { + setenv.add-response-header = ( "X-Pi-hole" => "Redirecting pi.hole to /admin/." ) + url.redirect = ( "" => "/admin/" ) + } +} + # Add user chosen options held in external file include_shell "cat external.conf 2>/dev/null" From cd0b8927c5b14c6667899c30efc05833cd688383 Mon Sep 17 00:00:00 2001 From: ProtoFoo Date: Tue, 21 Feb 2017 22:22:03 +0100 Subject: [PATCH 75/97] Removed a line that did nothing. --- advanced/lighttpd.conf.debian | 1 - 1 file changed, 1 deletion(-) diff --git a/advanced/lighttpd.conf.debian b/advanced/lighttpd.conf.debian index 9e554242..334016d4 100644 --- a/advanced/lighttpd.conf.debian +++ b/advanced/lighttpd.conf.debian @@ -73,7 +73,6 @@ $HTTP["url"] =~ "^(?!/admin)/.*" { # Entering just "pi.hole" into a browser redirects to "pi.hole/admin/" $HTTP["host"] == "pi.hole" { $HTTP["url"] == "/" { - setenv.add-response-header = ( "X-Pi-hole" => "Redirecting pi.hole to /admin/." ) url.redirect = ( "" => "/admin/" ) } } From fb6631d317bbf8af8d470d495679958dea6a1c69 Mon Sep 17 00:00:00 2001 From: ProtoFoo Date: Tue, 21 Feb 2017 22:22:30 +0100 Subject: [PATCH 76/97] Removed a line that did nothing. --- advanced/lighttpd.conf.fedora | 1 - 1 file changed, 1 deletion(-) diff --git a/advanced/lighttpd.conf.fedora b/advanced/lighttpd.conf.fedora index d7bc823f..752d4446 100644 --- a/advanced/lighttpd.conf.fedora +++ b/advanced/lighttpd.conf.fedora @@ -90,7 +90,6 @@ $HTTP["url"] =~ "^(?!/admin)/.*" { # Entering just "pi.hole" into a browser redirects to "pi.hole/admin/" $HTTP["host"] == "pi.hole" { $HTTP["url"] == "/" { - setenv.add-response-header = ( "X-Pi-hole" => "Redirecting pi.hole to /admin/." ) url.redirect = ( "" => "/admin/" ) } } From 7ed1bbad49b46667a4a7fa09eca78b95c49dc66a Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 22 Feb 2017 14:43:07 +0100 Subject: [PATCH 77/97] Add host-record option --- advanced/Scripts/webpage.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index fd882bd3..3487190c 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -127,6 +127,12 @@ trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE3 " >> "${dnsmasqconfig}" fi + delete_dnsmasq_setting "host-record" + + if [ -n "${#HOSTRECORD}" ]; then + add_dnsmasq_setting "host-record" "${HOSTRECORD}" + fi + } SetDNSServers(){ @@ -313,6 +319,7 @@ ResolutionSettings() { elif [[ "${typ}" == "clients" ]]; then change_setting "API_GET_CLIENT_HOSTNAME" "${state}" fi + } AddDHCPStaticAddress() { @@ -331,6 +338,7 @@ AddDHCPStaticAddress() { # Full info given echo "dhcp-host=${mac},${ip},${host}" >> "${dhcpstaticconfig}" fi + } RemoveDHCPStaticAddress() { @@ -340,6 +348,23 @@ RemoveDHCPStaticAddress() { } +SetHostRecord(){ + + if [ -n "${args[3]}" ]; then + change_setting "HOSTRECORD" "${args[2]},${args[3]}" + echo "Setting host record for ${args[2]} -> ${args[3]}" + else + change_setting "HOSTRECORD" "" + echo "Removing host record" + fi + + ProcessDNSSettings + + # Restart dnsmasq to load new configuration + RestartDNS + +} + main() { args=("$@") @@ -363,6 +388,7 @@ main() { "resolve" ) ResolutionSettings;; "addstaticdhcp" ) AddDHCPStaticAddress;; "removestaticdhcp" ) RemoveDHCPStaticAddress;; + "hostrecord" ) SetHostRecord;; * ) helpFunc;; esac From 7a1a2dec678c997daff6e6693cdd1d8d4c89d410 Mon Sep 17 00:00:00 2001 From: Jacob Salmela Date: Wed, 22 Feb 2017 11:55:20 -0600 Subject: [PATCH 78/97] update license to EUPL on core files --- LICENSE | 390 ++++++++--------------------- advanced/Scripts/chronometer.sh | 14 +- advanced/Scripts/list.sh | 14 +- advanced/Scripts/piholeDebug.sh | 14 +- advanced/Scripts/piholeLogFlush.sh | 14 +- advanced/Scripts/setupLCD.sh | 14 +- advanced/Scripts/update.sh | 14 +- advanced/Scripts/version.sh | 14 +- advanced/Scripts/webpage.sh | 12 +- advanced/lighttpd.conf.debian | 14 +- advanced/lighttpd.conf.fedora | 14 +- advanced/pihole.cron | 14 +- advanced/pihole.sudo | 14 +- automated install/basic-install.sh | 14 +- automated install/uninstall.sh | 18 +- gravity.sh | 14 +- pihole | 14 +- 17 files changed, 221 insertions(+), 395 deletions(-) diff --git a/LICENSE b/LICENSE index 22fbe5db..9fddaad1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,339 +1,167 @@ -GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 +Copyright (C) 2017 Pi-hole, LLC (https://pi-hole.net) +Pi-hole Core - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. +This software is licensed under the European Union Public License (EUPL) +The license is available in the 22 official languages of the EU. The English version is included here. +Please see https://joinup.ec.europa.eu/community/eupl/og_page/eupl for official translations of the other languages. - Preamble +This license applies to the whole project EXCEPT: - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. + - any commits made to the master branch prior to the release of version 3.0 - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. +The licenses that existed prior to this change have remained intact. - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. +------------------------------------------------------------- - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. +European Union Public Licence +V. 1.1 - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. +EUPL (C) the European Community 2007 - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. +This European Union Public Licence (the "EUPL") applies to the Work or Software (as defined below) which is provided under the terms of this Licence. Any use of the Work, other than as authorised under this Licence is prohibited (to the extent such use is covered by a right of the copyright holder of the Work). - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. +The Original Work is provided under the terms of this Licence when the Licensor (as defined below) has placed the following notice immediately following the copyright notice for the Original Work: - The precise terms and conditions for copying, distribution and -modification follow. +Licensed under the EUPL V.1.1 - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +or has expressed by any other mean his willingness to license under the EUPL. - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". +1. Definitions -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. +In this Licence, the following terms have the following meaning: - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. +- The Licence: this Licence. -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. +- The Original Work or the Software: the software distributed and/or communicated by the Licensor under this Licence, available as Source Code and also as Executable Code as the case may be. - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: +- Derivative Works: the works or software that could be created by the Licensee, based upon the Original Work or modifications thereof. This Licence does not define the extent of modification or dependence on the Original Work required in order to classify a work as a Derivative Work; this extent is determined by copyright law applicable in the country mentioned in Article 15. - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. +- The Work: the Original Work and/or its Derivative Works. - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. +- The Source Code: the human-readable form of the Work which is the most convenient for people to study and modify. - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) +- The Executable Code: any code which has generally been compiled and which is meant to be interpreted by a computer as a program. -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. +- The Licensor: the natural or legal person that distributes and/or communicates the Work under the Licence. -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. +- Contributor(s): any natural or legal person who modifies the Work under the Licence, or otherwise contributes to the creation of a Derivative Work. -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. +- The Licensee or "You": any natural or legal person who makes any usage of the Software under the terms of the Licence. - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: +- Distribution and/or Communication: any act of selling, giving, lending, renting, distributing, communicating, transmitting, or otherwise making available, on-line or off-line, copies of the Work or providing access to its essential functionalities at the disposal of any other natural or legal person. - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, +2. Scope of the rights granted by the Licence - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, +The Licensor hereby grants You a world-wide, royalty-free, non-exclusive, sub-licensable licence to do the following, for the duration of copyright vested in the Original Work: - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) +- use the Work in any circumstance and for all usage, +- reproduce the Work, +- modify the Original Work, and make Derivative Works based upon the Work, +- communicate to the public, including the right to make available or display the Work or copies thereof to the public and perform publicly, as the case may be, the Work, +- distribute the Work or copies thereof, +- lend and rent the Work or copies thereof, +- sub-license rights in the Work or copies thereof. -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. +Those rights can be exercised on any media, supports and formats, whether now known or later invented, as far as the applicable law permits so. -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. +In the countries where moral rights apply, the Licensor waives his right to exercise his moral right to the extent allowed by law in order to make effective the licence of the economic rights here above listed. - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. +The Licensor grants to the Licensee royalty-free, non exclusive usage rights to any patents held by the Licensor, to the extent necessary to make use of the rights granted on the Work under this Licence. - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. +3. Communication of the Source Code - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. +The Licensor may provide the Work either in its Source Code form, or as Executable Code. If the Work is provided as Executable Code, the Licensor provides in addition a machine-readable copy of the Source Code of the Work along with each copy of the Work that the Licensor distributes or indicates, in a notice following the copyright notice attached to the Work, a repository where the Source Code is easily and freely accessible for as long as the Licensor continues to distribute and/or communicate the Work. - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. +4. Limitations on copyright -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. +Nothing in this Licence is intended to deprive the Licensee of the benefits from any exception or limitation to the exclusive rights of the rights owners in the Original Work or Software, of the exhaustion of those rights or of other applicable limitations thereto. -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. +5. Obligations of the Licensee -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. +The grant of the rights mentioned above is subject to some restrictions and obligations imposed on the Licensee. Those obligations are the following: - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. +Attribution right: the Licensee shall keep intact all copyright, patent or trademarks notices and all notices that refer to the Licence and to the disclaimer of warranties. The Licensee must include a copy of such notices and a copy of the Licence with every copy of the Work he/she distributes and/or communicates. The Licensee must cause any Derivative Work to carry prominent notices stating that the Work has been modified and the date of modification. - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. +Copyleft clause: If the Licensee distributes and/or communicates copies of the Original Works or Derivative Works based upon the Original Work, this Distribution and/or Communication will be done under the terms of this Licence or of a later version of this Licence unless the Original Work is expressly distributed only under this version of the Licence. The Licensee (becoming Licensor) cannot offer or impose any additional terms or conditions on the Work or Derivative Work that alter or restrict the terms of the Licence. -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. +Compatibility clause: If the Licensee Distributes and/or Communicates Derivative Works or copies thereof based upon both the Original Work and another work licensed under a Compatible Licence, this Distribution and/or Communication can be done under the terms of this Compatible Licence. For the sake of this clause, "Compatible Licence" refers to the licences listed in the appendix attached to this Licence. Should the Licensee’s obligations under the Compatible Licence conflict with his/her obligations under this Licence, the obligations of the Compatible Licence shall prevail. - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. +Provision of Source Code: When distributing and/or communicating copies of the Work, the Licensee will provide a machine-readable copy of the Source Code or indicate a repository where this Source will be easily and freely available for as long as the Licensee continues to distribute and/or communicate the Work. - NO WARRANTY +Legal Protection: This Licence does not grant permission to use the trade names, trademarks, service marks, or names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the copyright notice. - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. +6. Chain of Authorship - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. +The original Licensor warrants that the copyright in the Original Work granted hereunder is owned by him/her or licensed to him/her and that he/she has the power and authority to grant the Licence. - END OF TERMS AND CONDITIONS +Each Contributor warrants that the copyright in the modifications he/she brings to the Work are owned by him/her or licensed to him/her and that he/she has the power and authority to grant the Licence. - How to Apply These Terms to Your New Programs +Each time You accept the Licence, the original Licensor and subsequent Contributors grant You a licence to their contributions to the Work, under the terms of this Licence. - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. +7. Disclaimer of Warranty - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. +The Work is a work in progress, which is continuously improved by numerous contributors. It is not a finished work and may therefore contain defects or "bugs" inherent to this type of software development. - {description} - Copyright (C) {year} {fullname} +For the above reason, the Work is provided under the Licence on an "as is" basis and without warranties of any kind concerning the Work, including without limitation merchantability, fitness for a particular purpose, absence of defects or errors, accuracy, non-infringement of intellectual property rights other than copyright as stated in Article 6 of this Licence. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. +This disclaimer of warranty is an essential part of the Licence and a condition for the grant of any rights to the Work. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +8. Disclaimer of Liability - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +Except in the cases of wilful misconduct or damages directly caused to natural persons, the Licensor will in no event be liable for any direct or indirect, material or moral, damages of any kind, arising out of the Licence or of the use of the Work, including without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, loss of data or any commercial damage, even if the Licensor has been advised of the possibility of such damage. However, the Licensor will be liable under statutory product liability laws as far such laws apply to the Work. -Also add information on how to contact you by electronic and paper mail. +9. Additional agreements -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: +While distributing the Original Work or Derivative Works, You may choose to conclude an additional agreement to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or services consistent with this Licence. However, in accepting such obligations, You may act only on your own behalf and on your sole responsibility, not on behalf of the original Licensor or any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against such Contributor by the fact You have accepted any such warranty or additional liability. - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. +10. Acceptance of the Licence -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. +The provisions of this Licence can be accepted by clicking on an icon "I agree" placed under the bottom of a window displaying the text of this Licence or by affirming consent in any other similar way, in accordance with the rules of applicable law. Clicking on that icon indicates your clear and irrevocable acceptance of this Licence and all of its terms and conditions. -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: +Similarly, you irrevocably accept this Licence and all of its terms and conditions by exercising any rights granted to You by Article 2 of this Licence, such as the use of the Work, the creation by You of a Derivative Work or the Distribution and/or Communication by You of the Work or copies thereof. - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. +11. Information to the public - {signature of Ty Coon}, 1 April 1989 - Ty Coon, President of Vice +In case of any Distribution and/or Communication of the Work by means of electronic communication by You (for example, by offering to download the Work from a remote location) the distribution channel or media (for example, a website) must at least provide to the public the information requested by the applicable law regarding the Licensor, the Licence and the way it may be accessible, concluded, stored and reproduced by the Licensee. -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. \ No newline at end of file +12. Termination of the Licence + +The Licence and the rights granted hereunder will terminate automatically upon any breach by the Licensee of the terms of the Licence. + +Such a termination will not terminate the licences of any person who has received the Work from the Licensee under the Licence, provided such persons remain in full compliance with the Licence. + +13. Miscellaneous + +Without prejudice of Article 9 above, the Licence represents the complete agreement between the Parties as to the Work licensed hereunder. + +If any provision of the Licence is invalid or unenforceable under applicable law, this will not affect the validity or enforceability of the Licence as a whole. Such provision will be construed and/or reformed so as necessary to make it valid and enforceable. + +The European Commission may publish other linguistic versions and/or new versions of this Licence, so far this is required and reasonable, without reducing the scope of the rights granted by the Licence. New versions of the Licence will be published with a unique version number. + +All linguistic versions of this Licence, approved by the European Commission, have identical value. Parties can take advantage of the linguistic version of their choice. + +14. Jurisdiction + +Any litigation resulting from the interpretation of this License, arising between the European Commission, as a Licensor, and any Licensee, will be subject to the jurisdiction of the Court of Justice of the European Communities, as laid down in article 238 of the Treaty establishing the European Community. + +Any litigation arising between Parties, other than the European Commission, and resulting from the interpretation of this License, will be subject to the exclusive jurisdiction of the competent court where the Licensor resides or conducts its primary business. + +15. Applicable Law + +This Licence shall be governed by the law of the European Union country where the Licensor resides or has his registered office. + +This licence shall be governed by the Belgian law if: + +- a litigation arises between the European Commission, as a Licensor, and any Licensee; +- the Licensor, other than the European Commission, has no residence or registered office inside a European Union country. + + +=== +Appendix + +"Compatible Licences" according to article 5 EUPL are: +- GNU General Public License (GNU GPL) v. 2 +- Open Software License (OSL) v. 2.1, v. 3.0 +- Common Public License v. 1.0 +- Eclipse Public License v. 1.0 +- Cecill v. 2.0 diff --git a/advanced/Scripts/chronometer.sh b/advanced/Scripts/chronometer.sh index 3dce9c3e..7bb50745 100755 --- a/advanced/Scripts/chronometer.sh +++ b/advanced/Scripts/chronometer.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash # Pi-hole: A black hole for Internet advertisements -# (c) 2015, 2016 by Jacob Salmela -# Network-wide ad blocking via your Raspberry Pi -# http://pi-hole.net +# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# Network-wide ad blocking via your own hardware. +# # Calculates stats and displays to an LCD # -# Pi-hole is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. +# This file is copyright under the latest version of the EUPL. +# Please see LICENSE file for your rights under this license. + + #Functions############################################################################################################## diff --git a/advanced/Scripts/list.sh b/advanced/Scripts/list.sh index 4634837a..90d1b7f0 100755 --- a/advanced/Scripts/list.sh +++ b/advanced/Scripts/list.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash # Pi-hole: A black hole for Internet advertisements -# (c) 2015, 2016 by Jacob Salmela -# Network-wide ad blocking via your Raspberry Pi -# http://pi-hole.net +# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# Network-wide ad blocking via your own hardware. +# # Whitelists and blacklists domains # -# Pi-hole is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. +# This file is copyright under the latest version of the EUPL. +# Please see LICENSE file for your rights under this license. + + #globals basename=pihole diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 1415d975..fae7c0b9 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash # Pi-hole: A black hole for Internet advertisements -# (c) 2015, 2016 by Jacob Salmela -# Network-wide ad blocking via your Raspberry Pi -# http://pi-hole.net +# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# Network-wide ad blocking via your own hardware. +# # Generates pihole_debug.log to be used for troubleshooting. # -# Pi-hole is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. +# This file is copyright under the latest version of the EUPL. +# Please see LICENSE file for your rights under this license. + + set -o pipefail diff --git a/advanced/Scripts/piholeLogFlush.sh b/advanced/Scripts/piholeLogFlush.sh index d8f4fd79..63754db2 100755 --- a/advanced/Scripts/piholeLogFlush.sh +++ b/advanced/Scripts/piholeLogFlush.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash # Pi-hole: A black hole for Internet advertisements -# (c) 2015, 2016 by Jacob Salmela -# Network-wide ad blocking via your Raspberry Pi -# http://pi-hole.net +# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# Network-wide ad blocking via your own hardware. +# # Flushes /var/log/pihole.log # -# Pi-hole is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. +# This file is copyright under the latest version of the EUPL. +# Please see LICENSE file for your rights under this license. + + echo -n "::: Flushing /var/log/pihole.log ..." # Test if logrotate is available on this system diff --git a/advanced/Scripts/setupLCD.sh b/advanced/Scripts/setupLCD.sh index e5a01911..d780da57 100755 --- a/advanced/Scripts/setupLCD.sh +++ b/advanced/Scripts/setupLCD.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash # Pi-hole: A black hole for Internet advertisements -# (c) 2015 by Jacob Salmela -# Network-wide ad blocking via your Raspberry Pi -# http://pi-hole.net +# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# Network-wide ad blocking via your own hardware. +# # Automatically configures the Pi to use the 2.8 LCD screen to display stats on it (also works over ssh) # -# Pi-hole is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. +# This file is copyright under the latest version of the EUPL. +# Please see LICENSE file for your rights under this license. + + ############ FUNCTIONS ########### diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh index 10847ead..9ac12940 100755 --- a/advanced/Scripts/update.sh +++ b/advanced/Scripts/update.sh @@ -1,16 +1,16 @@ #!/usr/bin/env bash # Pi-hole: A black hole for Internet advertisements -# (c) 2015, 2016 by Jacob Salmela -# Network-wide ad blocking via your Raspberry Pi -# http://pi-hole.net +# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# Network-wide ad blocking via your own hardware. +# # Check Pi-hole core and admin pages versions and determine what # upgrade (if any) is required. Automatically updates and reinstalls # application if update is detected. # -# Pi-hole is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. +# This file is copyright under the latest version of the EUPL. +# Please see LICENSE file for your rights under this license. + + # Variables diff --git a/advanced/Scripts/version.sh b/advanced/Scripts/version.sh index 42bd96ce..11a7af00 100755 --- a/advanced/Scripts/version.sh +++ b/advanced/Scripts/version.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash # Pi-hole: A black hole for Internet advertisements -# (c) 2015, 2016 by Jacob Salmela -# Network-wide ad blocking via your Raspberry Pi -# http://pi-hole.net +# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# Network-wide ad blocking via your own hardware. +# # shows version numbers # -# Pi-hole is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. +# This file is copyright under the latest version of the EUPL. +# Please see LICENSE file for your rights under this license. + + # Flags: latest=false diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index fd882bd3..933dbed6 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash # Pi-hole: A black hole for Internet advertisements -# Network-wide ad blocking via your Raspberry Pi -# http://pi-hole.net +# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# Network-wide ad blocking via your own hardware. +# # Web interface settings # -# Pi-hole is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. +# This file is copyright under the latest version of the EUPL. +# Please see LICENSE file for your rights under this license. + readonly setupVars="/etc/pihole/setupVars.conf" readonly dnsmasqconfig="/etc/dnsmasq.d/01-pihole.conf" diff --git a/advanced/lighttpd.conf.debian b/advanced/lighttpd.conf.debian index 334016d4..3b57756e 100644 --- a/advanced/lighttpd.conf.debian +++ b/advanced/lighttpd.conf.debian @@ -1,13 +1,13 @@ # Pi-hole: A black hole for Internet advertisements -# (c) 2015, 2016 by Jacob Salmela -# Network-wide ad blocking via your Raspberry Pi -# http://pi-hole.net +# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# Network-wide ad blocking via your own hardware. +# # lighttpd config for Pi-hole # -# Pi-hole is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. +# This file is copyright under the latest version of the EUPL. +# Please see LICENSE file for your rights under this license. + + ############################################################################### # FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE. # diff --git a/advanced/lighttpd.conf.fedora b/advanced/lighttpd.conf.fedora index 752d4446..fd856fbb 100644 --- a/advanced/lighttpd.conf.fedora +++ b/advanced/lighttpd.conf.fedora @@ -1,13 +1,13 @@ # Pi-hole: A black hole for Internet advertisements -# (c) 2015, 2016 by Jacob Salmela -# Network-wide ad blocking via your Raspberry Pi -# http://pi-hole.net +# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# Network-wide ad blocking via your own hardware. +# # lighttpd config for Pi-hole # -# Pi-hole is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. +# This file is copyright under the latest version of the EUPL. +# Please see LICENSE file for your rights under this license. + + ############################################################################### # FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE. # diff --git a/advanced/pihole.cron b/advanced/pihole.cron index 854a9459..c885b371 100644 --- a/advanced/pihole.cron +++ b/advanced/pihole.cron @@ -1,13 +1,13 @@ # Pi-hole: A black hole for Internet advertisements -# (c) 2015, 2016 by Jacob Salmela -# Network-wide ad blocking via your Raspberry Pi -# http://pi-hole.net +# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# Network-wide ad blocking via your own hardware. +# # Updates ad sources every week # -# Pi-hole is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. +# This file is copyright under the latest version of the EUPL. +# Please see LICENSE file for your rights under this license. +# +# # # This file is under source-control of the Pi-hole installation and update # scripts, any changes made to this file will be overwritten when the softare diff --git a/advanced/pihole.sudo b/advanced/pihole.sudo index 702bc7a5..708309be 100644 --- a/advanced/pihole.sudo +++ b/advanced/pihole.sudo @@ -1,11 +1,9 @@ # Pi-hole: A black hole for Internet advertisements -# (c) 2015, 2016 by Jacob Salmela -# Network-wide ad blocking via your Raspberry Pi -# http://pi-hole.net +# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# Network-wide ad blocking via your own hardware. +# # Allows the WebUI to use Pi-hole commands # -# Pi-hole is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. - +# This file is copyright under the latest version of the EUPL. +# Please see LICENSE file for your rights under this license. +# diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 0b6abc03..51390a5e 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash # Pi-hole: A black hole for Internet advertisements -# (c) 2015, 2016 by Jacob Salmela -# Network-wide ad blocking via your Raspberry Pi -# http://pi-hole.net +# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# Network-wide ad blocking via your own hardware. +# # Installs Pi-hole # -# Pi-hole is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. +# This file is copyright under the latest version of the EUPL. +# Please see LICENSE file for your rights under this license. + + # pi-hole.net/donate # diff --git a/automated install/uninstall.sh b/automated install/uninstall.sh index 2bc4dd25..84760ce2 100755 --- a/automated install/uninstall.sh +++ b/automated install/uninstall.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash # Pi-hole: A black hole for Internet advertisements -# (c) 2015, 2016 by Jacob Salmela -# Network-wide ad blocking via your Raspberry Pi -# http://pi-hole.net +# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# Network-wide ad blocking via your own hardware. +# # Completely uninstalls Pi-hole # -# Pi-hole is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. +# This file is copyright under the latest version of the EUPL. +# Please see LICENSE file for your rights under this license. + + # Must be root to uninstall if [[ ${EUID} -eq 0 ]]; then @@ -154,7 +154,7 @@ removeNoPurge() { ${SUDO} rm /usr/local/bin/pihole &> /dev/null ${SUDO} rm /etc/bash_completion.d/pihole &> /dev/null ${SUDO} rm /etc/sudoers.d/pihole &> /dev/null - + # If the pihole user exists, then remove if id "pihole" >/dev/null 2>&1; then echo "::: Removing pihole user..." @@ -175,7 +175,7 @@ while true; do read -rp "::: Do you wish to purge PiHole's dependencies from your OS? (You will be prompted for each package) [y/n]: " yn case ${yn} in [Yy]* ) removeAndPurge; break;; - + [Nn]* ) removeNoPurge; break;; esac done diff --git a/gravity.sh b/gravity.sh index 1c9da96a..08590251 100755 --- a/gravity.sh +++ b/gravity.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash # Pi-hole: A black hole for Internet advertisements -# (c) 2015 by Jacob Salmela -# Network-wide ad blocking via your Raspberry Pi -# http://pi-hole.net +# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# Network-wide ad blocking via your own hardware. +# # Compiles a list of ad-serving domains by downloading them from multiple sources # -# Pi-hole is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. +# This file is copyright under the latest version of the EUPL. +# Please see LICENSE file for your rights under this license. + + # Run this script as root or under sudo echo ":::" diff --git a/pihole b/pihole index b3fc2367..b79ab2b7 100755 --- a/pihole +++ b/pihole @@ -1,14 +1,14 @@ #!/bin/bash # Pi-hole: A black hole for Internet advertisements -# (c) 2015, 2016 by Jacob Salmela -# Network-wide ad blocking via your Raspberry Pi -# http://pi-hole.net +# (c) 2017 Pi-hole, LLC (https://pi-hole.net) +# Network-wide ad blocking via your own hardware. +# # Controller for all pihole scripts and functions. # -# Pi-hole is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. +# This file is copyright under the latest version of the EUPL. +# Please see LICENSE file for your rights under this license. + + PI_HOLE_SCRIPT_DIR="/opt/pihole" readonly wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf" From 2a881a90ac268a7d34153c75d87177c2aa97307a Mon Sep 17 00:00:00 2001 From: Flo Date: Fri, 24 Feb 2017 11:29:19 +0100 Subject: [PATCH 79/97] Update old install command to new --- automated install/uninstall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/uninstall.sh b/automated install/uninstall.sh index 84760ce2..ed768c38 100755 --- a/automated install/uninstall.sh +++ b/automated install/uninstall.sh @@ -164,7 +164,7 @@ removeNoPurge() { echo ":::" printf "::: Finished removing PiHole from your system. Sorry to see you go!\n" printf "::: Reach out to us at https://github.com/pi-hole/pi-hole/issues if you need help\n" - printf "::: Reinstall by simpling running\n:::\n:::\tcurl -L https://install.pi-hole.net | bash\n:::\n::: at any time!\n:::\n" + printf "::: Reinstall by simpling running\n:::\n:::\tcurl -sSL https://install.pi-hole.net | bash\n:::\n::: at any time!\n:::\n" printf "::: PLEASE RESET YOUR DNS ON YOUR ROUTER/CLIENTS TO RESTORE INTERNET CONNECTIVITY!\n" } From ec7e75a6e3a6c2eac0782c57b795c2137d1b3a1f Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 24 Feb 2017 16:02:24 +0100 Subject: [PATCH 80/97] Don't save `interface=` line to `dnsmasq`s config file --- advanced/01-pihole.conf | 2 -- automated install/basic-install.sh | 1 - 2 files changed, 3 deletions(-) diff --git a/advanced/01-pihole.conf b/advanced/01-pihole.conf index 0ddf1caa..484f444c 100644 --- a/advanced/01-pihole.conf +++ b/advanced/01-pihole.conf @@ -32,8 +32,6 @@ no-resolv server=@DNS1@ server=@DNS2@ -interface=@INT@ - cache-size=10000 log-queries diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 51390a5e..763c2af2 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -608,7 +608,6 @@ version_check_dnsmasq() { echo -n "::: Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf..." cp ${dnsmasq_pihole_01_snippet} ${dnsmasq_pihole_01_location} echo " done." - sed -i "s/@INT@/$PIHOLE_INTERFACE/" ${dnsmasq_pihole_01_location} if [[ "${PIHOLE_DNS_1}" != "" ]]; then sed -i "s/@DNS1@/$PIHOLE_DNS_1/" ${dnsmasq_pihole_01_location} else From ae24f1255f2435acb0438b3bc6ff28a7f99266e0 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 25 Feb 2017 11:29:12 +0100 Subject: [PATCH 81/97] Bugfix: Delete INSTALL_WEB line before adding new one --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 51390a5e..f168675e 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -964,7 +964,7 @@ finalExports() { # Update variables in setupVars.conf file if [ -e "${setupVars}" ]; then - sed -i.update.bak '/PIHOLE_INTERFACE/d;/IPV4_ADDRESS/d;/IPV6_ADDRESS/d;/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;/QUERY_LOGGING/d;' "${setupVars}" + sed -i.update.bak '/PIHOLE_INTERFACE/d;/IPV4_ADDRESS/d;/IPV6_ADDRESS/d;/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;/QUERY_LOGGING/d;/INSTALL_WEB/d;' "${setupVars}" fi { echo "PIHOLE_INTERFACE=${PIHOLE_INTERFACE}" From ba5bbf3523a0d9bb490462cf35189d14281c2688 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sun, 26 Feb 2017 15:36:53 -0800 Subject: [PATCH 82/97] Modify `pihole` for `-d -a` arguments. --- pihole | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pihole b/pihole index b79ab2b7..ad021740 100755 --- a/pihole +++ b/pihole @@ -45,7 +45,12 @@ wildcardFunc() { } debugFunc() { - "${PI_HOLE_SCRIPT_DIR}"/piholeDebug.sh + local automated + shift + if [[ "${1}" == "-a" ]]; then + automated="true" + fi + AUTOMATED=${automated:-} "${PI_HOLE_SCRIPT_DIR}"/piholeDebug.sh exit 0 } @@ -310,7 +315,7 @@ case "${1}" in "-w" | "whitelist" ) whitelistFunc "$@";; "-b" | "blacklist" ) blacklistFunc "$@";; "-wild" | "wildcard" ) wildcardFunc "$@";; - "-d" | "debug" ) debugFunc;; + "-d" | "debug" ) debugFunc "$@";; "-f" | "flush" ) flushFunc;; "-up" | "updatePihole" ) updatePiholeFunc;; "-r" | "reconfigure" ) reconfigurePiholeFunc;; From 9b060aab34c87193f837b206dfcd97db40917c17 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sun, 26 Feb 2017 18:22:06 -0800 Subject: [PATCH 83/97] Debug auto mode engaged Signed-off-by: Dan Schaper --- advanced/Scripts/piholeDebug.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index fae7c0b9..dc70a907 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -407,16 +407,19 @@ finalWork() { local tricorder echo "::: Finshed debugging!" echo "::: The debug log can be uploaded to tricorder.pi-hole.net for sharing with developers only." - read -r -p "::: Would you like to upload the log? [y/N] " response - case ${response} in - [yY][eE][sS]|[yY]) - tricorder=$(cat /var/log/pihole_debug.log | nc tricorder.pi-hole.net 9999) - ;; - *) - echo "::: Log will NOT be uploaded to tricorder." - ;; - esac - + if [[ "${AUTOMATED}" ]]; then + tricorder=$(cat /var/log/pihole_debug.log | nc tricorder.pi-hole.net 9999) + else + read -r -p "::: Would you like to upload the log? [y/N] " response + case ${response} in + [yY][eE][sS]|[yY]) + tricorder=$(cat /var/log/pihole_debug.log | nc tricorder.pi-hole.net 9999) + ;; + *) + echo "::: Log will NOT be uploaded to tricorder." + ;; + esac + fi # Check if tricorder.pi-hole.net is reachable and provide token. if [ -n "${tricorder}" ]; then echo "::: Your debug token is : ${tricorder}" From 7244d44a1df4eb9ac8193f581eedd0543eddfce1 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 27 Feb 2017 10:02:00 -0800 Subject: [PATCH 84/97] Notify user that log is being uploaded. Signed-off-by: Dan Schaper --- advanced/Scripts/piholeDebug.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index dc70a907..3131078e 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -408,6 +408,7 @@ finalWork() { echo "::: Finshed debugging!" echo "::: The debug log can be uploaded to tricorder.pi-hole.net for sharing with developers only." if [[ "${AUTOMATED}" ]]; then + echo "Debug script running in automated mode, uploading log to tricorder..." tricorder=$(cat /var/log/pihole_debug.log | nc tricorder.pi-hole.net 9999) else read -r -p "::: Would you like to upload the log? [y/N] " response From 6c130b7960918c09a7f1d22ed75911301835bd1d Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 27 Feb 2017 10:27:11 -0800 Subject: [PATCH 85/97] Vebiage and highligh the token, also `:::` Signed-off-by: Dan Schaper --- advanced/Scripts/piholeDebug.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 3131078e..176a3ead 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -408,7 +408,7 @@ finalWork() { echo "::: Finshed debugging!" echo "::: The debug log can be uploaded to tricorder.pi-hole.net for sharing with developers only." if [[ "${AUTOMATED}" ]]; then - echo "Debug script running in automated mode, uploading log to tricorder..." + echo "::: Debug script running in automated mode, uploading log to tricorder..." tricorder=$(cat /var/log/pihole_debug.log | nc tricorder.pi-hole.net 9999) else read -r -p "::: Would you like to upload the log? [y/N] " response @@ -423,8 +423,8 @@ finalWork() { fi # Check if tricorder.pi-hole.net is reachable and provide token. if [ -n "${tricorder}" ]; then - echo "::: Your debug token is : ${tricorder}" - echo "::: Please contact the Pi-hole team with your token for assistance." + echo "::: ---=== Your debug token is : ${tricorder} Please make a note of it. ===---" + echo "::: Contact the Pi-hole team with your token for assistance." echo "::: Thank you." else echo "::: There was an error uploading your debug log." From 38961fb31b9c3effe86927468f41e8b4015f53a8 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 27 Feb 2017 10:49:25 -0800 Subject: [PATCH 86/97] Help text clarification and addition of the automated debuggin flag. Signed-off-by: Dan Schaper --- pihole | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pihole b/pihole index ad021740..e4d832a5 100755 --- a/pihole +++ b/pihole @@ -283,6 +283,8 @@ helpFunc() { ::: -b, blacklist Blacklist domain(s) (exact match) ::: -wild, wildcard Blacklist whole domain(s) (wildcard) ::: -d, debug Start a debugging session +::: Automated debugging can be enabled with `-a`. +::: 'pihole -d -a' ::: -f, flush Flush the 'pihole.log' file ::: -t, tail Output the last lines of the 'pihole.log' file. Lines are appended as the file grows ::: -up, updatePihole Update Pi-hole components @@ -292,15 +294,15 @@ helpFunc() { ::: -h, help Show this help dialog ::: -v, version Show installed versions of Pi-Hole and Web-Admin ::: -q, query Query the adlists for a specific domain -::: Use 'pihole -q domain -exact' if you want to see exact matches only +::: 'pihole -q domain -exact' shows exact matches only ::: -l, logging Enable or Disable logging (pass 'on' or 'off') ::: -a, admin Admin webpage options ::: uninstall Uninstall Pi-Hole from your system :(! ::: status Is Pi-Hole Enabled or Disabled ::: enable Enable Pi-Hole DNS Blocking ::: disable Disable Pi-Hole DNS Blocking -::: Blocking can also be disabled only temporarily, e.g., -::: 'pihole disable 5m' - will disable blocking for 5 minutes +::: Blocking can also be disabled only temporarily, e.g., +::: 'pihole disable 5m' - will disable blocking for 5 minutes ::: restartdns Restart dnsmasq EOM exit 0 From 83b0600863d787d005621820ce11dcd69b5cbc83 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 27 Feb 2017 11:03:57 -0800 Subject: [PATCH 87/97] Carriage return or newline based webcalls. Signed-off-by: Dan Schaper --- advanced/Scripts/piholeDebug.sh | 10 ++++++++-- pihole | 9 ++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 176a3ead..70d73379 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -332,11 +332,17 @@ debugLighttpd() { } countdown() { + local tuvix tuvix=${TIMEOUT} - printf "::: Logging will automatically teminate in ${TIMEOUT} seconds\n" + printf "::: Logging will automatically teminate in %s seconds\n" "${TIMEOUT}" while [ $tuvix -ge 1 ] do - printf ":::\t${tuvix} seconds left. \r" + printf ":::\t%s seconds left. " "${tuvix}" + if [[ -z "${WEBCALL}" ]]; then + printf "\r" + else + printf "\n" + fi sleep 5 tuvix=$(( tuvix - 5 )) done diff --git a/pihole b/pihole index e4d832a5..cfe032ff 100755 --- a/pihole +++ b/pihole @@ -46,11 +46,18 @@ wildcardFunc() { debugFunc() { local automated + local web + + # Pull off the `debug` leaving passed call augmentation flags in $1 shift if [[ "${1}" == "-a" ]]; then automated="true" fi - AUTOMATED=${automated:-} "${PI_HOLE_SCRIPT_DIR}"/piholeDebug.sh + if [[ "${2}" == "-w" ]]; then + web="true" + fi + + AUTOMATED=${automated:-} WEBCALL=${web:-} "${PI_HOLE_SCRIPT_DIR}"/piholeDebug.sh exit 0 } From 17b0db65156dedc9efa7cd71ac3d8199f593f0a2 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 27 Feb 2017 11:40:20 -0800 Subject: [PATCH 88/97] Fix for calling -w without -a. Signed-off-by: Dan Schaper --- pihole | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pihole b/pihole index cfe032ff..41946f35 100755 --- a/pihole +++ b/pihole @@ -50,10 +50,10 @@ debugFunc() { # Pull off the `debug` leaving passed call augmentation flags in $1 shift - if [[ "${1}" == "-a" ]]; then + if [[ "$@" == *"-a"* ]]; then automated="true" fi - if [[ "${2}" == "-w" ]]; then + if [[ "$@" == *"-w"* ]]; then web="true" fi From de6c43a8d395cb2af7c79d0fcc3e85d149725a2a Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 1 Mar 2017 10:46:20 +0100 Subject: [PATCH 89/97] Setup interface listening behavior of dnsmasq --- advanced/Scripts/webpage.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 04644f2d..8f813d4b 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -27,6 +27,11 @@ helpFunc() { ::: -f, fahrenheit Set Fahrenheit temperature unit ::: -k, kelvin Set Kelvin temperature unit ::: -h, --help Show this help dialog +::: listening Setup interface listening behavior of dnsmasq +::: pihole -a listening allinterfaces : Listen on all interfaces, permit all origins +::: pihole -a listening gravityinterface : Listen only on one interface (see PIHOLE_INTERFACE) +::: pihole -a listening localsubnets : Listen only on all interfaces, but allow only +::: devices that at most one hop away (local devices) EOM exit 0 } @@ -133,6 +138,22 @@ trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE3 add_dnsmasq_setting "host-record" "${HOSTRECORD}" fi + # Setup interface listening behavior of dnsmasq + delete_dnsmasq_setting "interface" + delete_dnsmasq_setting "local-service" + + if [[ "${DNSMASQ_LISTENING}" == "allinterfaces" ]]; then + # Listen on all interfaces, permit all origins + # Leave a comment in 01-pihole.conf + add_dnsmasq_setting "# Listening on all interfaces" + elif [[ "${DNSMASQ_LISTENING}" == "gravityinterface" ]]; then + # Listen only on one interface + add_dnsmasq_setting "interface" "${PIHOLE_INTERFACE}" + else + # Listen only on all interfaces, but only local subnets + add_dnsmasq_setting "local-service" + fi + } SetDNSServers(){ @@ -365,6 +386,18 @@ SetHostRecord(){ } +SetListeningMode(){ + + if [[ "${args[2]}" == "allinterfaces" ]] ; then + change_setting "DNSMASQ_LISTENING" "allinterfaces" + elif [[ "${args[2]}" == "gravityinterface" ]] ; then + change_setting "DNSMASQ_LISTENING" "gravityinterface" + else + change_setting "DNSMASQ_LISTENING" "localsubnets" + fi + +} + main() { args=("$@") @@ -389,6 +422,7 @@ main() { "addstaticdhcp" ) AddDHCPStaticAddress;; "removestaticdhcp" ) RemoveDHCPStaticAddress;; "hostrecord" ) SetHostRecord;; + "listening" ) SetListeningMode;; * ) helpFunc;; esac From bd9dc91396cc98f2d5fb00217b1fbae31c029c1f Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 1 Mar 2017 10:50:13 +0100 Subject: [PATCH 90/97] Add response for users manually setting this up via CLI --- advanced/Scripts/webpage.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 8f813d4b..4dc22711 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -30,7 +30,7 @@ helpFunc() { ::: listening Setup interface listening behavior of dnsmasq ::: pihole -a listening allinterfaces : Listen on all interfaces, permit all origins ::: pihole -a listening gravityinterface : Listen only on one interface (see PIHOLE_INTERFACE) -::: pihole -a listening localsubnets : Listen only on all interfaces, but allow only +::: pihole -a listening localsubnets : Listen on all interfaces, but allow only queries from ::: devices that at most one hop away (local devices) EOM exit 0 @@ -388,11 +388,16 @@ SetHostRecord(){ SetListeningMode(){ + source "${setupVars}" + if [[ "${args[2]}" == "allinterfaces" ]] ; then + echo "Listening on all interfaces, permiting all origins" change_setting "DNSMASQ_LISTENING" "allinterfaces" elif [[ "${args[2]}" == "gravityinterface" ]] ; then + echo "Listening only on interface ${PIHOLE_INTERFACE}" change_setting "DNSMASQ_LISTENING" "gravityinterface" else + echo "Listening on all interfaces, permitting only origins that at most one hop away (local devices)" change_setting "DNSMASQ_LISTENING" "localsubnets" fi From 721ada7e16fd30af279c62fdb96879af4fe138db Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 1 Mar 2017 10:52:21 +0100 Subject: [PATCH 91/97] Fix typo --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 4dc22711..1a05497b 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -31,7 +31,7 @@ helpFunc() { ::: pihole -a listening allinterfaces : Listen on all interfaces, permit all origins ::: pihole -a listening gravityinterface : Listen only on one interface (see PIHOLE_INTERFACE) ::: pihole -a listening localsubnets : Listen on all interfaces, but allow only queries from -::: devices that at most one hop away (local devices) +::: devices that are at most one hop away (local devices) EOM exit 0 } @@ -397,7 +397,7 @@ SetListeningMode(){ echo "Listening only on interface ${PIHOLE_INTERFACE}" change_setting "DNSMASQ_LISTENING" "gravityinterface" else - echo "Listening on all interfaces, permitting only origins that at most one hop away (local devices)" + echo "Listening on all interfaces, permitting only origins that are at most one hop away (local devices)" change_setting "DNSMASQ_LISTENING" "localsubnets" fi From 01273124ea033506764f410da5934cdf220c6b7b Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 1 Mar 2017 10:59:55 +0100 Subject: [PATCH 92/97] Change to -i, interface --- advanced/Scripts/webpage.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 1a05497b..df1bd3b2 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -27,11 +27,11 @@ helpFunc() { ::: -f, fahrenheit Set Fahrenheit temperature unit ::: -k, kelvin Set Kelvin temperature unit ::: -h, --help Show this help dialog -::: listening Setup interface listening behavior of dnsmasq -::: pihole -a listening allinterfaces : Listen on all interfaces, permit all origins -::: pihole -a listening gravityinterface : Listen only on one interface (see PIHOLE_INTERFACE) -::: pihole -a listening localsubnets : Listen on all interfaces, but allow only queries from -::: devices that are at most one hop away (local devices) +::: -i, interface Setup interface listening behavior of dnsmasq +::: pihole -a -i all : Listen on all interfaces, permit all origins +::: pihole -a -i single : Listen only on one interface (see PIHOLE_INTERFACE) +::: pihole -a -i local : Listen on all interfaces, but allow only queries from +::: devices that are at most one hop away (local devices) EOM exit 0 } @@ -142,11 +142,11 @@ trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE3 delete_dnsmasq_setting "interface" delete_dnsmasq_setting "local-service" - if [[ "${DNSMASQ_LISTENING}" == "allinterfaces" ]]; then + if [[ "${DNSMASQ_LISTENING}" == "all" ]]; then # Listen on all interfaces, permit all origins # Leave a comment in 01-pihole.conf add_dnsmasq_setting "# Listening on all interfaces" - elif [[ "${DNSMASQ_LISTENING}" == "gravityinterface" ]]; then + elif [[ "${DNSMASQ_LISTENING}" == "single" ]]; then # Listen only on one interface add_dnsmasq_setting "interface" "${PIHOLE_INTERFACE}" else @@ -390,10 +390,10 @@ SetListeningMode(){ source "${setupVars}" - if [[ "${args[2]}" == "allinterfaces" ]] ; then - echo "Listening on all interfaces, permiting all origins" + if [[ "${args[2]}" == "all" ]] ; then + echo "Listening on all interfaces, permiting all origins, hope you have a firewall!" change_setting "DNSMASQ_LISTENING" "allinterfaces" - elif [[ "${args[2]}" == "gravityinterface" ]] ; then + elif [[ "${args[2]}" == "single" ]] ; then echo "Listening only on interface ${PIHOLE_INTERFACE}" change_setting "DNSMASQ_LISTENING" "gravityinterface" else @@ -427,7 +427,7 @@ main() { "addstaticdhcp" ) AddDHCPStaticAddress;; "removestaticdhcp" ) RemoveDHCPStaticAddress;; "hostrecord" ) SetHostRecord;; - "listening" ) SetListeningMode;; + "-i" | "interface" ) SetListeningMode;; * ) helpFunc;; esac From b74862bfc57ea90b4ae807c5aae59247f091219c Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 1 Mar 2017 11:02:08 +0100 Subject: [PATCH 93/97] Actually apply new setting by restarting dnsmasq --- advanced/Scripts/webpage.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index df1bd3b2..f10e9dca 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -392,15 +392,20 @@ SetListeningMode(){ if [[ "${args[2]}" == "all" ]] ; then echo "Listening on all interfaces, permiting all origins, hope you have a firewall!" - change_setting "DNSMASQ_LISTENING" "allinterfaces" + change_setting "DNSMASQ_LISTENING" "all" elif [[ "${args[2]}" == "single" ]] ; then echo "Listening only on interface ${PIHOLE_INTERFACE}" - change_setting "DNSMASQ_LISTENING" "gravityinterface" + change_setting "DNSMASQ_LISTENING" "single" else echo "Listening on all interfaces, permitting only origins that are at most one hop away (local devices)" - change_setting "DNSMASQ_LISTENING" "localsubnets" + change_setting "DNSMASQ_LISTENING" "local" fi + ProcessDNSSettings + + # Restart dnsmasq to load new configuration + RestartDNS + } main() { From 3adf8785d8c11dc091c27b00d2b13c6aa1c8d905 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 1 Mar 2017 11:07:05 +0100 Subject: [PATCH 94/97] Move "all" down in help text to not suggest that it is the default --- advanced/Scripts/webpage.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index f10e9dca..e971e87e 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -28,10 +28,10 @@ helpFunc() { ::: -k, kelvin Set Kelvin temperature unit ::: -h, --help Show this help dialog ::: -i, interface Setup interface listening behavior of dnsmasq -::: pihole -a -i all : Listen on all interfaces, permit all origins -::: pihole -a -i single : Listen only on one interface (see PIHOLE_INTERFACE) ::: pihole -a -i local : Listen on all interfaces, but allow only queries from -::: devices that are at most one hop away (local devices) +::: devices that are at most one hop away (local devices) +::: pihole -a -i single : Listen only on one interface (see PIHOLE_INTERFACE) +::: pihole -a -i all : Listen on all interfaces, permit all origins EOM exit 0 } From 189a4e0078901e22b1a77b8d00240fdb0e3abb99 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 1 Mar 2017 11:26:06 +0100 Subject: [PATCH 95/97] Add option to skip restarting of dnsmasq --- advanced/Scripts/webpage.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index e971e87e..72e529fc 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -401,10 +401,13 @@ SetListeningMode(){ change_setting "DNSMASQ_LISTENING" "local" fi - ProcessDNSSettings - - # Restart dnsmasq to load new configuration - RestartDNS + # Don't restart DNS server yet because other settings + # will be applied afterwards if "-web" is set + if [[ "${args[3]}" != "-web" ]]; then + ProcessDNSSettings + # Restart dnsmasq to load new configuration + RestartDNS + fi } From 0be1717ff407ef7449e78bcc863a8feb4798013a Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 1 Mar 2017 11:46:48 +0100 Subject: [PATCH 96/97] Fix config error --- advanced/Scripts/webpage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 72e529fc..d06f5066 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -134,7 +134,7 @@ trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE3 delete_dnsmasq_setting "host-record" - if [ -n "${#HOSTRECORD}" ]; then + if [ ! -z "${HOSTRECORD+x}" ]; then add_dnsmasq_setting "host-record" "${HOSTRECORD}" fi From 7ba47f504cb82993a3726f1c907889bb7c17fd5a Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 1 Mar 2017 12:15:04 +0100 Subject: [PATCH 97/97] Add special "except-interface" line in case of listening on all interfaces --- advanced/Scripts/webpage.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index d06f5066..70410d85 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -146,6 +146,7 @@ trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE3 # Listen on all interfaces, permit all origins # Leave a comment in 01-pihole.conf add_dnsmasq_setting "# Listening on all interfaces" + add_dnsmasq_setting "except-interface" "nonexisting" elif [[ "${DNSMASQ_LISTENING}" == "single" ]]; then # Listen only on one interface add_dnsmasq_setting "interface" "${PIHOLE_INTERFACE}"