From 697b0295f39ba135338a8ac2a54dd1749ee9b8cf Mon Sep 17 00:00:00 2001 From: Technicalpyro Date: Sun, 26 Feb 2017 14:24:08 -0600 Subject: [PATCH 01/12] fixes missing dialog package from some ditros --- 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 f168675e..8e8266b8 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -80,7 +80,7 @@ if command -v apt-get &> /dev/null; then fi # ######################################### INSTALLER_DEPS=(apt-utils debconf dhcpcd5 git ${iproute_pkg} whiptail) - PIHOLE_DEPS=(bc cron curl dnsmasq dnsutils iputils-ping lsof netcat sudo unzip wget) + PIHOLE_DEPS=(bc cron curl dialog dnsmasq dnsutils iputils-ping lsof netcat sudo unzip wget) PIHOLE_WEB_DEPS=(lighttpd ${phpVer}-common ${phpVer}-cgi) LIGHTTPD_USER="www-data" LIGHTTPD_GROUP="www-data" @@ -100,7 +100,7 @@ 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 nmap-ncat sudo unzip wget) + PIHOLE_DEPS=(bc bind-utils cronie curl dialog 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"); From 93dea7b942fff5bff9497cce07cd2bd3a2cfa869 Mon Sep 17 00:00:00 2001 From: Technicalpyro Date: Mon, 27 Feb 2017 15:21:59 -0500 Subject: [PATCH 02/12] Moved to installers dependencies --- automated install/basic-install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 8e8266b8..9b401203 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -79,8 +79,8 @@ if command -v apt-get &> /dev/null; then phpVer="php5" fi # ######################################### - INSTALLER_DEPS=(apt-utils debconf dhcpcd5 git ${iproute_pkg} whiptail) - PIHOLE_DEPS=(bc cron curl dialog dnsmasq dnsutils iputils-ping lsof netcat sudo unzip wget) + INSTALLER_DEPS=(apt-utils dialog debconf dhcpcd5 git ${iproute_pkg} whiptail) + PIHOLE_DEPS=(bc cron curl dnsmasq dnsutils iputils-ping lsof netcat sudo unzip wget) PIHOLE_WEB_DEPS=(lighttpd ${phpVer}-common ${phpVer}-cgi) LIGHTTPD_USER="www-data" LIGHTTPD_GROUP="www-data" @@ -99,8 +99,8 @@ elif command -v rpm &> /dev/null; then UPDATE_PKG_CACHE=":" 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 dialog dnsmasq findutils nmap-ncat sudo unzip wget) + INSTALLER_DEPS=(dialog git iproute net-tools newt procps-ng) + 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"); From 6a2b885988673ce60de78af85fcb69d284a836c4 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 27 Apr 2017 11:41:08 -0700 Subject: [PATCH 03/12] Update default User Agent to modern browser. Signed-off-by: Dan Schaper --- gravity.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gravity.sh b/gravity.sh index 0dccd77b..a5231d5e 100755 --- a/gravity.sh +++ b/gravity.sh @@ -167,7 +167,7 @@ gravity_transport() { # Process result gravity_patternCheck "${patternBuffer}" ${success} "${err}" - + # Delete temp file if it hasn't been moved if [[ -f "${patternBuffer}" ]]; then rm "${patternBuffer}" @@ -187,7 +187,7 @@ gravity_spinup() { saveLocation=${piholeDir}/list.${i}.${domain}.${justDomainsExtension} activeDomains[$i]=${saveLocation} - agent="Mozilla/10.0" + agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36" # Use a case statement to download lists that need special cURL commands # to complete properly and reset the user agent when required @@ -196,7 +196,7 @@ gravity_spinup() { agent='Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' cmd_ext="-e http://forum.xda-developers.com/" ;; - + "adaway.org") agent='Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' ;; From 19e688effbf866416078394e3e25fba75b1519f5 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 30 Apr 2017 13:47:07 +0200 Subject: [PATCH 04/12] Add localise-queries flag to 01-pihole.conf --- advanced/01-pihole.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/advanced/01-pihole.conf b/advanced/01-pihole.conf index 0ddf1caa..1b157f88 100644 --- a/advanced/01-pihole.conf +++ b/advanced/01-pihole.conf @@ -25,6 +25,8 @@ addn-hosts=/etc/pihole/local.list domain-needed +localise-queries + bogus-priv no-resolv From 30dcf6ff4719d88bae3507c021da9925ded0e03d Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 2 May 2017 09:18:58 +0200 Subject: [PATCH 05/12] Include pihole-FTL.log in debug report --- advanced/Scripts/piholeDebug.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 945cd81c..10dd1e8b 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -27,6 +27,7 @@ PIHOLELOG="/var/log/pihole.log" PIHOLEGITDIR="/etc/.pihole/" ADMINGITDIR="/var/www/html/admin/" WHITELISTMATCHES="/tmp/whitelistmatches.list" +readonly FTLLOG="/var/log/pihole-FTL.log" TIMEOUT=60 # Header info and introduction @@ -523,6 +524,18 @@ header_write "Analyzing pihole.log" && log_write "${PIHOLELOG} is ${pihole_size}." \ || log_echo "Warning: No pihole.log file found!" +header_write "Analyzing pihole-FTL.log" + + FTL_length=$(grep -c ^ "${FTLLOG}") \ + && log_write "${FTLLOG} is ${FTL_length} lines long." \ + || log_echo "Warning: No pihole-FTL.log file found!" + + FTL_size=$(du -h "${FTLLOG}" | awk '{ print $1 }') \ + && log_write "${FTLLOG} is ${FTL_size}." \ + || log_echo "Warning: No pihole-FTL.log file found!" + +tail -n50 "${FTLLOG}" >&3 + trap finalWork EXIT ### Method calls for additional logging ### From a5733508ae1ae625efcfd48190eab4b6a963d599 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 2 May 2017 21:36:08 +0100 Subject: [PATCH 06/12] Double hash the password directly in the install script --- automated install/basic-install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index d7075088..c9f4d659 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1413,7 +1413,9 @@ main() { 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}" + hash=$(echo -n ${pw} | sha256sum | sed 's/\s.*$//') + hash=$(echo -n ${hash} | sha256sum | sed 's/\s.*$//') + echo "WEBPASSWORD=${hash}" >> ${setupVars} fi fi From 9c136a5579cbfd3a151a3068bfe1abb8ef578c09 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 2 May 2017 22:24:37 +0100 Subject: [PATCH 07/12] functionise Hashing --- advanced/Scripts/webpage.sh | 11 ++++++++--- automated install/basic-install.sh | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 7804fc8f..1169d6f0 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -67,6 +67,13 @@ SetTemperatureUnit(){ } +HashPassword(){ + # Compute password hash twice to avoid rainbow table vulnerability + return=$(echo -n ${1} | sha256sum | sed 's/\s.*$//') + return=$(echo -n ${return} | sha256sum | sed 's/\s.*$//') + echo ${return} +} + SetWebPassword(){ if [ "${SUDO_USER}" == "www-data" ]; then @@ -93,9 +100,7 @@ SetWebPassword(){ read -s -p "Confirm Password: " CONFIRM echo "" if [ "${PASSWORD}" == "${CONFIRM}" ] ; then - # Compute password hash twice to avoid rainbow table vulnerability - hash=$(echo -n ${PASSWORD} | sha256sum | sed 's/\s.*$//') - hash=$(echo -n ${hash} | sha256sum | sed 's/\s.*$//') + hash=$(HashPassword ${PASSWORD}) # Save hash to file change_setting "WEBPASSWORD" "${hash}" echo "New password set" diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index c9f4d659..e3f48536 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1413,9 +1413,9 @@ main() { 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) - hash=$(echo -n ${pw} | sha256sum | sed 's/\s.*$//') + hash=$(echo -n ${pw} | sha256sum | sed 's/\s.*$//' | sha256sum | sed 's/\s.*$//') hash=$(echo -n ${hash} | sha256sum | sed 's/\s.*$//') - echo "WEBPASSWORD=${hash}" >> ${setupVars} + echo "WEBPASSWORD=$(echo -n ${pw} | sha256sum | sed 's/\s.*$//' | sha256sum | sed 's/\s.*$//')" >> ${setupVars} fi fi From 61ec7723f6abd599e6bd8f41e741a9ed31cf620d Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 2 May 2017 22:25:47 +0100 Subject: [PATCH 08/12] use function in install script --- automated install/basic-install.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index e3f48536..e535d115 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1413,9 +1413,8 @@ main() { 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) - hash=$(echo -n ${pw} | sha256sum | sed 's/\s.*$//' | sha256sum | sed 's/\s.*$//') - hash=$(echo -n ${hash} | sha256sum | sed 's/\s.*$//') - echo "WEBPASSWORD=$(echo -n ${pw} | sha256sum | sed 's/\s.*$//' | sha256sum | sed 's/\s.*$//')" >> ${setupVars} + . /opt/pihole/webpage.sh + echo "WEBPASSWORD=$(HashPassword ${1}) fi fi From bb6f409e89c931a313d12dbe2e3050d72bbde76a Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 2 May 2017 22:28:32 +0100 Subject: [PATCH 09/12] dropped a " --- 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 e535d115..cd39d225 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1414,7 +1414,7 @@ main() { if [[ $(grep 'WEBPASSWORD' -c /etc/pihole/setupVars.conf) == 0 ]] ; then pw=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8) . /opt/pihole/webpage.sh - echo "WEBPASSWORD=$(HashPassword ${1}) + echo "WEBPASSWORD=$(HashPassword ${1})" fi fi From 9c645e2010342cd47cf308555560b30783ce3153 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 2 May 2017 22:30:02 +0100 Subject: [PATCH 10/12] Seriously. --- 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 cd39d225..311adb72 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1414,7 +1414,7 @@ main() { if [[ $(grep 'WEBPASSWORD' -c /etc/pihole/setupVars.conf) == 0 ]] ; then pw=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8) . /opt/pihole/webpage.sh - echo "WEBPASSWORD=$(HashPassword ${1})" + echo "WEBPASSWORD=$(HashPassword ${1})" >> ${setupVars} fi fi From b13171cc4549ff894c6336bbd31ac9f32a0271d4 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 2 May 2017 22:37:38 +0100 Subject: [PATCH 11/12] $1 is not $pw. Seriously, who let me onto this project --- 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 311adb72..c65ef49f 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1414,7 +1414,7 @@ main() { if [[ $(grep 'WEBPASSWORD' -c /etc/pihole/setupVars.conf) == 0 ]] ; then pw=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8) . /opt/pihole/webpage.sh - echo "WEBPASSWORD=$(HashPassword ${1})" >> ${setupVars} + echo "WEBPASSWORD=$(HashPassword ${pw})" >> ${setupVars} fi fi From 9cc392fa0207b9b7840e4ac810f6eb42832990b5 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 4 May 2017 11:43:48 +0200 Subject: [PATCH 12/12] Update Marks PR after the Promo code has been merged --- advanced/Scripts/webpage.sh | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 1169d6f0..d3ad3032 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -88,17 +88,23 @@ SetWebPassword(){ exit 1 fi - read -s -p "Enter New Password (Blank for no password): " PASSWORD - echo "" - - if [ "${PASSWORD}" == "" ]; then - change_setting "WEBPASSWORD" "" - echo "Password Removed" - exit 0 - fi + if (( ${#args[2]} > 0 )) ; then + readonly PASSWORD="${args[2]}" + readonly CONFIRM="${PASSWORD}" + else + read -s -p "Enter New Password (Blank for no password): " PASSWORD + echo "" + + if [ "${PASSWORD}" == "" ]; then + change_setting "WEBPASSWORD" "" + echo "Password Removed" + exit 0 + fi + + read -s -p "Confirm Password: " CONFIRM + echo "" + fi - read -s -p "Confirm Password: " CONFIRM - echo "" if [ "${PASSWORD}" == "${CONFIRM}" ] ; then hash=$(HashPassword ${PASSWORD}) # Save hash to file