diff --git a/adlists.default b/adlists.default index bf7197e6..02d9b92c 100644 --- a/adlists.default +++ b/adlists.default @@ -32,7 +32,7 @@ http://hosts-file.net/ad_servers.txt #http://optimate.dl.sourceforge.net/project/adzhosts/HOSTS.txt # Windows 10 telemetry list -#https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/hosts/windows10_spy.txt +#https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/win10/spy.txt # Securemecca.com list - Also blocks "adult" sites (pornography/gambling etc) #http://securemecca.com/Downloads/hosts.txt diff --git a/advanced/Scripts/blacklist.sh b/advanced/Scripts/blacklist.sh index e28188eb..7e99f830 100755 --- a/advanced/Scripts/blacklist.sh +++ b/advanced/Scripts/blacklist.sh @@ -25,6 +25,22 @@ else 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 helpFunc fi @@ -70,27 +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) }') 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 - helpFunc -fi - function HandleOther(){ #check validity of domain validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/') diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index b927615e..37b4ade4 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -25,6 +25,22 @@ else 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 helpFunc fi @@ -69,27 +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) }') 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 - helpFunc -fi - function HandleOther(){ #check validity of domain validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/') diff --git a/advanced/pihole.sudo b/advanced/pihole.sudo new file mode 100644 index 00000000..ef06249a --- /dev/null +++ b/advanced/pihole.sudo @@ -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 diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 8db92fd4..699f68ee 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -58,7 +58,7 @@ else if [[ $(dpkg-query -s sudo) ]];then export SUDO="sudo" 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 fi fi @@ -110,7 +110,7 @@ welcomeDialogs() { # 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. - + In the next section, you can choose to use your current network settings (DHCP) or to manually edit them." $r $c } @@ -548,7 +548,7 @@ checkForDependencies() { echo ":::" echo "::: Checking dependencies:" - dependencies=( dnsutils bc 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 echo -n "::: Checking for $i..." if [ "$(dpkg-query -W -f='${Status}' "$i" 2>/dev/null | grep -c "ok installed")" -eq 0 ]; then @@ -638,6 +638,12 @@ installPiholeWeb() { $SUDO cp /etc/.pihole/advanced/index.* /var/www/html/pihole/. $SUDO echo " done!" 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() { @@ -698,12 +704,13 @@ displayFinalMessage() { # 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: -IPv4: $IPv4addr +IPv4: ${IPv4addr%/*} IPv6: $piholeIPv6 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 ############ @@ -740,10 +747,10 @@ echo " done." echo ":::" echo "::: Installation Complete! Configure your devices to use the Pi-hole as their DNS server using:" -echo "::: $IPv4addr" +echo "::: ${IPv4addr%/*}" echo "::: $piholeIPv6" echo ":::" 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 "::: View the web interface at http://pi.hole/admin or http://${IPv4addr%/*}/admin" diff --git a/automated install/uninstall.sh b/automated install/uninstall.sh index 2d32b52d..83168d6a 100755 --- a/automated install/uninstall.sh +++ b/automated install/uninstall.sh @@ -122,8 +122,9 @@ function removeNoPurge { $SUDO rm -rf /etc/.pihole/ &> /dev/null $SUDO rm -rf /opt/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 ":::" 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"