Compare commits
53 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
72e8ec7d93 | ||
|
13a479a9f6 | ||
|
1194e48bd8 | ||
|
1e0666d1ef | ||
|
1c53ad6876 | ||
|
dc2a537f6b | ||
|
a5d3022e9f | ||
|
4541da1f17 | ||
|
a16cd9aef7 | ||
|
6cf446032f | ||
|
3fda2d9ac3 | ||
|
c03268707a | ||
|
7829e907c9 | ||
|
b5529e5138 | ||
|
d601afcebc | ||
|
892a90bf51 | ||
|
d52a8f08ed | ||
|
b7e27bf6b4 | ||
|
9ee96d6176 | ||
|
c0e1772e21 | ||
|
62dc160c65 | ||
|
f03303e5aa | ||
|
7bc2844b9d | ||
|
ba283755be | ||
|
2209beff8a | ||
|
00cc480bc1 | ||
|
d7de5b2afa | ||
|
221b72439b | ||
|
08e6f60941 | ||
|
10066209e7 | ||
|
08e95ed606 | ||
|
a5ad48aa18 | ||
|
81fdfcba22 | ||
|
24de6d6fc9 | ||
|
aec6fcd00b | ||
|
619082dbed | ||
|
09cdf5081c | ||
|
d7abbbfac4 | ||
|
c714196647 | ||
|
b702c1d9a8 | ||
|
56ac04c48e | ||
|
b58519b974 | ||
|
ad574f5e90 | ||
|
4941a657bf | ||
|
3d4bff9414 | ||
|
2d03616c10 | ||
|
fcb9ba08a8 | ||
|
77f4126f9b | ||
|
4c890ab202 | ||
|
d10e9b1b6e | ||
|
a6bee76581 | ||
|
2f4f5a6ad2 | ||
|
be79281418 |
13
README.md
13
README.md
@@ -20,7 +20,15 @@ chmod +x basic-install.sh
|
|||||||
Once installed, [configure your router to have **DHCP clients use the Pi as their DNS server**](http://pi-hole.net/faq/can-i-set-the-pi-hole-to-be-the-dns-server-at-my-router-so-i-dont-have-to-change-settings-for-my-devices/) and then any device that connects to your network will have ads blocked without any further configuration. Alternatively, you can manually set each device to [use the Raspberry Pi as its DNS server](http://pi-hole.net/faq/how-do-i-use-the-pi-hole-as-my-dns-server/).
|
Once installed, [configure your router to have **DHCP clients use the Pi as their DNS server**](http://pi-hole.net/faq/can-i-set-the-pi-hole-to-be-the-dns-server-at-my-router-so-i-dont-have-to-change-settings-for-my-devices/) and then any device that connects to your network will have ads blocked without any further configuration. Alternatively, you can manually set each device to [use the Raspberry Pi as its DNS server](http://pi-hole.net/faq/how-do-i-use-the-pi-hole-as-my-dns-server/).
|
||||||
|
|
||||||
## Pi-hole Is Free, But Powered By Your Donations
|
## Pi-hole Is Free, But Powered By Your Donations
|
||||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY "Donate")
|
Send a one-time donation or sign up for Optimal.com's service using our link below to provide us with a small portion of the montly fee.
|
||||||
|
|
||||||
|
| Paypal | Bitcoin | Optimal.com |
|
||||||
|
| ------ | ------- | -------- |
|
||||||
|
| [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY "Donate") | <center> <br />1hXEKGKExiPAQ7y5CFPwWiEXUXB6wDuqX</center> | Sign up for [Optimal.com using our link](http://api.optimal.com/partner/v1.0/bmV0d29ya3xkbnN8OlJhc3BiZXJyeSBQaS1Ib2xl/subscribe?redirect=https%3A%2F%2Fpi-hole.net%2Fthank-you%2F) to provide us with a small monthly amount. Your money will also support content-creators.
|
||||||
|
|
||||||
|
[](http://api.optimal.com/partner/v1.0/bmV0d29ya3xkbnN8OlJhc3BiZXJyeSBQaS1Ib2xl/subscribe?redirect=https%3A%2F%2Fpi-hole.net%2Fthank-you%2F)
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
## Catch us out on the net:
|
## Catch us out on the net:
|
||||||
Twitter: [@The_Pi_Hole](https://twitter.com/The_Pi_Hole)
|
Twitter: [@The_Pi_Hole](https://twitter.com/The_Pi_Hole)
|
||||||
@@ -33,6 +41,7 @@ reddit: [/r/pihole](https://www.reddit.com/r/pihole/)
|
|||||||
[](https://vimeo.com/135965232)
|
[](https://vimeo.com/135965232)
|
||||||
|
|
||||||
## Pi-hole Projects
|
## 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/)
|
- [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)
|
- [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/)
|
- [x86 Docker container that runs Pi-hole](https://hub.docker.com/r/diginc/pi-hole/)
|
||||||
@@ -61,7 +70,7 @@ reddit: [/r/pihole](https://www.reddit.com/r/pihole/)
|
|||||||
|
|
||||||
## Partnering With Optimal.com
|
## Partnering With Optimal.com
|
||||||
|
|
||||||
Pi-hole will be teaming up with [Rob Leathern's subscription service to avoid ads](https://medium.com/@robleathern/block-ads-on-all-home-devices-for-53-18-a5f1ec139693#.gj1xpgr5d). This service is unique and will help content-creators and publishers [still make money from visitors who are using an ad ablocker](http://techcrunch.com/2015/12/17/the-new-optimal/).
|
Sign up for Optimal.com's service [using our link](http://api.optimal.com/partner/v1.0/bmV0d29ya3xkbnN8OlJhc3BiZXJyeSBQaS1Ib2xl/subscribe?redirect=https%3A%2F%2Fpi-hole.net%2Fthank-you%2F). This service splits your money between your favorite ad blockers and free Websites. This allows you to block ads while still supporting those sites that currently depend on ads for revenue.
|
||||||
|
|
||||||
## Technical Details
|
## Technical Details
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
## Pi-hole ad-list default sources. Updated 21/02/2016 #########################
|
## Pi-hole ad-list default sources. Updated 22/05/2016 #########################
|
||||||
# #
|
# #
|
||||||
# To make changes to this file: #
|
# 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` #
|
# 2. run `nano /etc/pihole/adlists.list` #
|
||||||
# 3. Uncomment or comment any of the below lists #
|
# 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
|
#http://optimate.dl.sourceforge.net/project/adzhosts/HOSTS.txt
|
||||||
|
|
||||||
# Windows 10 telemetry list
|
# Windows 10 telemetry list
|
||||||
#https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/hostsBlockWindowsSpy.txt
|
#https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/win10/spy.txt
|
||||||
|
|
||||||
# Securemecca.com list - Also blocks "adult" sites (pornography/gambling etc)
|
# Securemecca.com list - Also blocks "adult" sites (pornography/gambling etc)
|
||||||
#http://securemecca.com/Downloads/hosts.txt
|
#http://securemecca.com/Downloads/hosts.txt
|
||||||
@@ -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
|
#https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt
|
||||||
#http://spam404bl.com/spam404scamlist.txt
|
#http://spam404bl.com/spam404scamlist.txt
|
||||||
#http://malwaredomains.lehigh.edu/files/domains.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
|
||||||
|
@@ -10,6 +10,37 @@
|
|||||||
# the Free Software Foundation, either version 2 of the License, or
|
# the Free Software Foundation, either version 2 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
||||||
|
|
||||||
|
function helpFunc()
|
||||||
|
{
|
||||||
|
echo "::: Immediately blacklists one or more domains in the hosts file"
|
||||||
|
echo ":::"
|
||||||
|
echo ":::"
|
||||||
|
echo "::: Usage: pihole -b domain1 [domain2 ...]"
|
||||||
|
echo "::: Options:"
|
||||||
|
echo "::: -d, --delmode Remove domains from the blacklist"
|
||||||
|
echo "::: -nr, --noreload Update blacklist without refreshing dnsmasq"
|
||||||
|
echo "::: -f, --force Force updating of the hosts files, even if there are no changes"
|
||||||
|
echo "::: -q, --quiet output is less verbose"
|
||||||
|
echo "::: -h, --help Show this help dialog"
|
||||||
|
echo "::: -l, --list Display your blacklisted domains"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $# = 0 ]]; then
|
if [[ $# = 0 ]]; then
|
||||||
helpFunc
|
helpFunc
|
||||||
fi
|
fi
|
||||||
@@ -27,12 +58,19 @@ verbose=true
|
|||||||
domList=()
|
domList=()
|
||||||
domToRemoveList=()
|
domToRemoveList=()
|
||||||
|
|
||||||
|
piholeIPfile=/etc/pihole/piholeIP
|
||||||
piholeIPv6file=/etc/pihole/.useIPv6
|
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
|
if [[ -f $piholeIPfile ]];then
|
||||||
IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}')
|
# 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
|
||||||
piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}')
|
piholeIP=$(cat $piholeIPfile)
|
||||||
piholeIP=${piholeIPCIDR%/*}
|
#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
|
modifyHost=false
|
||||||
|
|
||||||
@@ -48,23 +86,6 @@ if [[ -f $piholeIPv6file ]];then
|
|||||||
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
|
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
function helpFunc()
|
|
||||||
{
|
|
||||||
echo "::: Immediately blacklists one or more domains in the hosts file"
|
|
||||||
echo ":::"
|
|
||||||
echo ":::"
|
|
||||||
echo "::: Usage: sudo pihole -b domain1 [domain2 ...]"
|
|
||||||
echo "::: Options:"
|
|
||||||
echo "::: -d, --delmode Remove domains from the blacklist"
|
|
||||||
echo "::: -nr, --noreload Update blacklist without refreshing dnsmasq"
|
|
||||||
echo "::: -f, --force Force updating of the hosts files, even if there are no changes"
|
|
||||||
echo "::: -q, --quiet output is less verbose"
|
|
||||||
echo "::: -h, --help Show this help dialog"
|
|
||||||
echo "::: -l, --list Display your blacklisted domains"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function HandleOther(){
|
function HandleOther(){
|
||||||
#check validity of domain
|
#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/')
|
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/')
|
||||||
@@ -166,10 +187,10 @@ function Reload() {
|
|||||||
|
|
||||||
if [[ $dnsmasqPid ]]; then
|
if [[ $dnsmasqPid ]]; then
|
||||||
# service already running - reload config
|
# service already running - reload config
|
||||||
sudo kill -HUP "$dnsmasqPid"
|
$SUDO killall -s HUP dnsmasq
|
||||||
else
|
else
|
||||||
# service not running, start it up
|
# service not running, start it up
|
||||||
sudo service dnsmasq start
|
$SUDO service dnsmasq start
|
||||||
fi
|
fi
|
||||||
echo " done!"
|
echo " done!"
|
||||||
}
|
}
|
||||||
|
@@ -84,7 +84,11 @@ function normalChrono(){
|
|||||||
do
|
do
|
||||||
clear
|
clear
|
||||||
# Displays a colorful Pi-hole logo
|
# Displays a colorful Pi-hole logo
|
||||||
toilet -f small -F gay Pi-hole
|
echo " [0;1;35;95m_[0;1;31;91m__[0m [0;1;33;93m_[0m [0;1;34;94m_[0m [0;1;36;96m_[0m"
|
||||||
|
echo "[0;1;31;91m|[0m [0;1;33;93m_[0m [0;1;32;92m(_[0;1;36;96m)_[0;1;34;94m__[0;1;35;95m|[0m [0;1;31;91m|_[0m [0;1;32;92m__[0;1;36;96m_|[0m [0;1;34;94m|[0;1;35;95m__[0;1;31;91m_[0m"
|
||||||
|
echo "[0;1;33;93m|[0m [0;1;32;92m_[0;1;36;96m/[0m [0;1;34;94m|_[0;1;35;95m__[0;1;31;91m|[0m [0;1;33;93m'[0m [0;1;32;92m\/[0m [0;1;36;96m_[0m [0;1;34;94m\[0m [0;1;35;95m/[0m [0;1;31;91m-[0;1;33;93m_)[0m"
|
||||||
|
echo "[0;1;32;92m|_[0;1;36;96m|[0m [0;1;34;94m|_[0;1;35;95m|[0m [0;1;33;93m|_[0;1;32;92m||[0;1;36;96m_\[0;1;34;94m__[0;1;35;95m_/[0;1;31;91m_\[0;1;33;93m__[0;1;32;92m_|[0m"
|
||||||
|
echo ""
|
||||||
echo " $(ifconfig eth0 | awk '/inet addr/ {print $2}' | cut -d':' -f2)"
|
echo " $(ifconfig eth0 | awk '/inet addr/ {print $2}' | cut -d':' -f2)"
|
||||||
echo ""
|
echo ""
|
||||||
uptime | cut -d' ' -f11-
|
uptime | cut -d' ' -f11-
|
||||||
|
@@ -19,6 +19,7 @@ DEBUG_LOG="/var/log/pihole_debug.log"
|
|||||||
DNSMASQFILE="/etc/dnsmasq.conf"
|
DNSMASQFILE="/etc/dnsmasq.conf"
|
||||||
PIHOLECONFFILE="/etc/dnsmasq.d/01-pihole.conf"
|
PIHOLECONFFILE="/etc/dnsmasq.d/01-pihole.conf"
|
||||||
LIGHTTPDFILE="/etc/lighttpd/lighttpd.conf"
|
LIGHTTPDFILE="/etc/lighttpd/lighttpd.conf"
|
||||||
|
LIGHTTPDERRFILE="/var/log/lighttpd/error.log"
|
||||||
GRAVITYFILE="/etc/pihole/gravity.list"
|
GRAVITYFILE="/etc/pihole/gravity.list"
|
||||||
HOSTSFILE="/etc/hosts"
|
HOSTSFILE="/etc/hosts"
|
||||||
WHITELISTFILE="/etc/pihole/whitelist.txt"
|
WHITELISTFILE="/etc/pihole/whitelist.txt"
|
||||||
@@ -53,6 +54,19 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
### Private functions exist here ###
|
### 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 {
|
function compareWhitelist {
|
||||||
if [ ! -f "$WHITELISTMATCHES" ]; then
|
if [ ! -f "$WHITELISTMATCHES" ]; then
|
||||||
$SUDO touch $WHITELISTMATCHES
|
$SUDO touch $WHITELISTMATCHES
|
||||||
@@ -126,12 +140,44 @@ function checkProcesses {
|
|||||||
for i in "${PROCESSES[@]}"
|
for i in "${PROCESSES[@]}"
|
||||||
do
|
do
|
||||||
echo "" >> $DEBUG_LOG
|
echo "" >> $DEBUG_LOG
|
||||||
echo -n $i >> "$DEBUG_LOG"
|
echo -n "$i" >> "$DEBUG_LOG"
|
||||||
echo " processes status:" >> $DEBUG_LOG
|
echo " processes status:" >> $DEBUG_LOG
|
||||||
$SUDO systemctl -l status $i >> "$DEBUG_LOG"
|
$SUDO systemctl -l status "$i" >> "$DEBUG_LOG"
|
||||||
done
|
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 ###
|
### END FUNCTIONS ###
|
||||||
|
|
||||||
### Check Pi internet connections ###
|
### Check Pi internet connections ###
|
||||||
@@ -148,10 +194,12 @@ echo "Gateway check:" >> $DEBUG_LOG
|
|||||||
echo "$GATEWAY_CHECK" >> $DEBUG_LOG
|
echo "$GATEWAY_CHECK" >> $DEBUG_LOG
|
||||||
echo >> $DEBUG_LOG
|
echo >> $DEBUG_LOG
|
||||||
|
|
||||||
|
versionCheck
|
||||||
compareWhitelist
|
compareWhitelist
|
||||||
compareBlacklist
|
compareBlacklist
|
||||||
testNslookup
|
testNslookup
|
||||||
checkProcesses
|
checkProcesses
|
||||||
|
debugLighttpd
|
||||||
|
|
||||||
echo "::: Writing dnsmasq.conf to debug log..."
|
echo "::: Writing dnsmasq.conf to debug log..."
|
||||||
echo "#######################################" >> $DEBUG_LOG
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
@@ -178,7 +226,6 @@ echo "########### 01-pihole.conf ############" >> $DEBUG_LOG
|
|||||||
echo "#######################################" >> $DEBUG_LOG
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
if [ -e "$PIHOLECONFFILE" ]
|
if [ -e "$PIHOLECONFFILE" ]
|
||||||
then
|
then
|
||||||
#cat "$PIHOLECONFFILE" >> $DEBUG_LOG
|
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
if [ ! -z "$line" ]; then
|
if [ ! -z "$line" ]; then
|
||||||
[[ "$line" =~ ^#.*$ ]] && continue
|
[[ "$line" =~ ^#.*$ ]] && continue
|
||||||
@@ -191,25 +238,6 @@ else
|
|||||||
printf ":::\tNo 01-pihole.conf file found\n"
|
printf ":::\tNo 01-pihole.conf file found\n"
|
||||||
fi
|
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 "::: Writing size of gravity.list to debug log..."
|
||||||
echo "#######################################" >> $DEBUG_LOG
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
echo "############ gravity.list #############" >> $DEBUG_LOG
|
echo "############ gravity.list #############" >> $DEBUG_LOG
|
||||||
@@ -283,7 +311,7 @@ fi
|
|||||||
|
|
||||||
# Continuously append the pihole.log file to the pihole_debug.log file
|
# Continuously append the pihole.log file to the pihole_debug.log file
|
||||||
function dumpPiHoleLog {
|
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 -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 "#######################################" >> $DEBUG_LOG
|
||||||
echo "############# pihole.log ##############" >> $DEBUG_LOG
|
echo "############# pihole.log ##############" >> $DEBUG_LOG
|
||||||
@@ -302,7 +330,8 @@ function dumpPiHoleLog {
|
|||||||
|
|
||||||
# Anything to be done after capturing of pihole.log terminates
|
# Anything to be done after capturing of pihole.log terminates
|
||||||
function finalWork {
|
function finalWork {
|
||||||
echo "::: Finshed debugging!"
|
echo "::: Finshed debugging!"
|
||||||
|
echo "::: Debug log can be found at : /var/log/pihole_debug.log"
|
||||||
}
|
}
|
||||||
trap finalWork EXIT
|
trap finalWork EXIT
|
||||||
|
|
||||||
|
@@ -10,6 +10,37 @@
|
|||||||
# the Free Software Foundation, either version 2 of the License, or
|
# the Free Software Foundation, either version 2 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
||||||
|
|
||||||
|
function helpFunc()
|
||||||
|
{
|
||||||
|
echo "::: Immediately whitelists one or more domains in the hosts file"
|
||||||
|
echo ":::"
|
||||||
|
echo "::: Usage: pihole -w domain1 [domain2 ...]"
|
||||||
|
echo ":::"
|
||||||
|
echo "::: Options:"
|
||||||
|
echo "::: -d, --delmode Remove domains from the whitelist"
|
||||||
|
echo "::: -nr, --noreload Update Whitelist without refreshing dnsmasq"
|
||||||
|
echo "::: -f, --force Force updating of the hosts files, even if there are no changes"
|
||||||
|
echo "::: -q, --quiet output is less verbose"
|
||||||
|
echo "::: -h, --help Show this help dialog"
|
||||||
|
echo "::: -l, --list Display your whitelisted domains"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $# = 0 ]]; then
|
if [[ $# = 0 ]]; then
|
||||||
helpFunc
|
helpFunc
|
||||||
fi
|
fi
|
||||||
@@ -27,12 +58,19 @@ verbose=true
|
|||||||
domList=()
|
domList=()
|
||||||
domToRemoveList=()
|
domToRemoveList=()
|
||||||
|
|
||||||
|
piholeIPfile=/etc/pihole/piholeIP
|
||||||
piholeIPv6file=/etc/pihole/.useIPv6
|
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
|
if [[ -f $piholeIPfile ]];then
|
||||||
IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}')
|
# 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
|
||||||
piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}')
|
piholeIP=$(cat $piholeIPfile)
|
||||||
piholeIP=${piholeIPCIDR%/*}
|
#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
|
modifyHost=false
|
||||||
|
|
||||||
@@ -47,23 +85,6 @@ if [[ -f $piholeIPv6file ]];then
|
|||||||
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
|
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
function helpFunc()
|
|
||||||
{
|
|
||||||
echo "::: Immediately whitelists one or more domains in the hosts file"
|
|
||||||
echo ":::"
|
|
||||||
echo "::: Usage: sudo pihole -w domain1 [domain2 ...]"
|
|
||||||
echo ":::"
|
|
||||||
echo "::: Options:"
|
|
||||||
echo "::: -d, --delmode Remove domains from the whitelist"
|
|
||||||
echo "::: -nr, --noreload Update Whitelist without refreshing dnsmasq"
|
|
||||||
echo "::: -f, --force Force updating of the hosts files, even if there are no changes"
|
|
||||||
echo "::: -q, --quiet output is less verbose"
|
|
||||||
echo "::: -h, --help Show this help dialog"
|
|
||||||
echo "::: -l, --list Display your whitelisted domains"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function HandleOther(){
|
function HandleOther(){
|
||||||
#check validity of domain
|
#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/')
|
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/')
|
||||||
@@ -179,10 +200,10 @@ function Reload() {
|
|||||||
|
|
||||||
if [[ $dnsmasqPid ]]; then
|
if [[ $dnsmasqPid ]]; then
|
||||||
# service already running - reload config
|
# service already running - reload config
|
||||||
sudo kill -HUP "$dnsmasqPid"
|
$SUDO killall -s HUP dnsmasq
|
||||||
else
|
else
|
||||||
# service not running, start it up
|
# service not running, start it up
|
||||||
sudo service dnsmasq start
|
$SUDO service dnsmasq start
|
||||||
fi
|
fi
|
||||||
echo " done!"
|
echo " done!"
|
||||||
}
|
}
|
||||||
|
@@ -46,13 +46,16 @@ include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
|
|||||||
# If the URL starts with /admin, it is the Web interface
|
# If the URL starts with /admin, it is the Web interface
|
||||||
$HTTP["url"] =~ "^/admin/" {
|
$HTTP["url"] =~ "^/admin/" {
|
||||||
# Create a response header for debugging using curl -I
|
# 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-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
|
# If the URL does not start with /admin, then it is a query for an ad domain
|
||||||
$HTTP["url"] =~ "^(?!/admin)/.*" {
|
$HTTP["url"] =~ "^(?!/admin)/.*" {
|
||||||
# Create a response header for debugging using curl -I
|
# Create a response header for debugging using curl -I
|
||||||
setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." )
|
setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." )
|
||||||
# rewrite only js requests
|
# rewrite only js requests
|
||||||
url.rewrite = ("(.*).js" => "pihole/index.js")
|
url.rewrite = ("(.*).js" => "pihole/index.js")
|
||||||
}
|
}
|
||||||
|
12
advanced/pihole.sudo
Normal file
12
advanced/pihole.sudo
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# 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
|
||||||
|
# Allows the WebUI to use Pi-hole commands
|
||||||
|
#
|
||||||
|
# Pi-hole is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
|
||||||
|
www-data ALL=NOPASSWD: /usr/local/bin/pihole
|
@@ -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}')
|
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}')
|
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
|
dhcpcdFile=/etc/dhcpcd.conf
|
||||||
|
|
||||||
######## FIRST CHECK ########
|
######## FIRST CHECK ########
|
||||||
@@ -58,7 +58,7 @@ else
|
|||||||
if [[ $(dpkg-query -s sudo) ]];then
|
if [[ $(dpkg-query -s sudo) ]];then
|
||||||
export SUDO="sudo"
|
export SUDO="sudo"
|
||||||
else
|
else
|
||||||
echo "::: Please install sudo or run this as root."
|
echo "::: sudo is needed for the Web interface to run pihole commands. Please run this script as root and it will be automatically installed."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -110,7 +110,7 @@ welcomeDialogs() {
|
|||||||
|
|
||||||
# Explain the need for a static address
|
# Explain the need for a static address
|
||||||
whiptail --msgbox --backtitle "Initating network interface" --title "Static IP Needed" "The Pi-hole is a SERVER so it needs a STATIC IP ADDRESS to function properly.
|
whiptail --msgbox --backtitle "Initating network interface" --title "Static IP Needed" "The Pi-hole is a SERVER so it needs a STATIC IP ADDRESS to function properly.
|
||||||
|
|
||||||
In the next section, you can choose to use your current network settings (DHCP) or to manually edit them." $r $c
|
In the next section, you can choose to use your current network settings (DHCP) or to manually edit them." $r $c
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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.
|
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.
|
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
|
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
|
# Nothing else to do since the variables are already set above
|
||||||
else
|
else
|
||||||
# Otherwise, we need to ask the user to input their desired settings.
|
# Otherwise, we need to ask the user to input their desired settings.
|
||||||
@@ -255,8 +257,8 @@ It is also possible to use a DHCP reservation, but if you are going to do that,
|
|||||||
IP address: $IPv4addr
|
IP address: $IPv4addr
|
||||||
Gateway: $IPv4gw" $r $c)then
|
Gateway: $IPv4gw" $r $c)then
|
||||||
# If the settings are correct, then we need to set the piholeIP
|
# 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
|
# 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%/*}" > /tmp/piholeIP
|
echo "${IPv4addr%/*}" > /etc/pihole/piholeIP
|
||||||
echo "$piholeInterface" > /tmp/piholeINT
|
echo "$piholeInterface" > /tmp/piholeINT
|
||||||
# After that's done, the loop ends and we move on
|
# After that's done, the loop ends and we move on
|
||||||
ipSettingsCorrect=True
|
ipSettingsCorrect=True
|
||||||
@@ -546,7 +548,7 @@ checkForDependencies() {
|
|||||||
echo ":::"
|
echo ":::"
|
||||||
echo "::: Checking dependencies:"
|
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 sudo)
|
||||||
for i in "${dependencies[@]}"; do
|
for i in "${dependencies[@]}"; do
|
||||||
echo -n "::: Checking for $i..."
|
echo -n "::: Checking for $i..."
|
||||||
if [ "$(dpkg-query -W -f='${Status}' "$i" 2>/dev/null | grep -c "ok installed")" -eq 0 ]; then
|
if [ "$(dpkg-query -W -f='${Status}' "$i" 2>/dev/null | grep -c "ok installed")" -eq 0 ]; then
|
||||||
@@ -636,6 +638,12 @@ installPiholeWeb() {
|
|||||||
$SUDO cp /etc/.pihole/advanced/index.* /var/www/html/pihole/.
|
$SUDO cp /etc/.pihole/advanced/index.* /var/www/html/pihole/.
|
||||||
$SUDO echo " done!"
|
$SUDO echo " done!"
|
||||||
fi
|
fi
|
||||||
|
# Install Sudoer file
|
||||||
|
echo -n "::: Installing sudoer file..."
|
||||||
|
$SUDO mkdir -p /etc/sudoers.d/
|
||||||
|
$SUDO cp /etc/.pihole/advanced/pihole.sudo /etc/sudoers.d/pihole
|
||||||
|
$SUDO chmod 0440 /etc/sudoers.d/pihole
|
||||||
|
echo " done!"
|
||||||
}
|
}
|
||||||
|
|
||||||
installCron() {
|
installCron() {
|
||||||
@@ -696,12 +704,13 @@ displayFinalMessage() {
|
|||||||
# Final completion message to user
|
# Final completion message to user
|
||||||
whiptail --msgbox --backtitle "Make it so." --title "Installation Complete!" "Configure your devices to use the Pi-hole as their DNS server using:
|
whiptail --msgbox --backtitle "Make it so." --title "Installation Complete!" "Configure your devices to use the Pi-hole as their DNS server using:
|
||||||
|
|
||||||
IPv4: $IPv4addr
|
IPv4: ${IPv4addr%/*}
|
||||||
IPv6: $piholeIPv6
|
IPv6: $piholeIPv6
|
||||||
|
|
||||||
If you set a new IP address, you should restart the Pi.
|
If you set a new IP address, you should restart the Pi.
|
||||||
|
|
||||||
The install log is in /etc/pihole." $r $c
|
The install log is in /etc/pihole.
|
||||||
|
View the web interface at http://pi.hole/admin or http://${IPv4addr%/*}/admin" $r $c
|
||||||
}
|
}
|
||||||
|
|
||||||
######## SCRIPT ############
|
######## SCRIPT ############
|
||||||
@@ -738,10 +747,10 @@ echo " done."
|
|||||||
|
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo "::: Installation Complete! Configure your devices to use the Pi-hole as their DNS server using:"
|
echo "::: Installation Complete! Configure your devices to use the Pi-hole as their DNS server using:"
|
||||||
echo "::: $IPv4addr"
|
echo "::: ${IPv4addr%/*}"
|
||||||
echo "::: $piholeIPv6"
|
echo "::: $piholeIPv6"
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo "::: If you set a new IP address, you should restart the Pi."
|
echo "::: If you set a new IP address, you should restart the Pi."
|
||||||
echo "::: "
|
echo ":::"
|
||||||
echo "::: The install log is located at: /etc/pihole/install.log"
|
echo "::: The install log is located at: /etc/pihole/install.log"
|
||||||
|
echo "::: View the web interface at http://pi.hole/admin or http://${IPv4addr%/*}/admin"
|
||||||
|
@@ -44,7 +44,7 @@ function removeAndPurge {
|
|||||||
# Purge dependencies
|
# Purge dependencies
|
||||||
echo ":::"
|
echo ":::"
|
||||||
# Nate 3/28/2016 - Removed `php5-cgi` and `php5` as they are removed with php5-common
|
# 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
|
for i in "${dependencies[@]}"; do
|
||||||
if [ "$(dpkg-query -W --showformat='${Status}\n' "$i" 2> /dev/null | grep -c "ok installed")" -eq 1 ]; then
|
if [ "$(dpkg-query -W --showformat='${Status}\n' "$i" 2> /dev/null | grep -c "ok installed")" -eq 1 ]; then
|
||||||
while true; do
|
while true; do
|
||||||
@@ -122,8 +122,9 @@ function removeNoPurge {
|
|||||||
$SUDO rm -rf /etc/.pihole/ &> /dev/null
|
$SUDO rm -rf /etc/.pihole/ &> /dev/null
|
||||||
$SUDO rm -rf /opt/pihole/ &> /dev/null
|
$SUDO rm -rf /opt/pihole/ &> /dev/null
|
||||||
$SUDO rm /usr/local/bin/pihole &> /dev/null
|
$SUDO rm /usr/local/bin/pihole &> /dev/null
|
||||||
$SUDO rm /etc/bash_completion.d/pihole
|
$SUDO rm /etc/bash_completion.d/pihole &> /dev/null
|
||||||
|
$SUDO rm /etc/sudoers.d/pihole &> /dev/null
|
||||||
|
|
||||||
echo ":::"
|
echo ":::"
|
||||||
printf "::: Finished removing PiHole from your system. Sorry to see you go!\n"
|
printf "::: Finished removing PiHole from your system. Sorry to see you go!\n"
|
||||||
printf "::: Reach out to us at https://github.com/pi-hole/pi-hole/issues if you need help\n"
|
printf "::: Reach out to us at https://github.com/pi-hole/pi-hole/issues if you need help\n"
|
||||||
|
@@ -27,7 +27,7 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
piholeIPfile=/tmp/piholeIP
|
piholeIPfile=/etc/pihole/piholeIP
|
||||||
piholeIPv6file=/etc/pihole/.useIPv6
|
piholeIPv6file=/etc/pihole/.useIPv6
|
||||||
|
|
||||||
adListFile=/etc/pihole/adlists.list
|
adListFile=/etc/pihole/adlists.list
|
||||||
@@ -38,7 +38,7 @@ blacklistScript=/opt/pihole/blacklist.sh
|
|||||||
if [[ -f $piholeIPfile ]];then
|
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
|
# 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)
|
piholeIP=$(cat $piholeIPfile)
|
||||||
rm $piholeIPfile
|
#rm $piholeIPfile
|
||||||
else
|
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
|
# 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)}')
|
IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}')
|
||||||
@@ -320,7 +320,7 @@ function gravity_reload() {
|
|||||||
|
|
||||||
if [[ $dnsmasqPid ]]; then
|
if [[ $dnsmasqPid ]]; then
|
||||||
# service already running - reload config
|
# service already running - reload config
|
||||||
$SUDO kill -HUP "$dnsmasqPid"
|
$SUDO killall -s HUP dnsmasq
|
||||||
else
|
else
|
||||||
# service not running, start it up
|
# service not running, start it up
|
||||||
$SUDO service dnsmasq start
|
$SUDO service dnsmasq start
|
||||||
|
Reference in New Issue
Block a user