From be79281418424cefd6dfc7d651792871b4e68d0e Mon Sep 17 00:00:00 2001 From: notracking Date: Sun, 10 Apr 2016 16:12:40 +0800 Subject: [PATCH 01/25] Added hosts-blocklists lists The hosts-blocklist is a semi-automatically updated list, based on various well known public sources, for more details read: https://github.com/notracking/hosts-blocklists/ Please be aware that one file is for domain blocking and the other file for hostname based blocking, these lists are complimentary and should therefore be used simultaneously. --- adlists.default | 3 +++ 1 file changed, 3 insertions(+) diff --git a/adlists.default b/adlists.default index 8a396729..837f612a 100644 --- a/adlists.default +++ b/adlists.default @@ -48,3 +48,6 @@ https://raw.githubusercontent.com/quidsup/notrack/master/trackers.txt #https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt #http://spam404bl.com/spam404scamlist.txt #http://malwaredomains.lehigh.edu/files/domains.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 From 2f4f5a6ad2c6557b21ffab66f4403c2a2f1d8fc3 Mon Sep 17 00:00:00 2001 From: nate Date: Mon, 11 Apr 2016 18:35:44 -0500 Subject: [PATCH 02/25] Added lighttpd error.log to debug output --- advanced/Scripts/piholeDebug.sh | 60 ++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 03d1498a..364abde4 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -19,6 +19,7 @@ DEBUG_LOG="/var/log/pihole_debug.log" DNSMASQFILE="/etc/dnsmasq.conf" PIHOLECONFFILE="/etc/dnsmasq.d/01-pihole.conf" LIGHTTPDFILE="/etc/lighttpd/lighttpd.conf" +LIGHTTPDERRFILE="/var/log/lighttpd/error.log" GRAVITYFILE="/etc/pihole/gravity.list" HOSTSFILE="/etc/hosts" WHITELISTFILE="/etc/pihole/whitelist.txt" @@ -126,12 +127,44 @@ function checkProcesses { for i in "${PROCESSES[@]}" do echo "" >> $DEBUG_LOG - echo -n $i >> "$DEBUG_LOG" + echo -n "$i" >> "$DEBUG_LOG" echo " processes status:" >> $DEBUG_LOG - $SUDO systemctl -l status $i >> "$DEBUG_LOG" + $SUDO systemctl -l status "$i" >> "$DEBUG_LOG" done } +function debugLighttpd { + echo "::: Writing lighttpd to debug log..." + echo "#######################################" >> $DEBUG_LOG + echo "############ lighttpd.conf ############" >> $DEBUG_LOG + echo "#######################################" >> $DEBUG_LOG + if [ -e "$LIGHTTPDFILE" ] + then + while read -r line; do + if [ ! -z "$line" ]; then + [[ "$line" =~ ^#.*$ ]] && continue + echo "$line" >> $DEBUG_LOG + fi + done < "$LIGHTTPDFILE" + echo >> $DEBUG_LOG + else + echo "No lighttpd.conf file found!" >> $DEBUG_LOG + printf ":::\tNo lighttpd.conf file found\n" + fi + + if [ -e "$LIGHTTPDERRFILE" ] + then + echo "#######################################" >> $DEBUG_LOG + echo "######### lighttpd error.log ##########" >> $DEBUG_LOG + echo "#######################################" >> $DEBUG_LOG + cat "$LIGHTTPDERRFILE" >> $DEBUG_LOG + else + echo "No lighttpd error.log file found!" >> $DEBUG_LOG + printf ":::\tNo lighttpd error.log file found\n" + fi + echo >> $DEBUG_LOG +} + ### END FUNCTIONS ### ### Check Pi internet connections ### @@ -152,6 +185,7 @@ compareWhitelist compareBlacklist testNslookup checkProcesses +debugLighttpd echo "::: Writing dnsmasq.conf to debug log..." echo "#######################################" >> $DEBUG_LOG @@ -178,7 +212,6 @@ echo "########### 01-pihole.conf ############" >> $DEBUG_LOG echo "#######################################" >> $DEBUG_LOG if [ -e "$PIHOLECONFFILE" ] then - #cat "$PIHOLECONFFILE" >> $DEBUG_LOG while read -r line; do if [ ! -z "$line" ]; then [[ "$line" =~ ^#.*$ ]] && continue @@ -191,25 +224,6 @@ else printf ":::\tNo 01-pihole.conf file found\n" fi -echo "::: Writing lighttpd.conf to debug log..." -echo "#######################################" >> $DEBUG_LOG -echo "############ lighttpd.conf ############" >> $DEBUG_LOG -echo "#######################################" >> $DEBUG_LOG -if [ -e "$LIGHTTPDFILE" ] -then - #cat "$PIHOLECONFFILE" >> $DEBUG_LOG - while read -r line; do - if [ ! -z "$line" ]; then - [[ "$line" =~ ^#.*$ ]] && continue - echo "$line" >> $DEBUG_LOG - fi - done < "$LIGHTTPDFILE" - echo >> $DEBUG_LOG -else - echo "No lighttpd.conf file found!" >> $DEBUG_LOG - printf ":::\tNo lighttpd.conf file found\n" -fi - echo "::: Writing size of gravity.list to debug log..." echo "#######################################" >> $DEBUG_LOG echo "############ gravity.list #############" >> $DEBUG_LOG @@ -283,7 +297,7 @@ fi # Continuously append the pihole.log file to the pihole_debug.log file function dumpPiHoleLog { - trap '{ echo -e "\nFinishing debug write from interrupt... Quitting!" ; exit 1; }' INT + trap '{ echo -e "\n::: Finishing debug write from interrupt... Quitting!" ; exit 1; }' INT echo -e "::: Writing current pihole traffic to debug log...\n:::\tTry loading any/all sites that you are having trouble with now... \n:::\t(Press ctrl+C to finish)" echo "#######################################" >> $DEBUG_LOG echo "############# pihole.log ##############" >> $DEBUG_LOG From a6bee76581a144cc170df47e59a63d99d7bb8f9f Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 12 Apr 2016 08:24:34 +0100 Subject: [PATCH 03/25] add location of debug log output file! --- advanced/Scripts/piholeDebug.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 364abde4..0796310a 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -316,7 +316,8 @@ function dumpPiHoleLog { # Anything to be done after capturing of pihole.log terminates function finalWork { - echo "::: Finshed debugging!" + echo "::: Finshed debugging!" + echo "::: Debug log can be found at : /var/log/pihole_debug.log" } trap finalWork EXIT From d10e9b1b6e06ed9d109094234e08b285618c7b46 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 12 Apr 2016 08:47:30 +0100 Subject: [PATCH 04/25] add pihole/webui version numbers --- advanced/Scripts/piholeDebug.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 0796310a..263fe9cd 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -54,6 +54,19 @@ else fi ### Private functions exist here ### +function versionCheck { + echo "#######################################" >> $DEBUG_LOG + echo "########## Versions Section ###########" >> $DEBUG_LOG + echo "#######################################" >> $DEBUG_LOG + + TMP=$(cd /etc/.pihole/ && git describe --tags --abbrev=0) + echo "Pi-hole Version: $TMP" >> $DEBUG_LOG + + TMP=$(cd /var/www/html/admin && git describe --tags --abbrev=0) + echo "WebUI Version: $TMP" >> $DEBUG_LOG + echo >> $DEBUG_LOG +} + function compareWhitelist { if [ ! -f "$WHITELISTMATCHES" ]; then $SUDO touch $WHITELISTMATCHES @@ -181,6 +194,7 @@ echo "Gateway check:" >> $DEBUG_LOG echo "$GATEWAY_CHECK" >> $DEBUG_LOG echo >> $DEBUG_LOG +versionCheck compareWhitelist compareBlacklist testNslookup From 4c890ab2022e2adfbe368ee02c643947cd812bac Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 13 Apr 2016 15:50:48 +0100 Subject: [PATCH 05/25] Add root check to blacklist script --- advanced/Scripts/blacklist.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/blacklist.sh b/advanced/Scripts/blacklist.sh index aa98f011..c178d9a1 100755 --- a/advanced/Scripts/blacklist.sh +++ b/advanced/Scripts/blacklist.sh @@ -10,6 +10,21 @@ # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. +#rootcheck +if [[ $EUID -eq 0 ]];then + echo "::: You are root." +else + echo "::: sudo will be used." + # Check if it is actually installed + # If it isn't, exit because the install cannot complete + if [[ $(dpkg-query -s sudo) ]];then + export SUDO="sudo" + else + echo "::: Please install sudo or run this script as root." + exit 1 + fi +fi + if [[ $# = 0 ]]; then helpFunc fi @@ -54,7 +69,7 @@ function helpFunc() echo "::: Immediately blacklists one or more domains in the hosts file" echo ":::" echo ":::" - echo "::: Usage: sudo pihole -b domain1 [domain2 ...]" + echo "::: Usage: pihole -b domain1 [domain2 ...]" echo "::: Options:" echo "::: -d, --delmode Remove domains from the blacklist" echo "::: -nr, --noreload Update blacklist without refreshing dnsmasq" @@ -166,10 +181,10 @@ function Reload() { if [[ $dnsmasqPid ]]; then # service already running - reload config - sudo kill -HUP "$dnsmasqPid" + $SUDO kill -HUP "$dnsmasqPid" else # service not running, start it up - sudo service dnsmasq start + $SUDO service dnsmasq start fi echo " done!" } From 77f4126f9b06596f967d4dd61fd0c3c823b95244 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 13 Apr 2016 15:51:48 +0100 Subject: [PATCH 06/25] add root check to whitelist script --- advanced/Scripts/whitelist.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index e69e8804..651ff4d4 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -10,6 +10,21 @@ # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. +#rootcheck +if [[ $EUID -eq 0 ]];then + echo "::: You are root." +else + echo "::: sudo will be used." + # Check if it is actually installed + # If it isn't, exit because the install cannot complete + if [[ $(dpkg-query -s sudo) ]];then + export SUDO="sudo" + else + echo "::: Please install sudo or run this script as root." + exit 1 + fi +fi + if [[ $# = 0 ]]; then helpFunc fi @@ -52,7 +67,7 @@ function helpFunc() { echo "::: Immediately whitelists one or more domains in the hosts file" echo ":::" - echo "::: Usage: sudo pihole -w domain1 [domain2 ...]" + echo "::: Usage: pihole -w domain1 [domain2 ...]" echo ":::" echo "::: Options:" echo "::: -d, --delmode Remove domains from the whitelist" @@ -179,10 +194,10 @@ function Reload() { if [[ $dnsmasqPid ]]; then # service already running - reload config - sudo kill -HUP "$dnsmasqPid" + $SUDO kill -HUP "$dnsmasqPid" else # service not running, start it up - sudo service dnsmasq start + $SUDO service dnsmasq start fi echo " done!" } From 3d4bff9414342cb20380749bf1509dc744491e55 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 16 Apr 2016 10:56:49 +0100 Subject: [PATCH 07/25] Add -s switch to kill command to increase compatability --- advanced/Scripts/blacklist.sh | 2 +- advanced/Scripts/whitelist.sh | 2 +- gravity.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/blacklist.sh b/advanced/Scripts/blacklist.sh index c178d9a1..a2f71db7 100755 --- a/advanced/Scripts/blacklist.sh +++ b/advanced/Scripts/blacklist.sh @@ -181,7 +181,7 @@ function Reload() { if [[ $dnsmasqPid ]]; then # service already running - reload config - $SUDO kill -HUP "$dnsmasqPid" + $SUDO kill -s HUP "$dnsmasqPid" else # service not running, start it up $SUDO service dnsmasq start diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index 651ff4d4..801ab9a2 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -194,7 +194,7 @@ function Reload() { if [[ $dnsmasqPid ]]; then # service already running - reload config - $SUDO kill -HUP "$dnsmasqPid" + $SUDO kill -s HUP "$dnsmasqPid" else # service not running, start it up $SUDO service dnsmasq start diff --git a/gravity.sh b/gravity.sh index ac9cd629..1a45de45 100755 --- a/gravity.sh +++ b/gravity.sh @@ -320,7 +320,7 @@ function gravity_reload() { if [[ $dnsmasqPid ]]; then # service already running - reload config - $SUDO kill -HUP "$dnsmasqPid" + $SUDO kill -s HUP "$dnsmasqPid" else # service not running, start it up $SUDO service dnsmasq start From 4941a657bf9e1abfa27df85a4f79981afc03a6ac Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 16 Apr 2016 12:59:40 +0100 Subject: [PATCH 08/25] remove -s switch, as it turns out it worked afterall. --- advanced/Scripts/blacklist.sh | 2 +- advanced/Scripts/whitelist.sh | 2 +- gravity.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/blacklist.sh b/advanced/Scripts/blacklist.sh index a2f71db7..c178d9a1 100755 --- a/advanced/Scripts/blacklist.sh +++ b/advanced/Scripts/blacklist.sh @@ -181,7 +181,7 @@ function Reload() { if [[ $dnsmasqPid ]]; then # service already running - reload config - $SUDO kill -s HUP "$dnsmasqPid" + $SUDO kill -HUP "$dnsmasqPid" else # service not running, start it up $SUDO service dnsmasq start diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index 801ab9a2..651ff4d4 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -194,7 +194,7 @@ function Reload() { if [[ $dnsmasqPid ]]; then # service already running - reload config - $SUDO kill -s HUP "$dnsmasqPid" + $SUDO kill -HUP "$dnsmasqPid" else # service not running, start it up $SUDO service dnsmasq start diff --git a/gravity.sh b/gravity.sh index 1a45de45..ac9cd629 100755 --- a/gravity.sh +++ b/gravity.sh @@ -320,7 +320,7 @@ function gravity_reload() { if [[ $dnsmasqPid ]]; then # service already running - reload config - $SUDO kill -s HUP "$dnsmasqPid" + $SUDO kill -HUP "$dnsmasqPid" else # service not running, start it up $SUDO service dnsmasq start From ad574f5e9084f65a1b5450bb95807f035174de5e Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 16 Apr 2016 15:52:38 +0100 Subject: [PATCH 09/25] Replace kill with killall --- advanced/Scripts/blacklist.sh | 2 +- advanced/Scripts/whitelist.sh | 2 +- gravity.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/blacklist.sh b/advanced/Scripts/blacklist.sh index c178d9a1..033289ba 100755 --- a/advanced/Scripts/blacklist.sh +++ b/advanced/Scripts/blacklist.sh @@ -181,7 +181,7 @@ function Reload() { if [[ $dnsmasqPid ]]; then # service already running - reload config - $SUDO kill -HUP "$dnsmasqPid" + $SUDO killall -s HUP dnsmasq else # service not running, start it up $SUDO service dnsmasq start diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index 651ff4d4..a525b24a 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -194,7 +194,7 @@ function Reload() { if [[ $dnsmasqPid ]]; then # service already running - reload config - $SUDO kill -HUP "$dnsmasqPid" + $SUDO killall -s HUP dnsmasq else # service not running, start it up $SUDO service dnsmasq start diff --git a/gravity.sh b/gravity.sh index ac9cd629..ffcbf342 100755 --- a/gravity.sh +++ b/gravity.sh @@ -320,7 +320,7 @@ function gravity_reload() { if [[ $dnsmasqPid ]]; then # service already running - reload config - $SUDO kill -HUP "$dnsmasqPid" + $SUDO killall -s HUP dnsmasq else # service not running, start it up $SUDO service dnsmasq start From b58519b974251e3bba7a40df78e1229d2c2482eb Mon Sep 17 00:00:00 2001 From: Mayur Raiturkar Date: Sun, 17 Apr 2016 18:21:32 +0530 Subject: [PATCH 10/25] fixed helpFunc 1 --- advanced/Scripts/blacklist.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/blacklist.sh b/advanced/Scripts/blacklist.sh index aa98f011..ae9cee16 100755 --- a/advanced/Scripts/blacklist.sh +++ b/advanced/Scripts/blacklist.sh @@ -10,9 +10,6 @@ # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. -if [[ $# = 0 ]]; then - helpFunc -fi #globals basename=pihole @@ -65,6 +62,10 @@ function helpFunc() exit 1 } +if [[ $# = 0 ]]; then + helpFunc +fi + function HandleOther(){ #check validity of domain validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/') From 56ac04c48e8c867a1ec2b1b1cdd1b0571b749735 Mon Sep 17 00:00:00 2001 From: Mayur Raiturkar Date: Sun, 17 Apr 2016 18:22:06 +0530 Subject: [PATCH 11/25] fixed helpFunc 2 --- advanced/Scripts/whitelist.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index e69e8804..8e9fa9c7 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -10,9 +10,6 @@ # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. -if [[ $# = 0 ]]; then - helpFunc -fi #globals basename=pihole @@ -64,6 +61,10 @@ function helpFunc() exit 1 } +if [[ $# = 0 ]]; then + helpFunc +fi + function HandleOther(){ #check validity of domain validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/') From 81fdfcba22868357017aa8288473bd17baa762b2 Mon Sep 17 00:00:00 2001 From: Jim Liu Date: Thu, 21 Apr 2016 23:40:38 +0800 Subject: [PATCH 12/25] Update whitelist.sh --- advanced/Scripts/whitelist.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index 92db9afe..23a72fae 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -42,12 +42,19 @@ verbose=true domList=() domToRemoveList=() +piholeIPfile=/tmp/piholeIP piholeIPv6file=/etc/pihole/.useIPv6 -# Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script -IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}') -piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}') -piholeIP=${piholeIPCIDR%/*} +if [[ -f $piholeIPfile ]];then + # If the file exists, it means it was exported from the installation script and we should use that value instead of detecting it in this script + piholeIP=$(cat $piholeIPfile) + #rm $piholeIPfile +else + # Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script + IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}') + piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}') + piholeIP=${piholeIPCIDR%/*} +fi modifyHost=false From a5ad48aa1843e4b24eec63fdd0411769b0fa16a5 Mon Sep 17 00:00:00 2001 From: Jim Liu Date: Thu, 21 Apr 2016 23:40:44 +0800 Subject: [PATCH 13/25] Update gravity.sh --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index ffcbf342..0538405e 100755 --- a/gravity.sh +++ b/gravity.sh @@ -38,7 +38,7 @@ blacklistScript=/opt/pihole/blacklist.sh if [[ -f $piholeIPfile ]];then # If the file exists, it means it was exported from the installation script and we should use that value instead of detecting it in this script piholeIP=$(cat $piholeIPfile) - rm $piholeIPfile + #rm $piholeIPfile else # Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}') From 08e95ed606bbb0d1e027d8b3ccbcc16793f45556 Mon Sep 17 00:00:00 2001 From: Jim Liu Date: Fri, 22 Apr 2016 01:40:42 +0800 Subject: [PATCH 14/25] Update gravity.sh Change piholeIPfile to a permanent location. --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 0538405e..ce04e181 100755 --- a/gravity.sh +++ b/gravity.sh @@ -27,7 +27,7 @@ else fi fi -piholeIPfile=/tmp/piholeIP +piholeIPfile=/etc/pihole/piholeIP piholeIPv6file=/etc/pihole/.useIPv6 adListFile=/etc/pihole/adlists.list From 10066209e72d50b01e601f315661c381642ec93f Mon Sep 17 00:00:00 2001 From: Jim Liu Date: Fri, 22 Apr 2016 01:41:11 +0800 Subject: [PATCH 15/25] Update whitelist.sh Change piholeIPfile to a permanent location. --- advanced/Scripts/whitelist.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index 23a72fae..b927615e 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -42,7 +42,7 @@ verbose=true domList=() domToRemoveList=() -piholeIPfile=/tmp/piholeIP +piholeIPfile=/etc/pihole/piholeIP piholeIPv6file=/etc/pihole/.useIPv6 if [[ -f $piholeIPfile ]];then From 08e6f60941f3a6486e038421b5d887c324664728 Mon Sep 17 00:00:00 2001 From: Jim Liu Date: Fri, 22 Apr 2016 01:42:43 +0800 Subject: [PATCH 16/25] Update blacklist.sh --- advanced/Scripts/blacklist.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/advanced/Scripts/blacklist.sh b/advanced/Scripts/blacklist.sh index f7a18eae..e28188eb 100755 --- a/advanced/Scripts/blacklist.sh +++ b/advanced/Scripts/blacklist.sh @@ -42,12 +42,19 @@ verbose=true domList=() domToRemoveList=() +piholeIPfile=/etc/pihole/piholeIP piholeIPv6file=/etc/pihole/.useIPv6 -# Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script -IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}') -piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}') -piholeIP=${piholeIPCIDR%/*} +if [[ -f $piholeIPfile ]];then + # If the file exists, it means it was exported from the installation script and we should use that value instead of detecting it in this script + piholeIP=$(cat $piholeIPfile) + #rm $piholeIPfile +else + # Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script + IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}') + piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}') + piholeIP=${piholeIPCIDR%/*} +fi modifyHost=false From 221b72439b2b3069735af706a611b44119ab9de4 Mon Sep 17 00:00:00 2001 From: Jim Liu Date: Fri, 22 Apr 2016 01:46:27 +0800 Subject: [PATCH 17/25] 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 139a7a4b..0f05ab63 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -255,8 +255,8 @@ It is also possible to use a DHCP reservation, but if you are going to do that, IP address: $IPv4addr Gateway: $IPv4gw" $r $c)then # If the settings are correct, then we need to set the piholeIP - # Saving it to a temporary file us to retrieve it later when we run the gravity.sh script - echo "${IPv4addr%/*}" > /tmp/piholeIP + # Saving it to a temporary file us to retrieve it later when we run the gravity.sh script. piholeIP is saved to a permanent file so gravity.sh can use it when updating + echo "${IPv4addr%/*}" > /etc/pihole/piholeIP echo "$piholeInterface" > /tmp/piholeINT # After that's done, the loop ends and we move on ipSettingsCorrect=True From d7de5b2afabf35c8c0175875c2fc991be65c3757 Mon Sep 17 00:00:00 2001 From: Jacob Salmela Date: Sat, 23 Apr 2016 15:56:14 -0500 Subject: [PATCH 18/25] link to pihole menubar --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 851e1639..940fe636 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ reddit: [/r/pihole](https://www.reddit.com/r/pihole/) [![Pi-hole exlplained](http://i.imgur.com/qNybJDX.png)](https://vimeo.com/135965232) ## Pi-hole Projects +- [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://www.stinebaugh.info/get-led-alerts-for-each-blocked-ad-using-pi-hole/) - [Pi-hole on Ubuntu 14.04 on VirtualBox](http://hbalagtas.blogspot.com/2016/02/adblocking-with-pi-hole-and-ubuntu-1404.html) - [x86 Docker container that runs Pi-hole](https://hub.docker.com/r/diginc/pi-hole/) From 00cc480bc1f69eb00e79b26769b7993079d9697d Mon Sep 17 00:00:00 2001 From: Jim Liu Date: Tue, 26 Apr 2016 16:10:51 +0800 Subject: [PATCH 19/25] Update basic-install.sh --- automated install/basic-install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 0f05ab63..bf3d855a 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -235,6 +235,8 @@ getStaticIPv4Settings() { whiptail --msgbox --backtitle "IP information" --title "FYI: IP Conflict" "It is possible your router could still try to assign this IP to a device, which would cause a conflict. But in most cases the router is smart enough to not do that. If you are worried, either manually set the address, or modify the DHCP reservation pool so it does not include the IP you want. It is also possible to use a DHCP reservation, but if you are going to do that, you might as well set a static address." $r $c + #piholeIP is saved to a permanent file so gravity.sh can use it when updating + echo "${IPv4addr%/*}" > /etc/pihole/piholeIP # Nothing else to do since the variables are already set above else # Otherwise, we need to ask the user to input their desired settings. From 7bc2844b9d01269db9af6e4d2a57a7640d0dc826 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Mon, 2 May 2016 18:51:02 -0400 Subject: [PATCH 20/25] Remove X-Pi-hole header Also adds `X-Frame-Options: DENY` for the admin directory, so that an ad can't load it into a frame --- advanced/lighttpd.conf | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/advanced/lighttpd.conf b/advanced/lighttpd.conf index 124371a9..761f9a24 100644 --- a/advanced/lighttpd.conf +++ b/advanced/lighttpd.conf @@ -46,13 +46,11 @@ include_shell "/usr/share/lighttpd/include-conf-enabled.pl" # If the URL starts with /admin, it is the Web interface $HTTP["url"] =~ "^/admin/" { # Create a response header for debugging using curl -I - setenv.add-response-header = ( "X-Pi-hole" => "The Pi-hole Web interface is working!" ) + setenv.add-response-header = ( "X-Frame-Options" => "DENY" ) } # If the URL does not start with /admin, then it is a query for an ad domain $HTTP["url"] =~ "^(?!/admin)/.*" { - # Create a response header for debugging using curl -I - setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." ) - # rewrite only js requests - url.rewrite = ("(.*).js" => "pihole/index.js") + # rewrite only js requests + url.rewrite = ("(.*).js" => "pihole/index.js") } From f03303e5aa4523071b92ef44ccc2ee5c1c9281fe Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Tue, 3 May 2016 11:58:13 -0400 Subject: [PATCH 21/25] Add X-Pi-hole header --- advanced/lighttpd.conf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/advanced/lighttpd.conf b/advanced/lighttpd.conf index 761f9a24..f899350a 100644 --- a/advanced/lighttpd.conf +++ b/advanced/lighttpd.conf @@ -46,11 +46,16 @@ include_shell "/usr/share/lighttpd/include-conf-enabled.pl" # If the URL starts with /admin, it is the Web interface $HTTP["url"] =~ "^/admin/" { # Create a response header for debugging using curl -I - setenv.add-response-header = ( "X-Frame-Options" => "DENY" ) + setenv.add-response-header = ( + "X-Pi-hole" => "The Pi-hole Web interface is working!", + "X-Frame-Options" => "DENY" + ) } # If the URL does not start with /admin, then it is a query for an ad domain $HTTP["url"] =~ "^(?!/admin)/.*" { + # Create a response header for debugging using curl -I + setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." ) # rewrite only js requests url.rewrite = ("(.*).js" => "pihole/index.js") } From c0e1772e211da9cfdcf3266c18401e1d23720326 Mon Sep 17 00:00:00 2001 From: Carter Maxwell Date: Sat, 7 May 2016 11:44:18 -0700 Subject: [PATCH 22/25] Replace toilet with echo --- advanced/Scripts/chronometer.sh | 6 +++++- automated install/basic-install.sh | 2 +- automated install/uninstall.sh | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/chronometer.sh b/advanced/Scripts/chronometer.sh index 1c8a53c9..806093e1 100755 --- a/advanced/Scripts/chronometer.sh +++ b/advanced/Scripts/chronometer.sh @@ -84,7 +84,11 @@ function normalChrono(){ do clear # Displays a colorful Pi-hole logo - toilet -f small -F gay Pi-hole + echo " ___ _ _ _" + echo "| _ (_)___| |_ ___| |___" + echo "| _/ |___| ' \/ _ \ / -_)" + echo "|_| |_| |_||_\___/_\___|" + echo "" echo " $(ifconfig eth0 | awk '/inet addr/ {print $2}' | cut -d':' -f2)" echo "" uptime | cut -d' ' -f11- diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index bf3d855a..84b05342 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -548,7 +548,7 @@ checkForDependencies() { echo ":::" echo "::: Checking dependencies:" - dependencies=( dnsutils bc toilet figlet dnsmasq lighttpd php5-common php5-cgi php5 git curl unzip wget ) + dependencies=( dnsutils bc dnsmasq lighttpd php5-common php5-cgi php5 git curl unzip wget ) for i in "${dependencies[@]}"; do echo -n "::: Checking for $i..." if [ "$(dpkg-query -W -f='${Status}' "$i" 2>/dev/null | grep -c "ok installed")" -eq 0 ]; then diff --git a/automated install/uninstall.sh b/automated install/uninstall.sh index 484a544d..2d32b52d 100755 --- a/automated install/uninstall.sh +++ b/automated install/uninstall.sh @@ -44,7 +44,7 @@ function removeAndPurge { # Purge dependencies echo ":::" # Nate 3/28/2016 - Removed `php5-cgi` and `php5` as they are removed with php5-common - dependencies=( dnsutils bc toilet figlet dnsmasq lighttpd php5-common git curl unzip wget ) + dependencies=( dnsutils bc dnsmasq lighttpd php5-common git curl unzip wget ) for i in "${dependencies[@]}"; do if [ "$(dpkg-query -W --showformat='${Status}\n' "$i" 2> /dev/null | grep -c "ok installed")" -eq 1 ]; then while true; do From b7e27bf6b45c2063d8372beea9b4187dc205e0f9 Mon Sep 17 00:00:00 2001 From: David Torcivia Date: Wed, 11 May 2016 18:24:43 -0400 Subject: [PATCH 23/25] Fix basic install for Proxmox LXC Fixed basic installer to properly bind to eth0 when install to a Proxmox LXC. --- 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 bf3d855a..528c46bf 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -43,7 +43,7 @@ IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1 IPv4addr=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}') IPv4gw=$(ip route get 8.8.8.8 | awk '{print $3}') -availableInterfaces=$(ip -o link | awk '{print $2}' | grep -v "lo" | cut -d':' -f1) +availableInterfaces=$(ip -o link | awk '{print $2}' | grep -v "lo" | cut -d':' -f1 | cut -d'@' -f1) dhcpcdFile=/etc/dhcpcd.conf ######## FIRST CHECK ######## From 892a90bf5117079d692dcf4972c211fce6d8b610 Mon Sep 17 00:00:00 2001 From: crazy-max Date: Sun, 15 May 2016 13:51:35 +0200 Subject: [PATCH 24/25] New URL for Windows 10 Telemetry list. --- adlists.default | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/adlists.default b/adlists.default index 837f612a..e535f5d7 100644 --- a/adlists.default +++ b/adlists.default @@ -1,7 +1,7 @@ -## Pi-hole ad-list default sources. Updated 21/02/2016 ######################### +## Pi-hole ad-list default sources. Updated 15/05/2016 ######################### # # # To make changes to this file: # -# 1. run `cp /etc/pihole/adlists.default /etc/pihole/adlists.list` # +# 1. run `cp /etc/pihole/adlists.default /etc/pihole/adlists.list` # # 2. run `nano /etc/pihole/adlists.list` # # 3. Uncomment or comment any of the below lists # # # @@ -32,7 +32,7 @@ http://hosts-file.net/ad_servers.txt #http://optimate.dl.sourceforge.net/project/adzhosts/HOSTS.txt # Windows 10 telemetry list -#https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/hostsBlockWindowsSpy.txt +#https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/hosts/hostsBlockWindowsSpy.txt # Securemecca.com list - Also blocks "adult" sites (pornography/gambling etc) #http://securemecca.com/Downloads/hosts.txt From b5529e5138a173633a037176534d63fe417858ab Mon Sep 17 00:00:00 2001 From: crazy-max Date: Sun, 22 May 2016 01:30:32 +0200 Subject: [PATCH 25/25] Update URL for Windows 10 Telemetry list --- adlists.default | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adlists.default b/adlists.default index e535f5d7..bf7197e6 100644 --- a/adlists.default +++ b/adlists.default @@ -1,4 +1,4 @@ -## Pi-hole ad-list default sources. Updated 15/05/2016 ######################### +## Pi-hole ad-list default sources. Updated 22/05/2016 ######################### # # # To make changes to this file: # # 1. run `cp /etc/pihole/adlists.default /etc/pihole/adlists.list` # @@ -32,7 +32,7 @@ http://hosts-file.net/ad_servers.txt #http://optimate.dl.sourceforge.net/project/adzhosts/HOSTS.txt # Windows 10 telemetry list -#https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/hosts/hostsBlockWindowsSpy.txt +#https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/hosts/windows10_spy.txt # Securemecca.com list - Also blocks "adult" sites (pornography/gambling etc) #http://securemecca.com/Downloads/hosts.txt