Resolve merge confict
This commit is contained in:
14
README.md
14
README.md
@@ -1,4 +1,6 @@
|
|||||||
# Automated Install
|
# Automated Install
|
||||||
|
#### Designed For Raspberry Pi B, B+, 2,
|
||||||
|
##### and Zero (with an Ethernet adapter)
|
||||||
|
|
||||||
1. Install Raspbian
|
1. Install Raspbian
|
||||||
2. Run the command below
|
2. Run the command below
|
||||||
@@ -11,12 +13,10 @@ Once installed, **configure any device to use the Raspberry Pi as its DNS server
|
|||||||
|
|
||||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY "Donate")
|
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY "Donate")
|
||||||
|
|
||||||
# Raspberry Pi Ad Blocker
|
# How Does It Work?
|
||||||
**A black hole for ads, hence Pi-hole**
|
**Watch the 60-second video below to get a quick overview**
|
||||||
|
|
||||||

|
[](https://vimeo.com/135965232)
|
||||||
|
|
||||||
The Pi-hole is a DNS/Web server that will **block ads for any device on your network**.
|
|
||||||
|
|
||||||
## Coverage
|
## Coverage
|
||||||
|
|
||||||
@@ -49,11 +49,11 @@ The [Web interface](https://github.com/jacobsalmela/AdminLTE#pi-hole-admin-dashb
|
|||||||
If you want to use your own variables for the gravity script (i.e. storing the files in a different location) and don't want to have to change them every time there is an update to the script, create a file called `/etc/pihole/pihole.conf`. In it, you should add your own variables in a similar fashion as shown below:
|
If you want to use your own variables for the gravity script (i.e. storing the files in a different location) and don't want to have to change them every time there is an update to the script, create a file called `/etc/pihole/pihole.conf`. In it, you should add your own variables in a similar fashion as shown below:
|
||||||
|
|
||||||
```
|
```
|
||||||
origin=/var/run/pihole
|
piholeDir=/var/run/pihole
|
||||||
adList=/etc/dnsmasq.d/adList
|
adList=/etc/dnsmasq.d/adList
|
||||||
```
|
```
|
||||||
|
|
||||||
See [this PR](https://github.com/jacobsalmela/pi-hole/pull/20) for more details.
|
See the [Wiki](https://github.com/jacobsalmela/pi-hole/wiki/Customization) entry for more details.
|
||||||
|
|
||||||
### How It Works
|
### How It Works
|
||||||
A technical and detailed description can be found [here](http://jacobsalmela.com/block-millions-ads-network-wide-with-a-raspberry-pi-hole-2-0)!
|
A technical and detailed description can be found [here](http://jacobsalmela.com/block-millions-ads-network-wide-with-a-raspberry-pi-hole-2-0)!
|
||||||
|
@@ -26,7 +26,7 @@ server=8.8.4.4
|
|||||||
# If you want dnsmasq to listen for DHCP and DNS requests only on
|
# If you want dnsmasq to listen for DHCP and DNS requests only on
|
||||||
# specified interfaces (and the loopback) give the name of the
|
# specified interfaces (and the loopback) give the name of the
|
||||||
# interface (eg eth0) here.
|
# interface (eg eth0) here.
|
||||||
interface=eth0
|
interface=@INT@
|
||||||
# Or which to listen on by address (remember to include 127.0.0.1 if
|
# Or which to listen on by address (remember to include 127.0.0.1 if
|
||||||
# you use this.)
|
# you use this.)
|
||||||
listen-address=127.0.0.1
|
listen-address=127.0.0.1
|
||||||
@@ -45,3 +45,6 @@ log-facility=/var/log/pihole.log
|
|||||||
# server for potentially stale date, you can set a time-to-live (in
|
# server for potentially stale date, you can set a time-to-live (in
|
||||||
# seconds) here.
|
# seconds) here.
|
||||||
local-ttl=300
|
local-ttl=300
|
||||||
|
|
||||||
|
# This allows it to continue functioning without being blocked by syslog, and allows syslog to use dnsmasq for DNS queries without risking deadlock
|
||||||
|
log-async
|
||||||
|
@@ -32,16 +32,15 @@ r=$(( rows / 2 ))
|
|||||||
c=$(( columns / 2 ))
|
c=$(( columns / 2 ))
|
||||||
|
|
||||||
# Find IP used to route to outside world
|
# Find IP used to route to outside world
|
||||||
IPv4info=$(ip route get 8.8.8.8)
|
IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}')
|
||||||
IPv4dev=$(echo $IPv4info| awk '{print $5}')
|
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}')
|
IPv4gw=$(ip route get 8.8.8.8 | awk '{print $3}')
|
||||||
IPv4gw=$(echo $IPv4info | awk '{print $3}')
|
|
||||||
|
|
||||||
# IPv6 support to be added later
|
# IPv6 support to be added later
|
||||||
#IPv6eui64=$(ip addr show | awk '/scope\ global/ && /ff:fe/ {print $2}' | cut -d'/' -f1)
|
#IPv6eui64=$(ip addr show | awk '/scope\ global/ && /ff:fe/ {print $2}' | cut -d'/' -f1)
|
||||||
#IPv6linkLocal=$(ip addr show | awk '/inet/ && /scope\ link/ && /fe80/ {print $2}' | cut -d'/' -f1)
|
#IPv6linkLocal=$(ip addr show | awk '/inet/ && /scope\ link/ && /fe80/ {print $2}' | cut -d'/' -f1)
|
||||||
|
|
||||||
availableInterfaces=$(ip link show | awk -F' ' '/[0-9]: [a-z]/ {print $2}' | grep -v "lo" | cut -d':' -f1)
|
availableInterfaces=$(ip -o link | awk '{print $2}' | grep -v "lo" | cut -d':' -f1)
|
||||||
dhcpcdFile=/etc/dhcpcd.conf
|
dhcpcdFile=/etc/dhcpcd.conf
|
||||||
|
|
||||||
####### FUCNTIONS ##########
|
####### FUCNTIONS ##########
|
||||||
@@ -89,6 +88,7 @@ for desiredInterface in $chooseInterfaceOptions
|
|||||||
do
|
do
|
||||||
piholeInterface=$desiredInterface
|
piholeInterface=$desiredInterface
|
||||||
echo "Using interface: $piholeInterface"
|
echo "Using interface: $piholeInterface"
|
||||||
|
echo ${piholeInterface} > /tmp/piholeINT
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +99,6 @@ cmd=(whiptail --separate-output --checklist "Select Protocols" $r $c 2)
|
|||||||
options=(IPv4 "Block ads over IPv4" on
|
options=(IPv4 "Block ads over IPv4" on
|
||||||
IPv6 "Block ads over IPv4" off)
|
IPv6 "Block ads over IPv4" off)
|
||||||
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
|
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
|
||||||
clear
|
|
||||||
for choice in $choices
|
for choice in $choices
|
||||||
do
|
do
|
||||||
case $choice in
|
case $choice in
|
||||||
@@ -179,17 +178,28 @@ done
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setDHCPCD(){
|
||||||
setStaticIPv4()
|
# Append these lines to dhcpcd.conf to enable a static IP
|
||||||
{
|
|
||||||
# Append these lines to /etc/dhcpcd.conf to enable a static IP
|
|
||||||
echo "interface $piholeInterface
|
echo "interface $piholeInterface
|
||||||
static ip_address=$IPv4addr
|
static ip_address=$IPv4addr
|
||||||
static routers=$IPv4gw
|
static routers=$IPv4gw
|
||||||
static domain_name_servers=$IPv4gw" | sudo tee -a $dhcpcdFile >/dev/null
|
static domain_name_servers=$IPv4gw" | sudo tee -a $dhcpcdFile >/dev/null
|
||||||
sudo ip addr replace dev $piholeInterface $IPv4addr
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
setStaticIPv4(){
|
||||||
|
if grep -q $IPv4addr $dhcpcdFile; then
|
||||||
|
# address already set, noop
|
||||||
|
:
|
||||||
|
else
|
||||||
|
setDHCPCD
|
||||||
|
sudo ip addr replace dev $piholeInterface $IPv4addr
|
||||||
|
echo "Setting IP to $IPv4addr. You may need to restart after the install is complete."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
>>>>>>> b261e046bb6a8a2c7f2301ff6a9d37aa70e898fd
|
||||||
installScripts(){
|
installScripts(){
|
||||||
sudo curl -o /usr/local/bin/gravity.sh https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/gravity.sh
|
sudo curl -o /usr/local/bin/gravity.sh https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/gravity.sh
|
||||||
sudo curl -o /usr/local/bin/chronometer.sh https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/Scripts/chronometer.sh
|
sudo curl -o /usr/local/bin/chronometer.sh https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/Scripts/chronometer.sh
|
||||||
@@ -203,6 +213,10 @@ sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
|
|||||||
sudo mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig
|
sudo mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig
|
||||||
sudo curl -o /etc/dnsmasq.conf https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/dnsmasq.conf
|
sudo curl -o /etc/dnsmasq.conf https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/dnsmasq.conf
|
||||||
sudo curl -o /etc/lighttpd/lighttpd.conf https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/lighttpd.conf
|
sudo curl -o /etc/lighttpd/lighttpd.conf https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/lighttpd.conf
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
sudo sed -i "s/@INT@/$piholeInterface/" /etc/dnsmasq.conf
|
||||||
|
>>>>>>> b261e046bb6a8a2c7f2301ff6a9d37aa70e898fd
|
||||||
}
|
}
|
||||||
|
|
||||||
stopServices(){
|
stopServices(){
|
||||||
@@ -236,11 +250,6 @@ sudo mv /etc/crontab /etc/crontab.orig
|
|||||||
sudo curl -o /etc/crontab https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/pihole.cron
|
sudo curl -o /etc/crontab https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/pihole.cron
|
||||||
}
|
}
|
||||||
|
|
||||||
installPiLog(){
|
|
||||||
sudo touch /var/log/pihole.log
|
|
||||||
sudo chmod 644 /var/log/pihole.log
|
|
||||||
sudo chown dnsmasq:root /var/log/pihole.log
|
|
||||||
}
|
|
||||||
installPihole()
|
installPihole()
|
||||||
{
|
{
|
||||||
installDependencies
|
installDependencies
|
||||||
@@ -254,7 +263,6 @@ installConfigs
|
|||||||
installWebAdmin
|
installWebAdmin
|
||||||
installPiholeWeb
|
installPiholeWeb
|
||||||
installCron
|
installCron
|
||||||
installPiLog
|
|
||||||
sudo /usr/local/bin/gravity.sh
|
sudo /usr/local/bin/gravity.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
gravity.sh
10
gravity.sh
@@ -17,8 +17,8 @@ if [[ -f $piholeIPfile ]];then
|
|||||||
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 '{print $5}')
|
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}')
|
piholeIPCIDR=$(ip -o -f inet addr show dev $IPv4dev | awk '{print $4}' | awk 'END {print}')
|
||||||
piholeIP=${piholeIPCIDR%/*}
|
piholeIP=${piholeIPCIDR%/*}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ function gravity_pulsar() {
|
|||||||
# regexp so it can be parsed out with grep -x
|
# regexp so it can be parsed out with grep -x
|
||||||
awk -F '[# \t]' 'NF>0&&$1!="" {print "^"$1"$"}' $whitelist | sed 's/\./\\./g' > $latentWhitelist
|
awk -F '[# \t]' 'NF>0&&$1!="" {print "^"$1"$"}' $whitelist | sed 's/\./\\./g' > $latentWhitelist
|
||||||
else
|
else
|
||||||
rm $latentWhitelist
|
rm $latentWhitelist >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Prevent our sources from being pulled into the hole
|
# Prevent our sources from being pulled into the hole
|
||||||
@@ -240,13 +240,13 @@ function gravity_advanced() {
|
|||||||
|
|
||||||
gravity_unique
|
gravity_unique
|
||||||
|
|
||||||
sudo kill -HUP $(pidof dnsmasq)
|
sudo kill -s -HUP $(pidof dnsmasq)
|
||||||
}
|
}
|
||||||
|
|
||||||
gravity_collapse
|
gravity_collapse
|
||||||
gravity_spinup
|
gravity_spinup
|
||||||
gravity_Schwarzchild
|
gravity_Schwarzchild
|
||||||
gravity_pulsar
|
gravity_pulsar
|
||||||
gravity_hostFormat
|
|
||||||
gravity_advanced
|
gravity_advanced
|
||||||
|
gravity_hostFormat
|
||||||
gravity_blackbody
|
gravity_blackbody
|
||||||
|
Reference in New Issue
Block a user