From 24b8b4e904b976b1fb91cc9ef66cdf693dcf0966 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 18 Apr 2018 17:12:20 +0200 Subject: [PATCH 1/2] Add backend changes for supporting a local recursive DNS server Signed-off-by: DL6ER --- advanced/Scripts/webpage.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index ce6c34d2..b04b55aa 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -149,6 +149,10 @@ ProcessDNSSettings() { let COUNTER=COUNTER+1 done + if [ ! -z "${LOCAL_RECURSIVE}" ]; then + add_dnsmasq_setting "server" "127.0.0.1#${LOCAL_RECURSIVE}" + fi + delete_dnsmasq_setting "domain-needed" if [[ "${DNS_FQDN_REQUIRED}" == true ]]; then @@ -525,6 +529,16 @@ SetPrivacyLevel() { changeFTLsetting "PRIVACYLEVEL" "${args[2]}" fi } +SetLocalRecursivePort() { + # Ensure port is a natural number { 0, 1, 2, 3, ... } + if [[ "${1}" == "0" ]]; then + delete_setting "LOCAL_RECURSIVE" + ProcessDNSSettings + elif [[ "${1}" =~ ^[0-9]+$ ]]; then + change_setting "LOCAL_RECURSIVE" "${1}" + ProcessDNSSettings + fi +} main() { args=("$@") @@ -556,6 +570,7 @@ main() { "adlist" ) CustomizeAdLists;; "audit" ) audit;; "-l" | "privacylevel" ) SetPrivacyLevel;; + "localrecursivedns" ) SetLocalRecursivePort "$3";; * ) helpFunc;; esac From ce35509a40a08ed61b7788e49b4677826ab0e75f Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 18 Apr 2018 17:30:51 +0200 Subject: [PATCH 2/2] Change command to "pihole -a localdnsport X" Signed-off-by: DL6ER --- advanced/Scripts/webpage.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index b04b55aa..21623eea 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -149,8 +149,8 @@ ProcessDNSSettings() { let COUNTER=COUNTER+1 done - if [ ! -z "${LOCAL_RECURSIVE}" ]; then - add_dnsmasq_setting "server" "127.0.0.1#${LOCAL_RECURSIVE}" + if [ ! -z "${LOCAL_DNS_PORT}" ]; then + add_dnsmasq_setting "server" "127.0.0.1#${LOCAL_DNS_PORT}" fi delete_dnsmasq_setting "domain-needed" @@ -529,13 +529,13 @@ SetPrivacyLevel() { changeFTLsetting "PRIVACYLEVEL" "${args[2]}" fi } -SetLocalRecursivePort() { +SetLocalDNSport() { # Ensure port is a natural number { 0, 1, 2, 3, ... } if [[ "${1}" == "0" ]]; then - delete_setting "LOCAL_RECURSIVE" + delete_setting "LOCAL_DNS_PORT" ProcessDNSSettings elif [[ "${1}" =~ ^[0-9]+$ ]]; then - change_setting "LOCAL_RECURSIVE" "${1}" + change_setting "LOCAL_DNS_PORT" "${1}" ProcessDNSSettings fi } @@ -570,7 +570,7 @@ main() { "adlist" ) CustomizeAdLists;; "audit" ) audit;; "-l" | "privacylevel" ) SetPrivacyLevel;; - "localrecursivedns" ) SetLocalRecursivePort "$3";; + "localdnsport" ) SetLocalDNSport "$3";; * ) helpFunc;; esac