From 2335097c99432d874899426444f106cc2832f1e6 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 21 Dec 2016 22:20:23 -0800 Subject: [PATCH 01/45] Find which packages already exist and only install new packages. Set up for unintall to know what packages we installed for later removal. Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 3dacdfff..eb897319 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -97,8 +97,9 @@ if [[ $(command -v apt-get) ]]; then LIGHTTPD_CFG="lighttpd.conf.debian" DNSMASQ_USER="dnsmasq" - package_check_install() { - dpkg-query -W -f='${Status}' "${1}" 2>/dev/null | grep -c "ok installed" || ${PKG_INSTALL} "${1}" + package_check() { + dpkg-query -W -f='${Status}' "${1}" 2>/dev/null | grep "ok installed" + return } elif [ $(command -v rpm) ]; then # Fedora Family @@ -738,15 +739,24 @@ install_dependent_packages() { # Install packages passed in via argument array # No spinner - conflicts with set -e declare -a argArray1=("${!1}") + declare -a installArray + # Debian based package install - debconf will download the entire package list + # so we just create an array of packages not currently installed to cut down on the + # amount of download traffic. + # NOTE: We may be able to use this installArray in the future to create a list of package that were + # installed by us, and remove only the installed packages, and not the entire list. if command -v debconf-apt-progress &> /dev/null; then - debconf-apt-progress -- ${PKG_INSTALL} "${argArray1[@]}" - else for i in "${argArray1[@]}"; do echo -n "::: Checking for $i..." - package_check_install "${i}" &> /dev/null - echo " installed!" + if package_check "${i}" &> /dev/null; then + echo " installed!" + else + echo " added to install list!" + installArray+=("${i}") + fi done + debconf-apt-progress -- ${PKG_INSTALL} "${installArray[@]}" fi } From 07a4f970d4abb3b7378d4f797695ab2efd079bee Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 21 Dec 2016 22:57:42 -0800 Subject: [PATCH 02/45] Check for installation status within the parent function. Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index eb897319..d47034c2 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -97,10 +97,6 @@ if [[ $(command -v apt-get) ]]; then LIGHTTPD_CFG="lighttpd.conf.debian" DNSMASQ_USER="dnsmasq" - package_check() { - dpkg-query -W -f='${Status}' "${1}" 2>/dev/null | grep "ok installed" - return - } elif [ $(command -v rpm) ]; then # Fedora Family if [ $(command -v dnf) ]; then @@ -116,8 +112,7 @@ elif [ $(command -v rpm) ]; then PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq epel-release findutils lighttpd lighttpd-fastcgi nmap-ncat php php-common php-cli sudo unzip wget) if grep -q 'Fedora' /etc/redhat-release; then - remove_deps=(epel-release); - PIHOLE_DEPS=( ${PIHOLE_DEPS[@]/$remove_deps} ); + PIHOLE_DEPS=(${PIHOLE_DEPS#epel-release}); fi LIGHTTPD_USER="lighttpd" LIGHTTPD_GROUP="lighttpd" @@ -749,7 +744,7 @@ install_dependent_packages() { if command -v debconf-apt-progress &> /dev/null; then for i in "${argArray1[@]}"; do echo -n "::: Checking for $i..." - if package_check "${i}" &> /dev/null; then + if dpkg-query -W -f='${Status}' "${i}" 2>/dev/null | grep "ok installed" &> /dev/null; then echo " installed!" else echo " added to install list!" From fb5578c0d41c5668e28009138f811db335f1cf54 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 21 Dec 2016 23:38:31 -0800 Subject: [PATCH 03/45] Fedora dependency installer overhaul Signed-off-by: Dan Schaper Modify Fedora dependency installer Signed-off-by: Dan Schaper Fedora now installs and arrays only non-installed packages. Fedora also noops the cache update, since it updates at every dnf call anyays. Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 33 +++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index d47034c2..8f58fa7b 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -105,23 +105,22 @@ elif [ $(command -v rpm) ]; then PKG_MANAGER="yum" fi PKG_CACHE="/var/cache/${PKG_MANAGER}" - UPDATE_PKG_CACHE="${PKG_MANAGER} check-update" + #Every yum/dnf call will autmomatically update the cache. No-op here, cach updates when + #We get available package count. + #Also a bare `dnf check-update will return 100 as a retval, blows up set -e + UPDATE_PKG_CACHE=":" PKG_INSTALL="${PKG_MANAGER} install -y" PKG_COUNT="${PKG_MANAGER} check-update | egrep '(.i686|.x86|.noarch|.arm|.src)' | wc -l" INSTALLER_DEPS=(git iproute net-tools newt procps-ng) - PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq epel-release findutils lighttpd lighttpd-fastcgi nmap-ncat php php-common php-cli sudo unzip wget) + PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq findutils lighttpd lighttpd-fastcgi nmap-ncat php php-common php-cli sudo unzip wget) - if grep -q 'Fedora' /etc/redhat-release; then - PIHOLE_DEPS=(${PIHOLE_DEPS#epel-release}); + if ! grep -q 'Fedora' /etc/redhat-release; then + PIHOLE_DEPS=("${PIHOLE_DEPS[@]}" "epel-release"); fi LIGHTTPD_USER="lighttpd" LIGHTTPD_GROUP="lighttpd" LIGHTTPD_CFG="lighttpd.conf.fedora" DNSMASQ_USER="nobody" - - package_check_install() { - rpm -qa | grep ^"${1}"- > /dev/null || ${PKG_INSTALL} "${1}" - } else echo "OS distribution not supported" exit @@ -708,7 +707,7 @@ update_pacakge_cache() { #update package lists echo ":::" echo -n "::: ${PKG_MANAGER} update has not been run today. Running now..." - ${UPDATE_PKG_CACHE} &> /dev/null + ${UPDATE_PKG_CACHE} echo " done!" fi } @@ -751,8 +750,22 @@ install_dependent_packages() { installArray+=("${i}") fi done - debconf-apt-progress -- ${PKG_INSTALL} "${installArray[@]}" + debconf-apt-progress -- ${PKG_INSTALL} "${installArray[@]}" + return 0 fi + + #Fedora + for i in "${argArray1[@]}"; do + echo -n "::: Checking for $i..." + if dnf -q list installed "${i}" &> /dev/null; then + echo " installed!" + else + echo " added to install list!" + installArray+=("${i}") + fi + done + ${PKG_INSTALL} "${installArray[@]}" + return 0 } CreateLogFile() { From 9073f34b30a7b119e91a188a6058371ee25a0bb6 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 22 Dec 2016 00:44:10 -0800 Subject: [PATCH 04/45] Quiet DNF Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 8f58fa7b..e5cf3f81 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -764,7 +764,7 @@ install_dependent_packages() { installArray+=("${i}") fi done - ${PKG_INSTALL} "${installArray[@]}" + ${PKG_INSTALL} "${installArray[@]}" &> /dev/null return 0 } From ab7d193f9881cf4e18e73177c7fe70e4ed5a88b1 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 22 Dec 2016 03:21:37 -0800 Subject: [PATCH 05/45] Still causing problems with Fedora and CentOS Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index e5cf3f81..4da72c62 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -754,10 +754,10 @@ install_dependent_packages() { return 0 fi - #Fedora + #Fedora/CentOS for i in "${argArray1[@]}"; do echo -n "::: Checking for $i..." - if dnf -q list installed "${i}" &> /dev/null; then + if ${PKG_MANAGER} -q list installed "${i}" &> /dev/null; then echo " installed!" else echo " added to install list!" @@ -938,7 +938,7 @@ configureSelinux() { if [ -x "$(command -v getenforce)" ]; then printf "\n::: SELinux Detected\n" printf ":::\tChecking for SELinux policy development packages..." - package_check_install "selinux-policy-devel" > /dev/null + install_dependent_packages "selinux-policy-devel" > /dev/null echo " installed!" printf ":::\tEnabling httpd server side includes (SSI).. " setsebool -P httpd_ssi_exec on &> /dev/null && echo "Success" || echo "SELinux not enabled" @@ -1140,4 +1140,4 @@ main() { if [[ "${PH_TEST}" != true ]] ; then main "$@" -fi +fi \ No newline at end of file From 2919f852adf320ab3a20991a1dbaa02c62d59c2c Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Fri, 23 Dec 2016 16:30:26 -0800 Subject: [PATCH 06/45] Import `checkSelinux` from master Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 9379a5c2..659fa08f 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -952,17 +952,22 @@ updatePihole() { runGravity } -configureSelinux() { +checkSelinux() { if [ -x "$(command -v getenforce)" ]; then - printf "\n::: SELinux Detected\n" - printf ":::\tChecking for SELinux policy development packages..." - package_check_install "selinux-policy-devel" > /dev/null - echo " installed!" - printf ":::\tEnabling httpd server side includes (SSI).. " - setsebool -P httpd_ssi_exec on &> /dev/null && echo "Success" || echo "SELinux not enabled" - printf "\n:::\tCompiling Pi-Hole SELinux policy..\n" - if ! [ -x "$(command -v systemctl)" ]; then - sed -i.bak '/systemd/d' /etc/.pihole/advanced/selinux/pihole.te + echo ":::" + echo -n "::: SELinux Support Detected... Mode: " + enforceMode=$(getenforce) + echo "${enforceMode}" + if [[ "${enforceMode}" == "Enforcing" ]]; then + if (whiptail --title "SELinux Enforcing Detected" --yesno "SELinux is being Enforced on your system!\n\nPi-hole currently does not support SELinux, but you may still continue with the installation.\n\nNote: Admin UI Will not function fully without setting your policies correctly\n\nContinue installing Pi-hole?" ${r} ${c}); then + echo ":::" + echo "::: Continuing installation with SELinux Enforcing." + echo "::: Please refer to official SELinux documentation to create a custom policy." + else + echo ":::" + echo "::: Not continuing install after SELinux Enforcing detected." + exit 1 + fi fi fi } From d5ed6c190108aac70108dae9e388fc6b343d3edf Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 21 Dec 2016 22:20:23 -0800 Subject: [PATCH 07/45] Find which packages already exist and only install new packages. Set up for unintall to know what packages we installed for later removal. Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 0a56b06e..9e6383ee 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -97,8 +97,9 @@ if [[ $(command -v apt-get) ]]; then LIGHTTPD_CFG="lighttpd.conf.debian" DNSMASQ_USER="dnsmasq" - package_check_install() { - dpkg-query -W -f='${Status}' "${1}" 2>/dev/null | grep -c "ok installed" || ${PKG_INSTALL} "${1}" + package_check() { + dpkg-query -W -f='${Status}' "${1}" 2>/dev/null | grep "ok installed" + return } elif [ $(command -v rpm) ]; then # Fedora Family @@ -745,15 +746,24 @@ install_dependent_packages() { # Install packages passed in via argument array # No spinner - conflicts with set -e declare -a argArray1=("${!1}") + declare -a installArray + # Debian based package install - debconf will download the entire package list + # so we just create an array of packages not currently installed to cut down on the + # amount of download traffic. + # NOTE: We may be able to use this installArray in the future to create a list of package that were + # installed by us, and remove only the installed packages, and not the entire list. if command -v debconf-apt-progress &> /dev/null; then - debconf-apt-progress -- ${PKG_INSTALL} "${argArray1[@]}" - else for i in "${argArray1[@]}"; do echo -n "::: Checking for $i..." - package_check_install "${i}" &> /dev/null - echo " installed!" + if package_check "${i}" &> /dev/null; then + echo " installed!" + else + echo " added to install list!" + installArray+=("${i}") + fi done + debconf-apt-progress -- ${PKG_INSTALL} "${installArray[@]}" fi } From 852341c601fba5571246f03d7b36de185d7a4c1b Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 21 Dec 2016 22:57:42 -0800 Subject: [PATCH 08/45] Check for installation status within the parent function. Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 9e6383ee..cc7d04dd 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -97,10 +97,6 @@ if [[ $(command -v apt-get) ]]; then LIGHTTPD_CFG="lighttpd.conf.debian" DNSMASQ_USER="dnsmasq" - package_check() { - dpkg-query -W -f='${Status}' "${1}" 2>/dev/null | grep "ok installed" - return - } elif [ $(command -v rpm) ]; then # Fedora Family if [ $(command -v dnf) ]; then @@ -116,8 +112,7 @@ elif [ $(command -v rpm) ]; then PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq epel-release findutils lighttpd lighttpd-fastcgi nmap-ncat php php-common php-cli sudo unzip wget) if grep -q 'Fedora' /etc/redhat-release; then - remove_deps=(epel-release); - PIHOLE_DEPS=( ${PIHOLE_DEPS[@]/$remove_deps} ); + PIHOLE_DEPS=(${PIHOLE_DEPS#epel-release}); fi LIGHTTPD_USER="lighttpd" LIGHTTPD_GROUP="lighttpd" @@ -756,7 +751,7 @@ install_dependent_packages() { if command -v debconf-apt-progress &> /dev/null; then for i in "${argArray1[@]}"; do echo -n "::: Checking for $i..." - if package_check "${i}" &> /dev/null; then + if dpkg-query -W -f='${Status}' "${i}" 2>/dev/null | grep "ok installed" &> /dev/null; then echo " installed!" else echo " added to install list!" From dc22a50dcc8c125befd74e13234175ea77f8f66d Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 21 Dec 2016 23:38:31 -0800 Subject: [PATCH 09/45] Fedora dependency installer overhaul Signed-off-by: Dan Schaper Modify Fedora dependency installer Signed-off-by: Dan Schaper Fedora now installs and arrays only non-installed packages. Fedora also noops the cache update, since it updates at every dnf call anyays. Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 33 +++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index cc7d04dd..0b48b5e7 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -105,23 +105,22 @@ elif [ $(command -v rpm) ]; then PKG_MANAGER="yum" fi PKG_CACHE="/var/cache/${PKG_MANAGER}" - UPDATE_PKG_CACHE="${PKG_MANAGER} check-update" + #Every yum/dnf call will autmomatically update the cache. No-op here, cach updates when + #We get available package count. + #Also a bare `dnf check-update will return 100 as a retval, blows up set -e + UPDATE_PKG_CACHE=":" PKG_INSTALL="${PKG_MANAGER} install -y" PKG_COUNT="${PKG_MANAGER} check-update | egrep '(.i686|.x86|.noarch|.arm|.src)' | wc -l" INSTALLER_DEPS=(git iproute net-tools newt procps-ng) - PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq epel-release findutils lighttpd lighttpd-fastcgi nmap-ncat php php-common php-cli sudo unzip wget) + PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq findutils lighttpd lighttpd-fastcgi nmap-ncat php php-common php-cli sudo unzip wget) - if grep -q 'Fedora' /etc/redhat-release; then - PIHOLE_DEPS=(${PIHOLE_DEPS#epel-release}); + if ! grep -q 'Fedora' /etc/redhat-release; then + PIHOLE_DEPS=("${PIHOLE_DEPS[@]}" "epel-release"); fi LIGHTTPD_USER="lighttpd" LIGHTTPD_GROUP="lighttpd" LIGHTTPD_CFG="lighttpd.conf.fedora" DNSMASQ_USER="nobody" - - package_check_install() { - rpm -qa | grep ^"${1}"- > /dev/null || ${PKG_INSTALL} "${1}" - } else echo "OS distribution not supported" exit @@ -715,7 +714,7 @@ update_pacakge_cache() { #update package lists echo ":::" echo -n "::: ${PKG_MANAGER} update has not been run today. Running now..." - ${UPDATE_PKG_CACHE} &> /dev/null + ${UPDATE_PKG_CACHE} echo " done!" fi } @@ -758,8 +757,22 @@ install_dependent_packages() { installArray+=("${i}") fi done - debconf-apt-progress -- ${PKG_INSTALL} "${installArray[@]}" + debconf-apt-progress -- ${PKG_INSTALL} "${installArray[@]}" + return 0 fi + + #Fedora + for i in "${argArray1[@]}"; do + echo -n "::: Checking for $i..." + if dnf -q list installed "${i}" &> /dev/null; then + echo " installed!" + else + echo " added to install list!" + installArray+=("${i}") + fi + done + ${PKG_INSTALL} "${installArray[@]}" + return 0 } CreateLogFile() { From 8ad52806de14f2d5679caa95cc2d1074d43c42f0 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 22 Dec 2016 00:44:10 -0800 Subject: [PATCH 10/45] Quiet DNF Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 0b48b5e7..675d2302 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -771,7 +771,7 @@ install_dependent_packages() { installArray+=("${i}") fi done - ${PKG_INSTALL} "${installArray[@]}" + ${PKG_INSTALL} "${installArray[@]}" &> /dev/null return 0 } From f458780ba738979dcfeb22417b104a70ea695cda Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 22 Dec 2016 03:21:37 -0800 Subject: [PATCH 11/45] Rebase onto development Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 675d2302..a9b3355a 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -761,10 +761,10 @@ install_dependent_packages() { return 0 fi - #Fedora + #Fedora/CentOS for i in "${argArray1[@]}"; do echo -n "::: Checking for $i..." - if dnf -q list installed "${i}" &> /dev/null; then + if ${PKG_MANAGER} -q list installed "${i}" &> /dev/null; then echo " installed!" else echo " added to install list!" From 7eb612472173e787036ff7efd767baf585ff623d Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 24 Dec 2016 16:52:46 -0800 Subject: [PATCH 12/45] Don't call for package installs if there are no packages to install. Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index a9b3355a..4edec877 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -757,7 +757,10 @@ install_dependent_packages() { installArray+=("${i}") fi done + if [[ ${#installArray[@]} -gt 0 ]]; then debconf-apt-progress -- ${PKG_INSTALL} "${installArray[@]}" + return + fi return 0 fi @@ -771,7 +774,10 @@ install_dependent_packages() { installArray+=("${i}") fi done - ${PKG_INSTALL} "${installArray[@]}" &> /dev/null + if [[ ${#installArray[@]} -gt 0 ]]; then + ${PKG_INSTALL} "${installArray[@]}" &> /dev/null + return + fi return 0 } From 9a9cb6134551bedc327ba4e256220997c9c40798 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Tue, 27 Dec 2016 12:59:53 -0800 Subject: [PATCH 13/45] Shift `epel-release` to installer dependencies for CentOS Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 97cd0d98..0e251575 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -113,7 +113,7 @@ elif [ $(command -v rpm) ]; then PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq findutils lighttpd lighttpd-fastcgi nmap-ncat php php-common php-cli sudo unzip wget) if ! grep -q 'Fedora' /etc/redhat-release; then - PIHOLE_DEPS=("${PIHOLE_DEPS[@]}" "epel-release"); + INSTALLER_DEPS=("${INSTALLER_DEPS[@]}" "epel-release"); fi LIGHTTPD_USER="lighttpd" LIGHTTPD_GROUP="lighttpd" From 9af26cbaacbe55fd4b058e5f286e4f051610ba46 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 28 Dec 2016 02:14:47 +0000 Subject: [PATCH 14/45] Major simplification of webpage.sh --- advanced/Scripts/webpage.sh | 225 +++++++++++++++++++++--------------- 1 file changed, 129 insertions(+), 96 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index d87def14..ddc8859e 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -11,6 +11,10 @@ args=("$@") +readonly setupVars="/etc/pihole/setupVars.conf" +readonly dnsmasqconfig="/etc/dnsmasq.d/01-pihole.conf" +readonly dhcpconfig="/etc/dnsmasq.d/02-pihole-dhcp.conf" + helpFunc() { cat << EOM ::: Set admin options for the web interface of pihole @@ -27,12 +31,34 @@ EOM exit 0 } +add_setting() { + echo "${1}=${2}" >> "${setupVars}" +} + +delete_setting() { + sed -i "/${1}/d" "${setupVars}" +} + +change_setting() { + delete_setting "${1}" + add_setting "${1}" "${2}" +} + +add_dnsmasq_setting() { + if [[ "${2}" != "" ]]; then + echo "${1}=${2}" >> "${dnsmasqconfig}" + else + echo "${1}" >> "${dnsmasqconfig}" + fi +} + +delete_dnsmasq_setting() { + sed -i "/${1}/d" "${dnsmasqconfig}" +} + SetTemperatureUnit(){ - # Remove setting from file (create backup setupVars.conf.bak) - sed -i.bak '/TEMPERATUREUNIT/d' /etc/pihole/setupVars.conf - # Save setting to file - echo "TEMPERATUREUNIT=${unit}" >> /etc/pihole/setupVars.conf + change_setting "TEMPERATUREUNIT" "${unit}" } @@ -50,66 +76,70 @@ SetWebPassword(){ exit 1 fi - # Remove password from file (create backup setupVars.conf.bak) - sed -i.bak '/WEBPASSWORD/d' /etc/pihole/setupVars.conf # Set password only if there is one to be set if (( ${#args[2]} > 0 )) ; then # Compute password hash twice to avoid rainbow table vulnerability hash=$(echo -n ${args[2]} | sha256sum | sed 's/\s.*$//') hash=$(echo -n ${hash} | sha256sum | sed 's/\s.*$//') # Save hash to file - echo "WEBPASSWORD=${hash}" >> /etc/pihole/setupVars.conf + change_setting "WEBPASSWORD" "${hash}" echo "New password set" else - echo "WEBPASSWORD=" >> /etc/pihole/setupVars.conf + change_setting "WEBPASSWORD" "" echo "Password removed" fi } +ProcessDNSSettings() { + source "${setupVars}" + + delete_dnsmasq_setting "server=" + add_dnsmasq_setting "server" "${PIHOLE_DNS_1}" + + if [[ "${PIHOLE_DNS_2}" != "" ]]; then + add_dnsmasq_setting "server" "${PIHOLE_DNS_2}" + fi + + delete_dnsmasq_setting "domain-needed" + + if [[ "${DNS_FQDN_REQUIRED}" == true ]]; then + add_dnsmasq_setting "domain-needed" + fi + + delete_dnsmasq_setting "bogus-priv" + + if [[ "${DNS_BOGUS_PRIV}" == true ]]; then + add_dnsmasq_setting "bogus-priv" + fi + +} + SetDNSServers(){ - # Remove setting from file (create backup setupVars.conf.bak) - sed -i.bak '/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;/DNS_FQDN_REQUIRED/d;/DNS_BOGUS_PRIV/d;' /etc/pihole/setupVars.conf # Save setting to file - echo "PIHOLE_DNS_1=${args[2]}" >> /etc/pihole/setupVars.conf + change_setting "PIHOLE_DNS_1" "${args[2]}" + if [[ "${args[3]}" != "none" ]]; then - echo "PIHOLE_DNS_2=${args[3]}" >> /etc/pihole/setupVars.conf + change_setting "PIHOLE_DNS_2" "${args[3]}" else - echo "PIHOLE_DNS_2=" >> /etc/pihole/setupVars.conf + change_setting "PIHOLE_DNS_2" "" fi - # Replace within actual dnsmasq config file - sed -i '/server=/d;' /etc/dnsmasq.d/01-pihole.conf - echo "server=${args[2]}" >> /etc/dnsmasq.d/01-pihole.conf - if [[ "${args[3]}" != "none" ]]; then - echo "server=${args[3]}" >> /etc/dnsmasq.d/01-pihole.conf - fi - - # Remove domain-needed entry - sed -i '/domain-needed/d;' /etc/dnsmasq.d/01-pihole.conf - - # Readd it if required if [[ "${args[4]}" == "domain-needed" ]]; then - echo "domain-needed" >> /etc/dnsmasq.d/01-pihole.conf - echo "DNS_FQDN_REQUIRED=true" >> /etc/pihole/setupVars.conf + change_setting "DNS_FQDN_REQUIRED" "true" else - # Leave it deleted if not wanted - echo "DNS_FQDN_REQUIRED=false" >> /etc/pihole/setupVars.conf + change_setting "DNS_FQDN_REQUIRED" "false" fi - # Remove bogus-priv entry - sed -i '/bogus-priv/d;' /etc/dnsmasq.d/01-pihole.conf - - # Readd it if required - if [[ "${args[5]}" == "bogus-priv" ]]; then - echo "bogus-priv" >> /etc/dnsmasq.d/01-pihole.conf - echo "DNS_BOGUS_PRIV=true" >> /etc/pihole/setupVars.conf + if [[ "${args[4]}" == "bogus-priv" || "${args[5]}" == "bogus-priv" ]]; then + change_setting "DNS_BOGUS_PRIV" "true" else - # Leave it deleted if not wanted - echo "DNS_BOGUS_PRIV=false" >> /etc/pihole/setupVars.conf + change_setting "DNS_BOGUS_PRIV" "false" fi + ProcessDnsmasqSettings + # Restart dnsmasq to load new configuration RestartDNS @@ -117,18 +147,14 @@ SetDNSServers(){ SetExcludeDomains(){ - # Remove setting from file (create backup setupVars.conf.bak) - sed -i.bak '/API_EXCLUDE_DOMAINS/d;' /etc/pihole/setupVars.conf - # Save setting to file - echo "API_EXCLUDE_DOMAINS=${args[2]}" >> /etc/pihole/setupVars.conf + change_setting "API_EXCLUDE_DOMAINS" "${args[2]}" + } SetExcludeClients(){ - # Remove setting from file (create backup setupVars.conf.bak) - sed -i.bak '/API_EXCLUDE_CLIENTS/d;' /etc/pihole/setupVars.conf - # Save setting to file - echo "API_EXCLUDE_CLIENTS=${args[2]}" >> /etc/pihole/setupVars.conf + change_setting "API_EXCLUDE_CLIENTS" "${args[2]}" + } Reboot(){ @@ -149,96 +175,103 @@ RestartDNS(){ SetQueryLogOptions(){ - # Remove setting from file (create backup setupVars.conf.bak) - sed -i.bak '/API_QUERY_LOG_SHOW/d;' /etc/pihole/setupVars.conf - # Save setting to file - echo "API_QUERY_LOG_SHOW=${args[2]}" >> /etc/pihole/setupVars.conf + change_setting "API_QUERY_LOG_SHOW" "${args[2]}" + +} + +ProcessDHCPSettings() { + + source "${setupVars}" + interface=$(grep 'PIHOLE_INTERFACE=' /etc/pihole/setupVars.conf | sed "s/.*=//") + + # Use eth0 as fallback interface + if [ -z ${interface} ]; then + interface="eth0" + fi + + # Write settings to file + echo "############################################################################### +# DHCP SERVER CONFIG FILE AUTOMATICALLY POPULATED BY PI-HOLE WEB INTERFACE. # +# ANY CHANGES MADE TO THIS FILE WILL BE LOST ON CHANGE # +############################################################################### +dhcp-authoritative +dhcp-range=${DHCP_START},${DHCP_END},infinite +dhcp-option=option:router,${DHCP_ROUTER} +dhcp-leasefile=/etc/pihole/dhcp.leases +domain=${PIHOLE_DOMAIN} +quiet-dhcp +quiet-dhcp6 +#enable-ra +dhcp-option=option6:dns-server,[::] +dhcp-range=::100,::1ff,constructor:${interface} +" > "${dhcpconfig}" + } EnableDHCP(){ - # Remove setting from file (create backup setupVars.conf.bak) - sed -i.bak '/DHCP_/d;' /etc/pihole/setupVars.conf - echo "DHCP_ACTIVE=true" >> /etc/pihole/setupVars.conf - echo "DHCP_START=${args[2]}" >> /etc/pihole/setupVars.conf - echo "DHCP_END=${args[3]}" >> /etc/pihole/setupVars.conf - echo "DHCP_ROUTER=${args[4]}" >> /etc/pihole/setupVars.conf + change_setting "DHCP_ACTIVE" "true" + change_setting "DHCP_START" "${args[2]}" + change_setting "DHCP_END" "${args[3]}" + change_setting "DHCP_ROUTER" "${args[4]}" - # Remove setting from file - sed -i '/dhcp-/d;/quiet-dhcp/d;' /etc/dnsmasq.d/01-pihole.conf - # Save setting to file - echo "dhcp-range=${args[2]},${args[3]},infinite" >> /etc/dnsmasq.d/01-pihole.conf - echo "dhcp-option=option:router,${args[4]}" >> /etc/dnsmasq.d/01-pihole.conf - # Changes the behaviour from strict RFC compliance so that DHCP requests on unknown leases from unknown hosts are not ignored. This allows new hosts to get a lease without a tedious timeout under all circumstances. It also allows dnsmasq to rebuild its lease database without each client needing to reacquire a lease, if the database is lost. - echo "dhcp-authoritative" >> /etc/dnsmasq.d/01-pihole.conf - # Use the specified file to store DHCP lease information - echo "dhcp-leasefile=/etc/pihole/dhcp.leases" >> /etc/dnsmasq.d/01-pihole.conf - # Suppress logging of the routine operation of these protocols. Errors and problems will still be logged, though. - echo "quiet-dhcp" >> /etc/dnsmasq.d/01-pihole.conf - echo "quiet-dhcp6" >> /etc/dnsmasq.d/01-pihole.conf + # Remove possible old setting from file + delete_dnsmasq_setting "dhcp-" + delete_dnsmasq_setting "quiet-dhcp" + + ProcessDHCPSettings RestartDNS } DisableDHCP(){ - # Remove setting from file (create backup setupVars.conf.bak) - sed -i.bak '/DHCP_ACTIVE/d;' /etc/pihole/setupVars.conf - echo "DHCP_ACTIVE=false" >> /etc/pihole/setupVars.conf + change_setting "DHCP_ACTIVE" "false" - # Remove setting from file - sed -i '/dhcp-/d;/quiet-dhcp/d;' /etc/dnsmasq.d/01-pihole.conf + # Remove possible old setting from file + delete_dnsmasq_setting "dhcp-" + delete_dnsmasq_setting "quiet-dhcp" + + rm "${dhcpconfig}" RestartDNS } SetWebUILayout(){ - # Remove setting from file (create backup setupVars.conf.bak) - sed -i.bak '/WEBUIBOXEDLAYOUT/d;' /etc/pihole/setupVars.conf - echo "WEBUIBOXEDLAYOUT=${args[2]}" >> /etc/pihole/setupVars.conf + change_setting "WEBUIBOXEDLAYOUT" "${args[2]}" } -SetDNSDomainName(){ +SetDHCPDomainName(){ - # Remove setting from file (create backup setupVars.conf.bak) - sed -i.bak '/PIHOLE_DOMAIN/d;' /etc/pihole/setupVars.conf - # Save setting to file - echo "PIHOLE_DOMAIN=${args[2]}" >> /etc/pihole/setupVars.conf + change_setting "PIHOLE_DOMAIN" "${args[2]}" - # Replace within actual dnsmasq config file - sed -i '/domain=/d;' /etc/dnsmasq.d/01-pihole.conf - echo "domain=${args[2]}" >> /etc/dnsmasq.d/01-pihole.conf + ProcessDHCPSettings - # Restart dnsmasq to load new configuration RestartDNS } SetPrivacyMode(){ - # Remove setting from file (create backup setupVars.conf.bak) - sed -i.bak '/API_PRIVACY_MODE/d' /etc/pihole/setupVars.conf - # Save setting to file if [[ "${args[2]}" == "true" ]] ; then - echo "API_PRIVACY_MODE=true" >> /etc/pihole/setupVars.conf + change_setting "API_PRIVACY_MODE" "true" else - echo "API_PRIVACY_MODE=false" >> /etc/pihole/setupVars.conf + change_setting "API_PRIVACY_MODE" "false" fi + } ResolutionSettings() { - typ=${args[2]} - state=${args[3]} + typ="${args[2]}" + state="${args[3]}" if [[ "${typ}" == "forward" ]]; then - sed -i.bak '/API_GET_UPSTREAM_DNS_HOSTNAME/d;' /etc/pihole/setupVars.conf - echo "API_GET_UPSTREAM_DNS_HOSTNAME=${state}" >> /etc/pihole/setupVars.conf + change_setting "API_GET_UPSTREAM_DNS_HOSTNAME" "${state}" elif [[ "${typ}" == "clients" ]]; then - sed -i.bak '/API_GET_CLIENT_HOSTNAME/d;' /etc/pihole/setupVars.conf - echo "API_GET_CLIENT_HOSTNAME=${state}" >> /etc/pihole/setupVars.conf + change_setting "API_GET_CLIENT_HOSTNAME" "${state}" fi } @@ -257,7 +290,7 @@ case "${args[1]}" in "disabledhcp" ) DisableDHCP;; "layout" ) SetWebUILayout;; "-h" | "--help" ) helpFunc;; - "domainname" ) SetDNSDomainName;; + "domainname" ) SetDHCPDomainName;; "privacymode" ) SetPrivacyMode;; "resolve" ) ResolutionSettings;; * ) helpFunc;; From 1e627c7e8fa9b7f9d0cbb6660235c572dad656c9 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 28 Dec 2016 16:25:14 +0000 Subject: [PATCH 15/45] Make webpage.sh fully library style --- advanced/Scripts/webpage.sh | 55 +++++++++++++++++++------------------ pihole | 3 +- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index ddc8859e..a18a28ce 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -9,8 +9,6 @@ # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. -args=("$@") - readonly setupVars="/etc/pihole/setupVars.conf" readonly dnsmasqconfig="/etc/dnsmasq.d/01-pihole.conf" readonly dhcpconfig="/etc/dnsmasq.d/02-pihole-dhcp.conf" @@ -275,30 +273,35 @@ ResolutionSettings() { fi } -case "${args[1]}" in - "-p" | "password" ) SetWebPassword;; - "-c" | "celsius" ) unit="C"; SetTemperatureUnit;; - "-f" | "fahrenheit" ) unit="F"; SetTemperatureUnit;; - "-k" | "kelvin" ) unit="K"; SetTemperatureUnit;; - "setdns" ) SetDNSServers;; - "setexcludedomains" ) SetExcludeDomains;; - "setexcludeclients" ) SetExcludeClients;; - "reboot" ) Reboot;; - "restartdns" ) RestartDNS;; - "setquerylog" ) SetQueryLogOptions;; - "enabledhcp" ) EnableDHCP;; - "disabledhcp" ) DisableDHCP;; - "layout" ) SetWebUILayout;; - "-h" | "--help" ) helpFunc;; - "domainname" ) SetDHCPDomainName;; - "privacymode" ) SetPrivacyMode;; - "resolve" ) ResolutionSettings;; - * ) helpFunc;; -esac +main() { -shift + args=("$@") -if [[ $# = 0 ]]; then - helpFunc -fi + case "${args[1]}" in + "-p" | "password" ) SetWebPassword;; + "-c" | "celsius" ) unit="C"; SetTemperatureUnit;; + "-f" | "fahrenheit" ) unit="F"; SetTemperatureUnit;; + "-k" | "kelvin" ) unit="K"; SetTemperatureUnit;; + "setdns" ) SetDNSServers;; + "setexcludedomains" ) SetExcludeDomains;; + "setexcludeclients" ) SetExcludeClients;; + "reboot" ) Reboot;; + "restartdns" ) RestartDNS;; + "setquerylog" ) SetQueryLogOptions;; + "enabledhcp" ) EnableDHCP;; + "disabledhcp" ) DisableDHCP;; + "layout" ) SetWebUILayout;; + "-h" | "--help" ) helpFunc;; + "domainname" ) SetDHCPDomainName;; + "privacymode" ) SetPrivacyMode;; + "resolve" ) ResolutionSettings;; + * ) helpFunc;; + esac + shift + + if [[ $# = 0 ]]; then + helpFunc + fi + +} diff --git a/pihole b/pihole index 5a54fae4..f41f7ac5 100755 --- a/pihole +++ b/pihole @@ -23,7 +23,8 @@ if [[ ! $EUID -eq 0 ]];then fi webpageFunc() { - /opt/pihole/webpage.sh "$@" + source /opt/pihole/webpage.sh + main "$@" exit 0 } From 02d658be65e2d68f2accf27a5fb686b4f3020a94 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 28 Dec 2016 16:31:55 +0000 Subject: [PATCH 16/45] Look for DHCP / DNS server settings which would have to be reapplied after updating (since we overwrite 01-pihole.conf) --- automated install/basic-install.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index cef7b7f0..cacc3ca6 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -888,6 +888,17 @@ finalExports() { echo "PIHOLE_DNS_2=${PIHOLE_DNS_2}" echo "QUERY_LOGGING=${QUERY_LOGGING}" }>> "${setupVars}" + + # Look for DHCP / DNS server settings which would have to be reapplied + source "${setupVars}" + source "/etc/.pihole/advanced/Scripts/webpage.sh" + if [[ "${DNS_FQDN_REQUIRED}" != "" ]] ; then + ProcessDNSSettings + fi + + if [[ "${DHCP_ACTIVE}" == "true" ]] ; then + ProcessDHCPSettings + fi } installPihole() { From 03d4fcd17dca1d0b976285c6ffbb3a86a5ffe7ec Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 28 Dec 2016 16:32:24 +0000 Subject: [PATCH 17/45] Don't actually have to reapply DHCP settings since we are going to save it in a different file we don't replace by a template --- automated install/basic-install.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index cacc3ca6..c2c7f8d9 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -889,16 +889,12 @@ finalExports() { echo "QUERY_LOGGING=${QUERY_LOGGING}" }>> "${setupVars}" - # Look for DHCP / DNS server settings which would have to be reapplied + # Look for DNS server settings which would have to be reapplied source "${setupVars}" source "/etc/.pihole/advanced/Scripts/webpage.sh" if [[ "${DNS_FQDN_REQUIRED}" != "" ]] ; then ProcessDNSSettings fi - - if [[ "${DHCP_ACTIVE}" == "true" ]] ; then - ProcessDHCPSettings - fi } installPihole() { From cf724176dc388e2ec6c965f894cb368b87cdec8d Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 28 Dec 2016 20:02:48 +0000 Subject: [PATCH 18/45] Do stateful DHCPv6 and SLAAC --- advanced/Scripts/webpage.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index a18a28ce..a4ebae78 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -201,7 +201,8 @@ quiet-dhcp quiet-dhcp6 #enable-ra dhcp-option=option6:dns-server,[::] -dhcp-range=::100,::1ff,constructor:${interface} +dhcp-range=::100,::1ff,constructor:${interface},ra-names,slaac +ra-param=*,0,0 " > "${dhcpconfig}" } From 3268e1611a65b5410365912e6dadc17cf3531be9 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 29 Dec 2016 14:19:44 +0000 Subject: [PATCH 19/45] Backend accept and apply dhcp lease time --- advanced/Scripts/webpage.sh | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index a4ebae78..b2b4c0d9 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -187,13 +187,19 @@ ProcessDHCPSettings() { interface="eth0" fi + if [[ "${DHCP_LEASETIME}" == "0" ]]; then + leasetime="infinite" + else + leasetime="${DHCP_LEASETIME}h" + fi + # Write settings to file echo "############################################################################### # DHCP SERVER CONFIG FILE AUTOMATICALLY POPULATED BY PI-HOLE WEB INTERFACE. # # ANY CHANGES MADE TO THIS FILE WILL BE LOST ON CHANGE # ############################################################################### dhcp-authoritative -dhcp-range=${DHCP_START},${DHCP_END},infinite +dhcp-range=${DHCP_START},${DHCP_END},${leasetime} dhcp-option=option:router,${DHCP_ROUTER} dhcp-leasefile=/etc/pihole/dhcp.leases domain=${PIHOLE_DOMAIN} @@ -213,6 +219,8 @@ EnableDHCP(){ change_setting "DHCP_START" "${args[2]}" change_setting "DHCP_END" "${args[3]}" change_setting "DHCP_ROUTER" "${args[4]}" + change_setting "DHCP_LEASETIME" "${args[5]}" + change_setting "PIHOLE_DOMAIN" "${args[6]}" # Remove possible old setting from file delete_dnsmasq_setting "dhcp-" @@ -242,16 +250,6 @@ SetWebUILayout(){ } -SetDHCPDomainName(){ - - change_setting "PIHOLE_DOMAIN" "${args[2]}" - - ProcessDHCPSettings - - RestartDNS - -} - SetPrivacyMode(){ if [[ "${args[2]}" == "true" ]] ; then @@ -293,7 +291,6 @@ main() { "disabledhcp" ) DisableDHCP;; "layout" ) SetWebUILayout;; "-h" | "--help" ) helpFunc;; - "domainname" ) SetDHCPDomainName;; "privacymode" ) SetPrivacyMode;; "resolve" ) ResolutionSettings;; * ) helpFunc;; From 9181a4a1d85fb63398df501d294ec6a8f7fd9e32 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 29 Dec 2016 14:26:23 +0000 Subject: [PATCH 20/45] Apply dhcp lease time also for IPv6 --- advanced/Scripts/webpage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index b2b4c0d9..92431cb6 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -207,7 +207,7 @@ quiet-dhcp quiet-dhcp6 #enable-ra dhcp-option=option6:dns-server,[::] -dhcp-range=::100,::1ff,constructor:${interface},ra-names,slaac +dhcp-range=::100,::1ff,constructor:${interface},ra-names,slaac,${leasetime} ra-param=*,0,0 " > "${dhcpconfig}" From 5c7fc05a32b994cc6e313a7811bbabfcfc9032ac Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 30 Dec 2016 16:31:57 +0000 Subject: [PATCH 21/45] Enable DHCP logging by default --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 92431cb6..7e3139f2 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -203,8 +203,8 @@ dhcp-range=${DHCP_START},${DHCP_END},${leasetime} dhcp-option=option:router,${DHCP_ROUTER} dhcp-leasefile=/etc/pihole/dhcp.leases domain=${PIHOLE_DOMAIN} -quiet-dhcp -quiet-dhcp6 +#quiet-dhcp +#quiet-dhcp6 #enable-ra dhcp-option=option6:dns-server,[::] dhcp-range=::100,::1ff,constructor:${interface},ra-names,slaac,${leasetime} From fc596e41d4374e4e494fef6a5a1d4da2684bad3e Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Fri, 30 Dec 2016 18:35:16 -0800 Subject: [PATCH 22/45] All scripts set executable --- advanced/Scripts/version.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 advanced/Scripts/version.sh diff --git a/advanced/Scripts/version.sh b/advanced/Scripts/version.sh old mode 100644 new mode 100755 From 836b717346a2f12e0a5fa9477c762aa0f3a37393 Mon Sep 17 00:00:00 2001 From: Dominik G Date: Sat, 31 Dec 2016 17:25:48 +0100 Subject: [PATCH 23/45] Fixed a typo in the installation script --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 0a56b06e..9d21495d 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -540,7 +540,7 @@ setLogging() { local LogChoices LogToggleCommand=(whiptail --separate-output --radiolist "Do you want to log queries?\n (Disabling will render graphs on the Admin page useless):" ${r} ${c} 6) - LogChooseOptions=("On (Reccomended)" "" on + LogChooseOptions=("On (Recommended)" "" on Off "" off) LogChoices=$("${LogToggleCommand[@]}" "${LogChooseOptions[@]}" 2>&1 >/dev/tty) || (echo "::: Cancel selected. Exiting..." && exit 1) case ${LogChoices} in From ccbf39191393d544d78747565dc0a45e4eb1e247 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 31 Dec 2016 19:07:40 -0800 Subject: [PATCH 24/45] More intelligence in iptables rulesets. Account for Policy ACCEPT, with default rule DROP or REJECT as last rule. Regex the conditions to make sure we are getting the right conditions. Reframe the logic to simplify the chains and rules Reframe the logic to simplify the chains and rules Signed-off-by: Dan Schaper --- .idea/codeStyleSettings.xml | 5 ++++- automated install/basic-install.sh | 16 +++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml index 8de25c7c..1028340e 100644 --- a/.idea/codeStyleSettings.xml +++ b/.idea/codeStyleSettings.xml @@ -15,8 +15,11 @@ + +