From 4941e0f8ad507e0b720b1a0cf13c5b66985043eb Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 4 Apr 2018 13:12:39 +0200 Subject: [PATCH] Backend changes needed to be able to set the privacy level Signed-off-by: DL6ER --- advanced/Scripts/webpage.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 5eb35e97..3116f878 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -13,6 +13,7 @@ readonly setupVars="/etc/pihole/setupVars.conf" readonly dnsmasqconfig="/etc/dnsmasq.d/01-pihole.conf" readonly dhcpconfig="/etc/dnsmasq.d/02-pihole-dhcp.conf" +readonly FTLconf="/etc/pihole/pihole-FTL.conf" # 03 -> wildcards readonly dhcpstaticconfig="/etc/dnsmasq.d/04-pihole-static-dhcp.conf" @@ -52,6 +53,19 @@ change_setting() { add_setting "${1}" "${2}" } +addFTLsetting() { + echo "${1}=${2}" >> "${FTLconf}" +} + +deleteFTLsetting() { + sed -i "/${1}/d" "${FTLconf}" +} + +changeFTLsetting() { + deleteFTLsetting "${1}" + addFTLsetting "${1}" "${2}" +} + add_dnsmasq_setting() { if [[ "${2}" != "" ]]; then echo "${1}=${2}" >> "${dnsmasqconfig}" @@ -505,6 +519,13 @@ audit() echo "${args[2]}" >> /etc/pihole/auditlog.list } +SetPrivacyLevel() { + # Set privacy level. Minimum is 0, maximum is 3 + if [ "${args[2]}" -ge 0 ] && [ "${args[2]}" -le 3 ]; then + changeFTLsetting "PRIVACYLEVEL" "${args[2]}" + fi +} + main() { args=("$@") @@ -534,6 +555,7 @@ main() { "-t" | "teleporter" ) Teleporter;; "adlist" ) CustomizeAdLists;; "audit" ) audit;; + "privacylevel" ) SetPrivacyLevel;; * ) helpFunc;; esac