From 99863bb799512b701be969e693693013145b8c6e Mon Sep 17 00:00:00 2001 From: Jacob Salmela Date: Sat, 20 Feb 2016 10:33:04 -0600 Subject: [PATCH 01/21] pihole on ubuntu 14.04 Also moved a link from "coverage" into "projects" as it was more appropriate --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 207375f2..39bb7f23 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,9 @@ Once installed, [configure your router to have **DHCP clients use the Pi as thei [![Pi-hole exlplained](http://i.imgur.com/qNybJDX.png)](https://vimeo.com/135965232) ## Pi-hole Projects +- [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/) +- [Splunk: Pi-hole Visualizser](https://splunkbase.splunk.com/app/3023/) - [Pi-hole Chrome extension](https://chrome.google.com/webstore/detail/pi-hole-list-editor/hlnoeoejkllgkjbnnnhfolapllcnaglh) ([open source](https://github.com/packtloss/pihole-extension)) - [Go Bananas for CHiP-hole ad blocking](https://www.hackster.io/jacobsalmela/chip-hole-network-wide-ad-blocker-98e037) - [Sky-Hole](http://dlaa.me/blog/post/skyhole) @@ -34,7 +36,6 @@ Once installed, [configure your router to have **DHCP clients use the Pi as thei - [Minibian Pi-hole](http://munkjensen.net/wiki/index.php/See_my_Pi-Hole#Minibian_Pi-hole) ## Coverage -- [Splunk: Pi-hole Visualizser](https://splunkbase.splunk.com/app/3023/) - [The Defrag Show - MSDN/Channel 9](https://channel9.msdn.com/Shows/The-Defrag-Show/Defrag-Endoscope-USB-Camera-The-Final-HoloLens-Vote-Adblock-Pi-and-more?WT.mc_id=dlvr_twitter_ch9#time=20m39s) - [MacObserver Podcast 585](http://www.macobserver.com/tmo/podcast/macgeekgab-585) - [Medium: Block All Ads For $53](https://medium.com/@robleathern/block-ads-on-all-home-devices-for-53-18-a5f1ec139693#.gj1xpgr5d) From 52549d51abd90ee0536189e15c0db1fa0771d2fe Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 22 Feb 2016 09:24:17 +0000 Subject: [PATCH 02/21] Update adlists.default Add extra warning regarding mahakala.is list. See comment by @leichterleben in #341 --- adlists.default | 1 + 1 file changed, 1 insertion(+) diff --git a/adlists.default b/adlists.default index 81676a3d..0d99244f 100644 --- a/adlists.default +++ b/adlists.default @@ -25,6 +25,7 @@ https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt http://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/ # ADZHOSTS list. Has been known to block legitimate domains From 6c58ea18dc349fcb5a7479c10b60b5ad47b00413 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Wed, 24 Feb 2016 12:02:18 -0500 Subject: [PATCH 03/21] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 39bb7f23..8df42072 100644 --- a/README.md +++ b/README.md @@ -93,4 +93,4 @@ You can view [real-time stats](http://pi-hole.net/faq/install-the-real-time-lcd- - There is also an [FAQ section on pi-hole.net](http://pi-hole.net) ## Other Operating Systems -This script will work for other UNIX-like systems with some slight **modifications**. As long as you can install `dnsmasq` and a Webserver, it should work OK. The automated install only works for a clean install of Raspiban right now since that is how the project originated. +This script will work for other UNIX-like systems with some slight **modifications**. As long as you can install `dnsmasq` and a Webserver, it should work OK. The automated install is only for a clean install of a Debian based system, such as the Raspberry Pi. From 2182b8339e971f76296ac4c683dbefbe7a1bcc3e Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Fri, 4 Mar 2016 04:22:54 -0800 Subject: [PATCH 04/21] Add social addresses --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 8df42072..ed8b7e4b 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,10 @@ Once installed, [configure your router to have **DHCP clients use the Pi as thei ## Pi-hole Is Free, But Powered By Your Donations [![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif "Free, but powered by donations")](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY "Donate") +## Catch us out on the net: +Twitter: @The_Pi_Hole +reddit: /r/pihole + ## How Does It Work? **Watch the 60-second video below to get a quick overview** From 4230b0388461547c5eeed615ad104155d94586bc Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Fri, 4 Mar 2016 07:34:17 -0500 Subject: [PATCH 05/21] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ed8b7e4b..69ae4c2a 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Once installed, [configure your router to have **DHCP clients use the Pi as thei ## Catch us out on the net: Twitter: @The_Pi_Hole + reddit: /r/pihole ## How Does It Work? From b1554d6a890ced0c6e51d56cd93821c34319186d Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Fri, 4 Mar 2016 04:38:31 -0800 Subject: [PATCH 06/21] Add links --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 69ae4c2a..af57dc88 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,9 @@ Once installed, [configure your router to have **DHCP clients use the Pi as thei [![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif "Free, but powered by donations")](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY "Donate") ## Catch us out on the net: -Twitter: @The_Pi_Hole +Twitter: [@The_Pi_Hole](https://twitter.com/The_Pi_Hole) -reddit: /r/pihole +reddit: [/r/pihole](https://www.reddit.com/r/pihole/) ## How Does It Work? **Watch the 60-second video below to get a quick overview** From 0ed30b802d5820bca40a01464e54e86ff796b144 Mon Sep 17 00:00:00 2001 From: Jacob Salmela Date: Fri, 4 Mar 2016 11:52:19 -0600 Subject: [PATCH 07/21] adafruit blog mention --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index af57dc88..0e21693c 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ reddit: [/r/pihole](https://www.reddit.com/r/pihole/) - [Minibian Pi-hole](http://munkjensen.net/wiki/index.php/See_my_Pi-Hole#Minibian_Pi-hole) ## Coverage +- [Pi-hole on Adafruit's blog](https://blog.adafruit.com/2016/03/04/pi-hole-is-a-black-hole-for-internet-ads-piday-raspberrypi-raspberry_pi/) - [The Defrag Show - MSDN/Channel 9](https://channel9.msdn.com/Shows/The-Defrag-Show/Defrag-Endoscope-USB-Camera-The-Final-HoloLens-Vote-Adblock-Pi-and-more?WT.mc_id=dlvr_twitter_ch9#time=20m39s) - [MacObserver Podcast 585](http://www.macobserver.com/tmo/podcast/macgeekgab-585) - [Medium: Block All Ads For $53](https://medium.com/@robleathern/block-ads-on-all-home-devices-for-53-18-a5f1ec139693#.gj1xpgr5d) From 3283f3ed7d2ae782ae8b7703849e1cb45aebd615 Mon Sep 17 00:00:00 2001 From: Jacob Salmela Date: Fri, 4 Mar 2016 12:07:29 -0600 Subject: [PATCH 08/21] Show off our pretty dashboard --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0e21693c..d250c4d0 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,8 @@ The [Web interface](https://github.com/jacobsalmela/AdminLTE#pi-hole-admin-dashb `http://192.168.1.x/admin/index.php` +![Pi-hole Advanced Stats Dashboard](http://i.imgur.com/rTlLYPh.png) + ### API A basic read-only API can be accessed at `/admin/api.php`. It returns the following JSON: From f09745b4ad963e22811195327299b865a68f1619 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Tue, 8 Mar 2016 16:28:45 -0500 Subject: [PATCH 09/21] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d250c4d0..0665b47d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Automated Install -##### Designed For Raspberry Pi A+, B, B+, 2, and Zero (with an Ethernet adapter) +##### Designed For Raspberry Pi A+, B, B+, 2, and Zero (with an Ethernet/Wi-Fi adapter) 1. Install Raspbian 2. Run the command below From eb462955feb3c9da3713b54a80ed07e91eda1f95 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 16 Mar 2016 05:06:03 -0700 Subject: [PATCH 10/21] Secure Pulls now with HTTPS Closes #310 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0665b47d..1a181d6f 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ 1. Install Raspbian 2. Run the command below -### ```curl -L install.pi-hole.net | bash``` +### ```curl -L https://install.pi-hole.net | bash``` #### Alternative Semi-Automated install #### ``` -wget -O basic-install.sh install.pi-hole.net +wget -O basic-install.sh https://install.pi-hole.net chmod +x basic-install.sh ./basic-install.sh ``` From 0b5f005a5d799d0a0a1200061ea668434fa77eaf Mon Sep 17 00:00:00 2001 From: nate Date: Sat, 19 Mar 2016 20:32:11 -0500 Subject: [PATCH 11/21] Added piholeDebug.sh script for advanced debugging Script piholeDebug.sh added to /usr/local/bin to generate a detailed log file for debugging/troubleshooting. --- advanced/Scripts/piholeDebug.sh | 157 +++++++++++++++++++++++++++++ automated install/basic-install.sh | 3 +- 2 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 advanced/Scripts/piholeDebug.sh diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh new file mode 100644 index 00000000..ead75cd9 --- /dev/null +++ b/advanced/Scripts/piholeDebug.sh @@ -0,0 +1,157 @@ +#!/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 +# 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. + +# Nate Brandeburg +# nate@ubiquisoft.com +# 3/19/2016 + +######## GLOBAL VARS ######## +DEBUG_LOG="/var/log/pihole_debug.log" + +######## FIRST CHECK ######## +# Must be root to debug +if [[ $EUID -eq 0 ]];then + echo "::: You are root... Beginning debug!" +else + echo "::: sudo will be used for debugging." + # Check if sudo is actually installed + if [[ $(dpkg-query -s sudo) ]];then + export SUDO="sudo" + else + echo "::: Please install sudo or run this as root." + exit 1 + fi +fi + +# Ensure the file exists, create if not, clear if exists. +if [ ! -f "$DEBUG_LOG" ] +then + $SUDO touch $DEBUG_LOG + $SUDO chmod 644 $DEBUG_LOG + $SUDO chown "$USER":root $DEBUG_LOG +else + truncate -s 0 $DEBUG_LOG +fi + +### Check Pi internet connections ### +# Log the IP addresses of this Pi +IPADDR=$(ifconfig | perl -nle 's/dr:(\S+)/print $1/e') +echo "Writing local IPs to debug log" +echo "IP Addresses of this Pi:" >> $DEBUG_LOG +echo "$IPADDR" >> $DEBUG_LOG +echo >> $DEBUG_LOG + +# Check if we can connect to the local gateway +GATEWAY_CHECK=$(ping -q -w 1 -c 1 "$(ip r | grep default | cut -d ' ' -f 3)" > /dev/null && echo ok || echo error) +echo "Gateway check:" >> $DEBUG_LOG +echo "$GATEWAY_CHECK" >> $DEBUG_LOG +echo >> $DEBUG_LOG + +echo "Writing dnsmasq.conf to debug log..." +echo "############### Dnsmasq ###############" >> $DEBUG_LOG +DNSMASQFILE="/etc/dnsmasq.conf" +if [ -e "$DNSMASQFILE" ] +then + cat $DNSMASQFILE >> $DEBUG_LOG + echo >> $DEBUG_LOG +else + echo "No dnsmasq.conf file found!" >> $DEBUG_LOG + echo "No dnsmasq.conf file found!" +fi + +echo "Writing hosts file to debug log..." +echo "############### Hosts ###############" >> $DEBUG_LOG +HOSTSFILE="/etc/hosts" +if [ -e "$HOSTSFILE" ] +then + cat "$HOSTSFILE" >> $DEBUG_LOG + echo >> $DEBUG_LOG +else + echo "No hosts file found!" >> $DEBUG_LOG + echo "No hosts file found!" +fi + +### PiHole application specific logging ### +# Write Pi-Hole logs to debug log +echo "Writing whitelist to debug log..." +echo "############### Whitelist ###############" >> $DEBUG_LOG +WHITELISTFILE="/etc/pihole/whitelist.txt" +if [ -e "$WHITELISTFILE" ] +then + cat "$WHITELISTFILE" >> $DEBUG_LOG + echo >> $DEBUG_LOG +else + echo "No whitelist.txt file found!" >> $DEBUG_LOG + echo "No whitelist.txt file found!" +fi + +echo "Writing blacklist to debug log..." +echo "############### Blacklist ###############" >> $DEBUG_LOG +BLACKLISTFILE="/etc/pihole/blacklist.txt" +if [ -e "$BLACKLISTFILE" ] +then + cat "$BLACKLISTFILE" >> $DEBUG_LOG + echo >> $DEBUG_LOG +else + echo "No blacklist.txt file found!" >> $DEBUG_LOG + echo "No blacklist.txt file found!" +fi + +echo "Writing adlists.list to debug log..." +echo "############### adlists.list ###############" >> $DEBUG_LOG +ADLISTSFILE="/etc/pihole/adlists.list" +if [ -e "$ADLISTSFILE" ] +then + cat "$ADLISTSFILE" >> $DEBUG_LOG + echo >> $DEBUG_LOG +else + echo "No adlists.list file found!" >> $DEBUG_LOG + echo "No adlists.list file found!" +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 + echo -e "Writing current pihole traffic to debug log...\nTry loading any/all sites that you are having trouble with now... (Press ctrl+C to finish)" + echo "############### pihole.log ###############" >> $DEBUG_LOG + PIHOLELOG="/var/log/pihole.log" + if [ -e "$PIHOLELOG" ] + then + while true; do + tail -f "$PIHOLELOG" >> $DEBUG_LOG + echo >> $DEBUG_LOG + done + else + echo "No pihole.log file found!" >> $DEBUG_LOG + echo "No pihole.log file found!" + fi +} + +function finalWrites { + # Write the gravity.list after the user is finished capturing the pihole.log output + echo "Writing gravity.list to debug log..." + echo "############### gravity.list ###############" >> $DEBUG_LOG + GRAVITYFILE="/etc/pihole/gravity.list" + if [ -e "$GRAVITYFILE" ] + then + cat /etc/pihole/gravity.list >> $DEBUG_LOG + echo >> $DEBUG_LOG + else + echo "No gravity.list file found!" >> $DEBUG_LOG + echo "No gravity.list file found" + fi +} +trap finalWrites EXIT + +### Method calls for additinal logging ### +dumpPiHoleLog diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index b3e6202f..8068a485 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -477,7 +477,8 @@ installScripts() { $SUDO cp /etc/.pihole/advanced/Scripts/blacklist.sh /usr/local/bin/blacklist.sh $SUDO cp /etc/.pihole/advanced/Scripts/piholeLogFlush.sh /usr/local/bin/piholeLogFlush.sh $SUDO cp /etc/.pihole/advanced/Scripts/updateDashboard.sh /usr/local/bin/updateDashboard.sh - $SUDO chmod 755 /usr/local/bin/{gravity,chronometer,whitelist,blacklist,piholeLogFlush,updateDashboard}.sh + $SUDO cp /etc/.pihole/advanced/Scripts/piholeDebug.sh /usr/local/bin/piholeDebug.sh + $SUDO chmod 755 /usr/local/bin/{gravity,chronometer,whitelist,blacklist,piholeLogFlush,updateDashboard,piholeDebug}.sh $SUDO echo " done." } From b0dd2310186647afa7e27c0f91aceea49c187b27 Mon Sep 17 00:00:00 2001 From: nate Date: Sat, 19 Mar 2016 21:34:02 -0500 Subject: [PATCH 12/21] Modified description in header Removed copied header description from piholeLogFlush.sh and replaced with relevant description. --- 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 ead75cd9..59ad130e 100644 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -3,7 +3,7 @@ # (c) 2015, 2016 by Jacob Salmela # Network-wide ad blocking via your Raspberry Pi # http://pi-hole.net -# Flushes /var/log/pihole.log +# Generates pihole_debug.log in /var/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 From 04638c90652d56240ab3ac378b5e43b152451417 Mon Sep 17 00:00:00 2001 From: nate Date: Sun, 20 Mar 2016 18:21:35 -0500 Subject: [PATCH 13/21] Added 01-pihole.conf from /etc/dnsmasq.d/ to log Write 01-pihole.conf to debug log --- advanced/Scripts/piholeDebug.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 59ad130e..b47d9755 100644 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -138,13 +138,25 @@ function dumpPiHoleLog { } function finalWrites { + # Write the 01-pihole.conf from /etc/dnsmasq.d/ to the debug log + echo "Writing 01-pihole.conf to debug log..." + echo "############### 01-pihole.conf ###############" >> $DEBUG_LOG + PIHOLECONFFILE="/etc/dnsmasq.d/01-pihole.conf" + if [ -e "$PIHOLECONFFILE" ] + then + cat "$PIHOLECONFFILE" >> $DEBUG_LOG + echo >> $DEBUG_LOG + else + echo "No 01-pihole.conf file found!" >> $DEBUG_LOG + echo "No 01-pihole.conf file found" + fi # Write the gravity.list after the user is finished capturing the pihole.log output echo "Writing gravity.list to debug log..." echo "############### gravity.list ###############" >> $DEBUG_LOG GRAVITYFILE="/etc/pihole/gravity.list" if [ -e "$GRAVITYFILE" ] then - cat /etc/pihole/gravity.list >> $DEBUG_LOG + cat "$GRAVITYFILE" >> $DEBUG_LOG echo >> $DEBUG_LOG else echo "No gravity.list file found!" >> $DEBUG_LOG From 00f46dc149ccbec41b690c3af7e59a40a9d6b290 Mon Sep 17 00:00:00 2001 From: nate Date: Wed, 23 Mar 2016 14:56:27 -0500 Subject: [PATCH 14/21] Added Pi 3B to README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1a181d6f..01928cdd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Automated Install -##### Designed For Raspberry Pi A+, B, B+, 2, and Zero (with an Ethernet/Wi-Fi adapter) +##### Designed For Raspberry Pi A+, B, B+, 2, Zero, and 3B (with an Ethernet/Wi-Fi adapter) 1. Install Raspbian 2. Run the command below From 86eafe7a332f8af6ca6ce5fb4ff32318063715e0 Mon Sep 17 00:00:00 2001 From: nate Date: Thu, 24 Mar 2016 16:21:29 -0500 Subject: [PATCH 15/21] Added comparison of gravity.list with Whitelist.txt and Blacklist.txt. Added additional echos to help read the debug file. TODO: testNslookup function --- advanced/Scripts/piholeDebug.sh | 162 +++++++++++++++++++++++--------- 1 file changed, 119 insertions(+), 43 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index b47d9755..8bb741ea 100644 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -12,22 +12,32 @@ # Nate Brandeburg # nate@ubiquisoft.com -# 3/19/2016 +# 3/24/2016 ######## GLOBAL VARS ######## DEBUG_LOG="/var/log/pihole_debug.log" +DNSMASQFILE="/etc/dnsmasq.conf" +PIHOLECONFFILE="/etc/dnsmasq.d/01-pihole.conf" +LIGHTTPDFILE="/etc/lighttpd/lighttpd.conf" +GRAVITYFILE="/etc/pihole/gravity.list" +HOSTSFILE="/etc/hosts" +WHITELISTFILE="/etc/pihole/whitelist.txt" +BLACKLISTFILE="/etc/pihole/blacklist.txt" +ADLISTSFILE="/etc/pihole/adlists.list" +PIHOLELOG="/var/log/pihole.log" + ######## FIRST CHECK ######## # Must be root to debug if [[ $EUID -eq 0 ]];then - echo "::: You are root... Beginning debug!" + echo "You are root... Beginning debug!" else - echo "::: sudo will be used for debugging." + echo "sudo will be used for debugging." # Check if sudo is actually installed if [[ $(dpkg-query -s sudo) ]];then export SUDO="sudo" else - echo "::: Please install sudo or run this as root." + echo "Please install sudo or run this as root." exit 1 fi fi @@ -42,6 +52,32 @@ else truncate -s 0 $DEBUG_LOG fi +### Private functions exist here ### +function compareWhitelist { + echo "#######################################" >> $DEBUG_LOG + echo "######## Whitelist Comparison #########" >> $DEBUG_LOG + echo "#######################################" >> $DEBUG_LOG + while read -r line; do + grep -w ".* $line$" "$GRAVITYFILE" >> $DEBUG_LOG + done < "$WHITELISTFILE" + echo >> $DEBUG_LOG +} + +function compareBlacklist { + echo "#######################################" >> $DEBUG_LOG + echo "######## Blacklist Comparison #########" >> $DEBUG_LOG + echo "#######################################" >> $DEBUG_LOG + while read -r line; do + grep -w ".* $line$" "$GRAVITYFILE" >> $DEBUG_LOG + done < "$BLACKLISTFILE" + echo >> $DEBUG_LOG +} + +function testNslookup { + # TODO: This will pull a non-matched entry from gravity.list to compare with the nslookup against Google's NS. + echo >> $DEBUG_LOG +} + ### Check Pi internet connections ### # Log the IP addresses of this Pi IPADDR=$(ifconfig | perl -nle 's/dr:(\S+)/print $1/e') @@ -57,20 +93,78 @@ echo "$GATEWAY_CHECK" >> $DEBUG_LOG echo >> $DEBUG_LOG echo "Writing dnsmasq.conf to debug log..." +echo "#######################################" >> $DEBUG_LOG echo "############### Dnsmasq ###############" >> $DEBUG_LOG -DNSMASQFILE="/etc/dnsmasq.conf" +echo "#######################################" >> $DEBUG_LOG if [ -e "$DNSMASQFILE" ] then - cat $DNSMASQFILE >> $DEBUG_LOG + #cat $DNSMASQFILE >> $DEBUG_LOG + while read -r line; do + [[ "$line" =~ ^#.*$ ]] && continue + echo "$line" >> $DEBUG_LOG + done < "$DNSMASQFILE" echo >> $DEBUG_LOG else echo "No dnsmasq.conf file found!" >> $DEBUG_LOG echo "No dnsmasq.conf file found!" fi +echo "Writing 01-pihole.conf to debug log..." +echo "#######################################" >> $DEBUG_LOG +echo "########### 01-pihole.conf ############" >> $DEBUG_LOG +echo "#######################################" >> $DEBUG_LOG +if [ -e "$PIHOLECONFFILE" ] +then + #cat "$PIHOLECONFFILE" >> $DEBUG_LOG + while read -r line; do + [[ "$line" =~ ^#.*$ ]] && continue + echo "$line" >> $DEBUG_LOG + done < "$PIHOLECONFFILE" + echo >> $DEBUG_LOG +else + echo "No 01-pihole.conf file found!" >> $DEBUG_LOG + echo "No 01-pihole.conf file found" +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 + [[ "$line" =~ ^#.*$ ]] && continue + echo "$line" >> $DEBUG_LOG + done < "$LIGHTTPDFILE" + echo >> $DEBUG_LOG +else + echo "No lighttpd.conf file found!" >> $DEBUG_LOG + echo "No lighttpd.conf file found" +fi + +echo "Writing size of gravity.list to debug log..." +echo "#######################################" >> $DEBUG_LOG +echo "############ gravity.list #############" >> $DEBUG_LOG +echo "#######################################" >> $DEBUG_LOG +if [ -e "$GRAVITYFILE" ] +then + wc -l "$GRAVITYFILE" >> $DEBUG_LOG + echo >> $DEBUG_LOG +else + echo "No gravity.list file found!" >> $DEBUG_LOG + echo "No gravity.list file found" +fi + +# Write the hostname output to compare against entries in /etc/hosts, which is logged next +echo "Hostname of this pihole is: " >> $DEBUG_LOG +hostname >> $DEBUG_LOG +echo >> $DEBUG_LOG + echo "Writing hosts file to debug log..." -echo "############### Hosts ###############" >> $DEBUG_LOG -HOSTSFILE="/etc/hosts" +echo "#######################################" >> $DEBUG_LOG +echo "################ Hosts ################" >> $DEBUG_LOG +echo "#######################################" >> $DEBUG_LOG if [ -e "$HOSTSFILE" ] then cat "$HOSTSFILE" >> $DEBUG_LOG @@ -83,8 +177,9 @@ fi ### PiHole application specific logging ### # Write Pi-Hole logs to debug log echo "Writing whitelist to debug log..." -echo "############### Whitelist ###############" >> $DEBUG_LOG -WHITELISTFILE="/etc/pihole/whitelist.txt" +echo "#######################################" >> $DEBUG_LOG +echo "############## Whitelist ##############" >> $DEBUG_LOG +echo "#######################################" >> $DEBUG_LOG if [ -e "$WHITELISTFILE" ] then cat "$WHITELISTFILE" >> $DEBUG_LOG @@ -95,8 +190,9 @@ else fi echo "Writing blacklist to debug log..." -echo "############### Blacklist ###############" >> $DEBUG_LOG -BLACKLISTFILE="/etc/pihole/blacklist.txt" +echo "#######################################" >> $DEBUG_LOG +echo "############## Blacklist ##############" >> $DEBUG_LOG +echo "#######################################" >> $DEBUG_LOG if [ -e "$BLACKLISTFILE" ] then cat "$BLACKLISTFILE" >> $DEBUG_LOG @@ -107,8 +203,9 @@ else fi echo "Writing adlists.list to debug log..." -echo "############### adlists.list ###############" >> $DEBUG_LOG -ADLISTSFILE="/etc/pihole/adlists.list" +echo "#######################################" >> $DEBUG_LOG +echo "############ adlists.list #############" >> $DEBUG_LOG +echo "#######################################" >> $DEBUG_LOG if [ -e "$ADLISTSFILE" ] then cat "$ADLISTSFILE" >> $DEBUG_LOG @@ -123,8 +220,9 @@ fi function dumpPiHoleLog { trap '{ echo -e "\nFinishing debug write from interrupt... Quitting!" ; exit 1; }' INT echo -e "Writing current pihole traffic to debug log...\nTry loading any/all sites that you are having trouble with now... (Press ctrl+C to finish)" - echo "############### pihole.log ###############" >> $DEBUG_LOG - PIHOLELOG="/var/log/pihole.log" + echo "#######################################" >> $DEBUG_LOG + echo "############# pihole.log ##############" >> $DEBUG_LOG + echo "#######################################" >> $DEBUG_LOG if [ -e "$PIHOLELOG" ] then while true; do @@ -137,33 +235,11 @@ function dumpPiHoleLog { fi } -function finalWrites { - # Write the 01-pihole.conf from /etc/dnsmasq.d/ to the debug log - echo "Writing 01-pihole.conf to debug log..." - echo "############### 01-pihole.conf ###############" >> $DEBUG_LOG - PIHOLECONFFILE="/etc/dnsmasq.d/01-pihole.conf" - if [ -e "$PIHOLECONFFILE" ] - then - cat "$PIHOLECONFFILE" >> $DEBUG_LOG - echo >> $DEBUG_LOG - else - echo "No 01-pihole.conf file found!" >> $DEBUG_LOG - echo "No 01-pihole.conf file found" - fi - # Write the gravity.list after the user is finished capturing the pihole.log output - echo "Writing gravity.list to debug log..." - echo "############### gravity.list ###############" >> $DEBUG_LOG - GRAVITYFILE="/etc/pihole/gravity.list" - if [ -e "$GRAVITYFILE" ] - then - cat "$GRAVITYFILE" >> $DEBUG_LOG - echo >> $DEBUG_LOG - else - echo "No gravity.list file found!" >> $DEBUG_LOG - echo "No gravity.list file found" - fi +# Anything to be done after capturing of pihole.log terminates +function finalWork { + echo "Finshed debugging!" } -trap finalWrites EXIT +trap finalWork EXIT -### Method calls for additinal logging ### +### Method calls for additional logging ### dumpPiHoleLog From b746250e71e247fc371b9c244d092dd54d28291a Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 24 Mar 2016 18:29:13 -0500 Subject: [PATCH 16/21] Made all advanced/Scripts/ executable for consistency. --- advanced/Scripts/blacklist.sh | 0 advanced/Scripts/piholeDebug.sh | 0 advanced/Scripts/setupLCD.sh | 0 advanced/Scripts/updateDashboard.sh | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 advanced/Scripts/blacklist.sh mode change 100644 => 100755 advanced/Scripts/piholeDebug.sh mode change 100644 => 100755 advanced/Scripts/setupLCD.sh mode change 100644 => 100755 advanced/Scripts/updateDashboard.sh diff --git a/advanced/Scripts/blacklist.sh b/advanced/Scripts/blacklist.sh old mode 100644 new mode 100755 diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh old mode 100644 new mode 100755 diff --git a/advanced/Scripts/setupLCD.sh b/advanced/Scripts/setupLCD.sh old mode 100644 new mode 100755 diff --git a/advanced/Scripts/updateDashboard.sh b/advanced/Scripts/updateDashboard.sh old mode 100644 new mode 100755 From 8f8dc66c7052999920d2f83c4f5f1df6d1622646 Mon Sep 17 00:00:00 2001 From: nate Date: Thu, 24 Mar 2016 18:50:53 -0500 Subject: [PATCH 17/21] Ignore whitespace when writing config files --- advanced/Scripts/piholeDebug.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 8bb741ea..e84e9319 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -100,8 +100,10 @@ if [ -e "$DNSMASQFILE" ] then #cat $DNSMASQFILE >> $DEBUG_LOG while read -r line; do - [[ "$line" =~ ^#.*$ ]] && continue - echo "$line" >> $DEBUG_LOG + if [ ! -z "$line" ]; then + [[ "$line" =~ ^#.*$ ]] && continue + echo "$line" >> $DEBUG_LOG + fi done < "$DNSMASQFILE" echo >> $DEBUG_LOG else @@ -117,8 +119,10 @@ if [ -e "$PIHOLECONFFILE" ] then #cat "$PIHOLECONFFILE" >> $DEBUG_LOG while read -r line; do - [[ "$line" =~ ^#.*$ ]] && continue - echo "$line" >> $DEBUG_LOG + if [ ! -z "$line" ]; then + [[ "$line" =~ ^#.*$ ]] && continue + echo "$line" >> $DEBUG_LOG + fi done < "$PIHOLECONFFILE" echo >> $DEBUG_LOG else @@ -134,8 +138,10 @@ if [ -e "$LIGHTTPDFILE" ] then #cat "$PIHOLECONFFILE" >> $DEBUG_LOG while read -r line; do - [[ "$line" =~ ^#.*$ ]] && continue - echo "$line" >> $DEBUG_LOG + if [ ! -z "$line" ]; then + [[ "$line" =~ ^#.*$ ]] && continue + echo "$line" >> $DEBUG_LOG + fi done < "$LIGHTTPDFILE" echo >> $DEBUG_LOG else From b4463bf42c2bf10f8d9a885f7f178509784015b1 Mon Sep 17 00:00:00 2001 From: nate Date: Fri, 25 Mar 2016 16:42:17 -0500 Subject: [PATCH 18/21] Added test for nslookup Checks the TESTURL for nslookup is not whitelisted --- advanced/Scripts/piholeDebug.sh | 46 ++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index e84e9319..ac7a4262 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -25,16 +25,17 @@ WHITELISTFILE="/etc/pihole/whitelist.txt" BLACKLISTFILE="/etc/pihole/blacklist.txt" ADLISTSFILE="/etc/pihole/adlists.list" PIHOLELOG="/var/log/pihole.log" +WHITELISTMATCHES="/tmp/whitelistmatches.list" ######## FIRST CHECK ######## # Must be root to debug -if [[ $EUID -eq 0 ]];then +if [[ $EUID -eq 0 ]]; then echo "You are root... Beginning debug!" else echo "sudo will be used for debugging." # Check if sudo is actually installed - if [[ $(dpkg-query -s sudo) ]];then + if [[ $(dpkg-query -s sudo) ]]; then export SUDO="sudo" else echo "Please install sudo or run this as root." @@ -43,8 +44,7 @@ else fi # Ensure the file exists, create if not, clear if exists. -if [ ! -f "$DEBUG_LOG" ] -then +if [ ! -f "$DEBUG_LOG" ]; then $SUDO touch $DEBUG_LOG $SUDO chmod 644 $DEBUG_LOG $SUDO chown "$USER":root $DEBUG_LOG @@ -54,11 +54,21 @@ fi ### Private functions exist here ### function compareWhitelist { + if [ ! -f "$WHITELISTMATCHES" ]; then + $SUDO touch $WHITELISTMATCHES + $SUDO chmod 644 $WHITELISTMATCHES + $SUDO chown "$USER":root $WHITELISTMATCHES + else + truncate -s 0 $WHITELISTMATCHES + fi + echo "#######################################" >> $DEBUG_LOG echo "######## Whitelist Comparison #########" >> $DEBUG_LOG echo "#######################################" >> $DEBUG_LOG while read -r line; do - grep -w ".* $line$" "$GRAVITYFILE" >> $DEBUG_LOG + TMP=$(grep -w ".* $line$" "$GRAVITYFILE") + echo "$TMP" >> $DEBUG_LOG + echo "$TMP" >> $WHITELISTMATCHES done < "$WHITELISTFILE" echo >> $DEBUG_LOG } @@ -74,7 +84,28 @@ function compareBlacklist { } function testNslookup { - # TODO: This will pull a non-matched entry from gravity.list to compare with the nslookup against Google's NS. + TESTURL="" + echo "#######################################" >> $DEBUG_LOG + echo "############ NSLookup Test ############" >> $DEBUG_LOG + echo "#######################################" >> $DEBUG_LOG + # Find a blocked url that has not been whitelisted. + while read -r line; do + CUTURL=$("$line" | cut -d " " -f2-) + if [ "$CUTURL" != "Pi-Hole.IsWorking.OK" ]; then + while read -r line2; do + CUTURL2=$("$line2" | cut -d " " -f2-) + if [ "$CUTURL" != "$CUTURL2" ]; then + TESTURL="$CUTURL" + fi + done < "WHITELISTMATCHES" + fi + done < "GRAVITYFILE" + + echo "NSLOOKUP of $TESTURL from PiHole:" >> $DEBUG_LOG + echo nslookup "$TESTURL" >> $DEBUG_LOG + echo >> $DEBUG_LOG + echo "NSLOOKUP of $TESTURL from 8.8.8.8:" >> $DEBUG_LOG + echo nslookup "$TESTURL" 8.8.8.8 >> $DEBUG_LOG echo >> $DEBUG_LOG } @@ -92,6 +123,9 @@ echo "Gateway check:" >> $DEBUG_LOG echo "$GATEWAY_CHECK" >> $DEBUG_LOG echo >> $DEBUG_LOG +# Test the nslookup here +testNslookup + echo "Writing dnsmasq.conf to debug log..." echo "#######################################" >> $DEBUG_LOG echo "############### Dnsmasq ###############" >> $DEBUG_LOG From a9c24b456d34bf83c1a85287a221be70120b79c8 Mon Sep 17 00:00:00 2001 From: nate Date: Fri, 25 Mar 2016 19:04:03 -0500 Subject: [PATCH 19/21] Bug fixes and logging improvements Finalized for production deployment. Next release targeting a tarball of config files plus additional logging. --- advanced/Scripts/piholeDebug.sh | 45 +++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index ac7a4262..ab417aa6 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -67,8 +67,10 @@ function compareWhitelist { echo "#######################################" >> $DEBUG_LOG while read -r line; do TMP=$(grep -w ".* $line$" "$GRAVITYFILE") - echo "$TMP" >> $DEBUG_LOG - echo "$TMP" >> $WHITELISTMATCHES + if [ ! -z "$TMP" ]; then + echo "$TMP" >> $DEBUG_LOG + echo "$TMP" >> $WHITELISTMATCHES + fi done < "$WHITELISTFILE" echo >> $DEBUG_LOG } @@ -78,34 +80,39 @@ function compareBlacklist { echo "######## Blacklist Comparison #########" >> $DEBUG_LOG echo "#######################################" >> $DEBUG_LOG while read -r line; do - grep -w ".* $line$" "$GRAVITYFILE" >> $DEBUG_LOG + if [ ! -z "$line" ]; then + grep -w ".* $line$" "$GRAVITYFILE" >> $DEBUG_LOG + fi done < "$BLACKLISTFILE" echo >> $DEBUG_LOG } function testNslookup { - TESTURL="" + TESTURL="doubleclick.com" echo "#######################################" >> $DEBUG_LOG echo "############ NSLookup Test ############" >> $DEBUG_LOG echo "#######################################" >> $DEBUG_LOG # Find a blocked url that has not been whitelisted. - while read -r line; do - CUTURL=$("$line" | cut -d " " -f2-) - if [ "$CUTURL" != "Pi-Hole.IsWorking.OK" ]; then - while read -r line2; do - CUTURL2=$("$line2" | cut -d " " -f2-) - if [ "$CUTURL" != "$CUTURL2" ]; then - TESTURL="$CUTURL" - fi - done < "WHITELISTMATCHES" - fi - done < "GRAVITYFILE" + if [ -s "$WHITELISTMATCHES" ]; then + while read -r line; do + CUTURL=${line#*" "} + if [ "$CUTURL" != "Pi-Hole.IsWorking.OK" ]; then + while read -r line2; do + CUTURL2=${line2#*" "} + if [ "$CUTURL" != "$CUTURL2" ]; then + TESTURL="$CUTURL" + break 2 + fi + done < "$WHITELISTMATCHES" + fi + done < "$GRAVITYFILE" + fi echo "NSLOOKUP of $TESTURL from PiHole:" >> $DEBUG_LOG - echo nslookup "$TESTURL" >> $DEBUG_LOG + nslookup "$TESTURL" >> $DEBUG_LOG echo >> $DEBUG_LOG echo "NSLOOKUP of $TESTURL from 8.8.8.8:" >> $DEBUG_LOG - echo nslookup "$TESTURL" 8.8.8.8 >> $DEBUG_LOG + nslookup "$TESTURL" 8.8.8.8 >> $DEBUG_LOG echo >> $DEBUG_LOG } @@ -124,6 +131,8 @@ echo "$GATEWAY_CHECK" >> $DEBUG_LOG echo >> $DEBUG_LOG # Test the nslookup here +compareWhitelist +compareBlacklist testNslookup echo "Writing dnsmasq.conf to debug log..." @@ -199,7 +208,6 @@ fi # Write the hostname output to compare against entries in /etc/hosts, which is logged next echo "Hostname of this pihole is: " >> $DEBUG_LOG hostname >> $DEBUG_LOG -echo >> $DEBUG_LOG echo "Writing hosts file to debug log..." echo "#######################################" >> $DEBUG_LOG @@ -215,7 +223,6 @@ else fi ### PiHole application specific logging ### -# Write Pi-Hole logs to debug log echo "Writing whitelist to debug log..." echo "#######################################" >> $DEBUG_LOG echo "############## Whitelist ##############" >> $DEBUG_LOG From 1a1026b367d0b34512e96b8f070a7452f049844b Mon Sep 17 00:00:00 2001 From: nate Date: Sun, 27 Mar 2016 14:44:42 -0500 Subject: [PATCH 20/21] Consistent stdout to match basic-install.sh and uninstall.sh --- advanced/Scripts/piholeDebug.sh | 46 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index ab417aa6..7656f963 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -31,14 +31,14 @@ WHITELISTMATCHES="/tmp/whitelistmatches.list" ######## FIRST CHECK ######## # Must be root to debug if [[ $EUID -eq 0 ]]; then - echo "You are root... Beginning debug!" + echo "::: You are root... Beginning debug!" else - echo "sudo will be used for debugging." + echo "::: Sudo will be used for debugging." # Check if sudo is actually installed if [[ $(dpkg-query -s sudo) ]]; then export SUDO="sudo" else - echo "Please install sudo or run this as root." + echo "::: Please install sudo or run this as root." exit 1 fi fi @@ -119,7 +119,7 @@ function testNslookup { ### Check Pi internet connections ### # Log the IP addresses of this Pi IPADDR=$(ifconfig | perl -nle 's/dr:(\S+)/print $1/e') -echo "Writing local IPs to debug log" +echo "::: Writing local IPs to debug log" echo "IP Addresses of this Pi:" >> $DEBUG_LOG echo "$IPADDR" >> $DEBUG_LOG echo >> $DEBUG_LOG @@ -135,7 +135,7 @@ compareWhitelist compareBlacklist testNslookup -echo "Writing dnsmasq.conf to debug log..." +echo "::: Writing dnsmasq.conf to debug log..." echo "#######################################" >> $DEBUG_LOG echo "############### Dnsmasq ###############" >> $DEBUG_LOG echo "#######################################" >> $DEBUG_LOG @@ -151,10 +151,10 @@ then echo >> $DEBUG_LOG else echo "No dnsmasq.conf file found!" >> $DEBUG_LOG - echo "No dnsmasq.conf file found!" + printf ":::\tNo dnsmasq.conf file found!\n" fi -echo "Writing 01-pihole.conf to debug log..." +echo "::: Writing 01-pihole.conf to debug log..." echo "#######################################" >> $DEBUG_LOG echo "########### 01-pihole.conf ############" >> $DEBUG_LOG echo "#######################################" >> $DEBUG_LOG @@ -170,10 +170,10 @@ then echo >> $DEBUG_LOG else echo "No 01-pihole.conf file found!" >> $DEBUG_LOG - echo "No 01-pihole.conf file found" + echo "::: No 01-pihole.conf file found\n" fi -echo "Writing lighttpd.conf to debug log..." +echo "::: Writing lighttpd.conf to debug log..." echo "#######################################" >> $DEBUG_LOG echo "############ lighttpd.conf ############" >> $DEBUG_LOG echo "#######################################" >> $DEBUG_LOG @@ -189,10 +189,10 @@ then echo >> $DEBUG_LOG else echo "No lighttpd.conf file found!" >> $DEBUG_LOG - echo "No lighttpd.conf file found" + printf ":::\tNo lighttpd.conf file found\n" fi -echo "Writing size of gravity.list to debug log..." +echo "::: Writing size of gravity.list to debug log..." echo "#######################################" >> $DEBUG_LOG echo "############ gravity.list #############" >> $DEBUG_LOG echo "#######################################" >> $DEBUG_LOG @@ -202,14 +202,14 @@ then echo >> $DEBUG_LOG else echo "No gravity.list file found!" >> $DEBUG_LOG - echo "No gravity.list file found" + printf ":::\tNo gravity.list file found\n" fi # Write the hostname output to compare against entries in /etc/hosts, which is logged next echo "Hostname of this pihole is: " >> $DEBUG_LOG hostname >> $DEBUG_LOG -echo "Writing hosts file to debug log..." +echo "::: Writing hosts file to debug log..." echo "#######################################" >> $DEBUG_LOG echo "################ Hosts ################" >> $DEBUG_LOG echo "#######################################" >> $DEBUG_LOG @@ -219,11 +219,11 @@ then echo >> $DEBUG_LOG else echo "No hosts file found!" >> $DEBUG_LOG - echo "No hosts file found!" + printf ":::\tNo hosts file found!\n" fi ### PiHole application specific logging ### -echo "Writing whitelist to debug log..." +echo "::: Writing whitelist to debug log..." echo "#######################################" >> $DEBUG_LOG echo "############## Whitelist ##############" >> $DEBUG_LOG echo "#######################################" >> $DEBUG_LOG @@ -233,10 +233,10 @@ then echo >> $DEBUG_LOG else echo "No whitelist.txt file found!" >> $DEBUG_LOG - echo "No whitelist.txt file found!" + printf ":::\tNo whitelist.txt file found!\n" fi -echo "Writing blacklist to debug log..." +echo "::: Writing blacklist to debug log..." echo "#######################################" >> $DEBUG_LOG echo "############## Blacklist ##############" >> $DEBUG_LOG echo "#######################################" >> $DEBUG_LOG @@ -246,10 +246,10 @@ then echo >> $DEBUG_LOG else echo "No blacklist.txt file found!" >> $DEBUG_LOG - echo "No blacklist.txt file found!" + printf ":::\tNo blacklist.txt file found!\n" fi -echo "Writing adlists.list to debug log..." +echo "::: Writing adlists.list to debug log..." echo "#######################################" >> $DEBUG_LOG echo "############ adlists.list #############" >> $DEBUG_LOG echo "#######################################" >> $DEBUG_LOG @@ -259,14 +259,14 @@ then echo >> $DEBUG_LOG else echo "No adlists.list file found!" >> $DEBUG_LOG - echo "No adlists.list file found!" + printf ":::\tNo adlists.list file found!\n" 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 - echo -e "Writing current pihole traffic to debug log...\nTry loading any/all sites that you are having trouble with now... (Press ctrl+C to finish)" + 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 echo "#######################################" >> $DEBUG_LOG @@ -278,13 +278,13 @@ function dumpPiHoleLog { done else echo "No pihole.log file found!" >> $DEBUG_LOG - echo "No pihole.log file found!" + printf ":::\tNo pihole.log file found!\n" fi } # Anything to be done after capturing of pihole.log terminates function finalWork { - echo "Finshed debugging!" + echo "::: Finshed debugging!" } trap finalWork EXIT From 6145748bfb3e922068b51c4d97108cdd6cb825c8 Mon Sep 17 00:00:00 2001 From: nate Date: Sun, 27 Mar 2016 20:36:31 -0500 Subject: [PATCH 21/21] Change single echo to printf to forrect \t interpretation --- 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 7656f963..d2c8e245 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -170,7 +170,7 @@ then echo >> $DEBUG_LOG else echo "No 01-pihole.conf file found!" >> $DEBUG_LOG - echo "::: No 01-pihole.conf file found\n" + printf ":::\tNo 01-pihole.conf file found\n" fi echo "::: Writing lighttpd.conf to debug log..."