From be79281418424cefd6dfc7d651792871b4e68d0e Mon Sep 17 00:00:00 2001 From: notracking Date: Sun, 10 Apr 2016 16:12:40 +0800 Subject: [PATCH 1/6] 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 2/6] 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 3/6] 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 4/6] 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 b58519b974251e3bba7a40df78e1229d2c2482eb Mon Sep 17 00:00:00 2001 From: Mayur Raiturkar Date: Sun, 17 Apr 2016 18:21:32 +0530 Subject: [PATCH 5/6] 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 6/6] 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/')