mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Replace wrapper function calls with direct utils.sh calls. Leave warpper functions until next release as docker currently uses them, and new changes to utils.sh need to be in the master
branch before docker can use them
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
parent
db116971ce
commit
23e6fa1ec5
1 changed files with 85 additions and 85 deletions
|
@ -88,7 +88,7 @@ delete_dnsmasq_setting() {
|
||||||
}
|
}
|
||||||
|
|
||||||
SetTemperatureUnit() {
|
SetTemperatureUnit() {
|
||||||
change_setting "TEMPERATUREUNIT" "${unit}"
|
addOrEditKeyValPair "${setupVars}" "TEMPERATUREUNIT" "${unit}"
|
||||||
echo -e " ${TICK} Set temperature unit to ${unit}"
|
echo -e " ${TICK} Set temperature unit to ${unit}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ SetWebPassword() {
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [ "${PASSWORD}" == "" ]; then
|
if [ "${PASSWORD}" == "" ]; then
|
||||||
change_setting "WEBPASSWORD" ""
|
addOrEditKeyValPair "${setupVars}" "WEBPASSWORD" ""
|
||||||
echo -e " ${TICK} Password Removed"
|
echo -e " ${TICK} Password Removed"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
@ -136,7 +136,7 @@ SetWebPassword() {
|
||||||
# We do not wrap this in brackets, otherwise BASH will expand any appropriate syntax
|
# We do not wrap this in brackets, otherwise BASH will expand any appropriate syntax
|
||||||
hash=$(HashPassword "$PASSWORD")
|
hash=$(HashPassword "$PASSWORD")
|
||||||
# Save hash to file
|
# Save hash to file
|
||||||
change_setting "WEBPASSWORD" "${hash}"
|
addOrEditKeyValPair "${setupVars}" "WEBPASSWORD" "${hash}"
|
||||||
echo -e " ${TICK} New password set"
|
echo -e " ${TICK} New password set"
|
||||||
else
|
else
|
||||||
echo -e " ${CROSS} Passwords don't match. Your password has not been changed"
|
echo -e " ${CROSS} Passwords don't match. Your password has not been changed"
|
||||||
|
@ -147,7 +147,7 @@ SetWebPassword() {
|
||||||
ProcessDNSSettings() {
|
ProcessDNSSettings() {
|
||||||
source "${setupVars}"
|
source "${setupVars}"
|
||||||
|
|
||||||
delete_dnsmasq_setting "server"
|
removeKey "${dnsmasqconfig}" "server"
|
||||||
|
|
||||||
COUNTER=1
|
COUNTER=1
|
||||||
while true ; do
|
while true ; do
|
||||||
|
@ -155,34 +155,34 @@ ProcessDNSSettings() {
|
||||||
if [ -z "${!var}" ]; then
|
if [ -z "${!var}" ]; then
|
||||||
break;
|
break;
|
||||||
fi
|
fi
|
||||||
add_dnsmasq_setting "server" "${!var}"
|
addOrEditKeyValPair "${dnsmasqconfig}" "server" "${!var}"
|
||||||
(( COUNTER++ ))
|
(( COUNTER++ ))
|
||||||
done
|
done
|
||||||
|
|
||||||
# The option LOCAL_DNS_PORT is deprecated
|
# The option LOCAL_DNS_PORT is deprecated
|
||||||
# We apply it once more, and then convert it into the current format
|
# We apply it once more, and then convert it into the current format
|
||||||
if [ -n "${LOCAL_DNS_PORT}" ]; then
|
if [ -n "${LOCAL_DNS_PORT}" ]; then
|
||||||
add_dnsmasq_setting "server" "127.0.0.1#${LOCAL_DNS_PORT}"
|
addOrEditKeyValPair "${dnsmasqconfig}" "server" "127.0.0.1#${LOCAL_DNS_PORT}"
|
||||||
add_setting "PIHOLE_DNS_${COUNTER}" "127.0.0.1#${LOCAL_DNS_PORT}"
|
addOrEditKeyValPair "${setupVars}" "PIHOLE_DNS_${COUNTER}" "127.0.0.1#${LOCAL_DNS_PORT}"
|
||||||
delete_setting "LOCAL_DNS_PORT"
|
removeKey "${setupVars}" "LOCAL_DNS_PORT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
delete_dnsmasq_setting "domain-needed"
|
removeKey "${dnsmasqconfig}" "domain-needed"
|
||||||
delete_dnsmasq_setting "expand-hosts"
|
removeKey "${dnsmasqconfig}" "expand-hosts"
|
||||||
|
|
||||||
if [[ "${DNS_FQDN_REQUIRED}" == true ]]; then
|
if [[ "${DNS_FQDN_REQUIRED}" == true ]]; then
|
||||||
add_dnsmasq_setting "domain-needed"
|
addKey "${dnsmasqconfig}" "domain-needed"
|
||||||
add_dnsmasq_setting "expand-hosts"
|
addKey "${dnsmasqconfig}" "expand-hosts"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
delete_dnsmasq_setting "bogus-priv"
|
removeKey "${dnsmasqconfig}" "bogus-priv"
|
||||||
|
|
||||||
if [[ "${DNS_BOGUS_PRIV}" == true ]]; then
|
if [[ "${DNS_BOGUS_PRIV}" == true ]]; then
|
||||||
add_dnsmasq_setting "bogus-priv"
|
addKey "${dnsmasqconfig}" "bogus-priv"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
delete_dnsmasq_setting "dnssec"
|
removeKey "${dnsmasqconfig}" "dnssec"
|
||||||
delete_dnsmasq_setting "trust-anchor"
|
removeKey "${dnsmasqconfig}" "trust-anchor"
|
||||||
|
|
||||||
if [[ "${DNSSEC}" == true ]]; then
|
if [[ "${DNSSEC}" == true ]]; then
|
||||||
echo "dnssec
|
echo "dnssec
|
||||||
|
@ -190,24 +190,24 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423
|
||||||
" >> "${dnsmasqconfig}"
|
" >> "${dnsmasqconfig}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
delete_dnsmasq_setting "host-record"
|
removeKey "${dnsmasqconfig}" "host-record"
|
||||||
|
|
||||||
if [ -n "${HOSTRECORD}" ]; then
|
if [ -n "${HOSTRECORD}" ]; then
|
||||||
add_dnsmasq_setting "host-record" "${HOSTRECORD}"
|
addOrEditKeyValPair "${dnsmasqconfig}" "host-record" "${HOSTRECORD}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Setup interface listening behavior of dnsmasq
|
# Setup interface listening behavior of dnsmasq
|
||||||
delete_dnsmasq_setting "interface"
|
removeKey "${dnsmasqconfig}" "interface"
|
||||||
delete_dnsmasq_setting "local-service"
|
removeKey "${dnsmasqconfig}" "local-service"
|
||||||
delete_dnsmasq_setting "except-interface"
|
removeKey "${dnsmasqconfig}" "except-interface"
|
||||||
delete_dnsmasq_setting "bind-interfaces"
|
removeKey "${dnsmasqconfig}" "bind-interfaces"
|
||||||
|
|
||||||
if [[ "${DNSMASQ_LISTENING}" == "all" ]]; then
|
if [[ "${DNSMASQ_LISTENING}" == "all" ]]; then
|
||||||
# Listen on all interfaces, permit all origins
|
# Listen on all interfaces, permit all origins
|
||||||
add_dnsmasq_setting "except-interface" "nonexisting"
|
addOrEditKeyValPair "${dnsmasqconfig}" "except-interface" "nonexisting"
|
||||||
elif [[ "${DNSMASQ_LISTENING}" == "local" ]]; then
|
elif [[ "${DNSMASQ_LISTENING}" == "local" ]]; then
|
||||||
# Listen only on all interfaces, but only local subnets
|
# Listen only on all interfaces, but only local subnets
|
||||||
add_dnsmasq_setting "local-service"
|
addKey "${dnsmasqconfig}" "local-service"
|
||||||
else
|
else
|
||||||
# Options "bind" and "single"
|
# Options "bind" and "single"
|
||||||
# Listen only on one interface
|
# Listen only on one interface
|
||||||
|
@ -216,30 +216,30 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423
|
||||||
PIHOLE_INTERFACE="eth0"
|
PIHOLE_INTERFACE="eth0"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
add_dnsmasq_setting "interface" "${PIHOLE_INTERFACE}"
|
addOrEditKeyValPair "${dnsmasqconfig}" "interface" "${PIHOLE_INTERFACE}"
|
||||||
|
|
||||||
if [[ "${DNSMASQ_LISTENING}" == "bind" ]]; then
|
if [[ "${DNSMASQ_LISTENING}" == "bind" ]]; then
|
||||||
# Really bind to interface
|
# Really bind to interface
|
||||||
add_dnsmasq_setting "bind-interfaces"
|
addKey "${dnsmasqconfig}" "bind-interfaces"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${CONDITIONAL_FORWARDING}" == true ]]; then
|
if [[ "${CONDITIONAL_FORWARDING}" == true ]]; then
|
||||||
# Convert legacy "conditional forwarding" to rev-server configuration
|
# Convert legacy "conditional forwarding" to rev-server configuration
|
||||||
# Remove any existing REV_SERVER settings
|
# Remove any existing REV_SERVER settings
|
||||||
delete_setting "REV_SERVER"
|
removeKey "${setupVars}" "REV_SERVER"
|
||||||
delete_setting "REV_SERVER_DOMAIN"
|
removeKey "${setupVars}" "REV_SERVER_DOMAIN"
|
||||||
delete_setting "REV_SERVER_TARGET"
|
removeKey "${setupVars}" "REV_SERVER_TARGET"
|
||||||
delete_setting "REV_SERVER_CIDR"
|
removeKey "${setupVars}" "REV_SERVER_CIDR"
|
||||||
|
|
||||||
REV_SERVER=true
|
REV_SERVER=true
|
||||||
add_setting "REV_SERVER" "true"
|
addOrEditKeyValPair "${setupVars}" "REV_SERVER" "true"
|
||||||
|
|
||||||
REV_SERVER_DOMAIN="${CONDITIONAL_FORWARDING_DOMAIN}"
|
REV_SERVER_DOMAIN="${CONDITIONAL_FORWARDING_DOMAIN}"
|
||||||
add_setting "REV_SERVER_DOMAIN" "${REV_SERVER_DOMAIN}"
|
addOrEditKeyValPair "${setupVars}" "REV_SERVER_DOMAIN" "${REV_SERVER_DOMAIN}"
|
||||||
|
|
||||||
REV_SERVER_TARGET="${CONDITIONAL_FORWARDING_IP}"
|
REV_SERVER_TARGET="${CONDITIONAL_FORWARDING_IP}"
|
||||||
add_setting "REV_SERVER_TARGET" "${REV_SERVER_TARGET}"
|
addOrEditKeyValPair "${setupVars}" "REV_SERVER_TARGET" "${REV_SERVER_TARGET}"
|
||||||
|
|
||||||
#Convert CONDITIONAL_FORWARDING_REVERSE if necessary e.g:
|
#Convert CONDITIONAL_FORWARDING_REVERSE if necessary e.g:
|
||||||
# 1.1.168.192.in-addr.arpa to 192.168.1.1/32
|
# 1.1.168.192.in-addr.arpa to 192.168.1.1/32
|
||||||
|
@ -266,28 +266,28 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423
|
||||||
# shellcheck disable=2001
|
# shellcheck disable=2001
|
||||||
REV_SERVER_CIDR="$(sed "s+\\.[0-9]*$+\\.0/24+" <<< "${REV_SERVER_TARGET}")"
|
REV_SERVER_CIDR="$(sed "s+\\.[0-9]*$+\\.0/24+" <<< "${REV_SERVER_TARGET}")"
|
||||||
fi
|
fi
|
||||||
add_setting "REV_SERVER_CIDR" "${REV_SERVER_CIDR}"
|
addOrEditKeyValPair "${setupVars}" "REV_SERVER_CIDR" "${REV_SERVER_CIDR}"
|
||||||
|
|
||||||
# Remove obsolete settings from setupVars.conf
|
# Remove obsolete settings from setupVars.conf
|
||||||
delete_setting "CONDITIONAL_FORWARDING"
|
removeKey "${setupVars}" "CONDITIONAL_FORWARDING"
|
||||||
delete_setting "CONDITIONAL_FORWARDING_REVERSE"
|
removeKey "${setupVars}" "CONDITIONAL_FORWARDING_REVERSE"
|
||||||
delete_setting "CONDITIONAL_FORWARDING_DOMAIN"
|
removeKey "${setupVars}" "CONDITIONAL_FORWARDING_DOMAIN"
|
||||||
delete_setting "CONDITIONAL_FORWARDING_IP"
|
removeKey "${setupVars}" "CONDITIONAL_FORWARDING_IP"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
delete_dnsmasq_setting "rev-server"
|
removeKey "${dnsmasqconfig}" "rev-server"
|
||||||
|
|
||||||
if [[ "${REV_SERVER}" == true ]]; then
|
if [[ "${REV_SERVER}" == true ]]; then
|
||||||
add_dnsmasq_setting "rev-server=${REV_SERVER_CIDR},${REV_SERVER_TARGET}"
|
addKey "${dnsmasqconfig}" "rev-server=${REV_SERVER_CIDR},${REV_SERVER_TARGET}"
|
||||||
if [ -n "${REV_SERVER_DOMAIN}" ]; then
|
if [ -n "${REV_SERVER_DOMAIN}" ]; then
|
||||||
# Forward local domain names to the CF target, too
|
# Forward local domain names to the CF target, too
|
||||||
add_dnsmasq_setting "server=/${REV_SERVER_DOMAIN}/${REV_SERVER_TARGET}"
|
addKey "${dnsmasqconfig}" "server=/${REV_SERVER_DOMAIN}/${REV_SERVER_TARGET}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${DNS_FQDN_REQUIRED}" != true ]]; then
|
if [[ "${DNS_FQDN_REQUIRED}" != true ]]; then
|
||||||
# Forward unqualified names to the CF target only when the "never
|
# Forward unqualified names to the CF target only when the "never
|
||||||
# forward non-FQDN" option is unticked
|
# forward non-FQDN" option is unticked
|
||||||
add_dnsmasq_setting "server=//${REV_SERVER_TARGET}"
|
addKey "${dnsmasqconfig}" "server=//${REV_SERVER_TARGET}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -302,7 +302,7 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423
|
||||||
|
|
||||||
SetDNSServers() {
|
SetDNSServers() {
|
||||||
# Save setting to file
|
# Save setting to file
|
||||||
delete_setting "PIHOLE_DNS"
|
removeKey "${setupVars}" "PIHOLE_DNS"
|
||||||
IFS=',' read -r -a array <<< "${args[2]}"
|
IFS=',' read -r -a array <<< "${args[2]}"
|
||||||
for index in "${!array[@]}"
|
for index in "${!array[@]}"
|
||||||
do
|
do
|
||||||
|
@ -311,7 +311,7 @@ SetDNSServers() {
|
||||||
ip="${array[index]//\\#/#}"
|
ip="${array[index]//\\#/#}"
|
||||||
|
|
||||||
if valid_ip "${ip}" || valid_ip6 "${ip}" ; then
|
if valid_ip "${ip}" || valid_ip6 "${ip}" ; then
|
||||||
add_setting "PIHOLE_DNS_$((index+1))" "${ip}"
|
addOrEditKeyValPair "${setupVars}" "PIHOLE_DNS_$((index+1))" "${ip}"
|
||||||
else
|
else
|
||||||
echo -e " ${CROSS} Invalid IP has been passed"
|
echo -e " ${CROSS} Invalid IP has been passed"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -319,30 +319,30 @@ SetDNSServers() {
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ "${args[3]}" == "domain-needed" ]]; then
|
if [[ "${args[3]}" == "domain-needed" ]]; then
|
||||||
change_setting "DNS_FQDN_REQUIRED" "true"
|
addOrEditKeyValPair "${setupVars}" "DNS_FQDN_REQUIRED" "true"
|
||||||
else
|
else
|
||||||
change_setting "DNS_FQDN_REQUIRED" "false"
|
addOrEditKeyValPair "${setupVars}" "DNS_FQDN_REQUIRED" "false"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${args[4]}" == "bogus-priv" ]]; then
|
if [[ "${args[4]}" == "bogus-priv" ]]; then
|
||||||
change_setting "DNS_BOGUS_PRIV" "true"
|
addOrEditKeyValPair "${setupVars}" "DNS_BOGUS_PRIV" "true"
|
||||||
else
|
else
|
||||||
change_setting "DNS_BOGUS_PRIV" "false"
|
addOrEditKeyValPair "${setupVars}" "DNS_BOGUS_PRIV" "false"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${args[5]}" == "dnssec" ]]; then
|
if [[ "${args[5]}" == "dnssec" ]]; then
|
||||||
change_setting "DNSSEC" "true"
|
addOrEditKeyValPair "${setupVars}" "DNSSEC" "true"
|
||||||
else
|
else
|
||||||
change_setting "DNSSEC" "false"
|
addOrEditKeyValPair "${setupVars}" "DNSSEC" "false"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${args[6]}" == "rev-server" ]]; then
|
if [[ "${args[6]}" == "rev-server" ]]; then
|
||||||
change_setting "REV_SERVER" "true"
|
addOrEditKeyValPair "${setupVars}" "REV_SERVER" "true"
|
||||||
change_setting "REV_SERVER_CIDR" "${args[7]}"
|
addOrEditKeyValPair "${setupVars}" "REV_SERVER_CIDR" "${args[7]}"
|
||||||
change_setting "REV_SERVER_TARGET" "${args[8]}"
|
addOrEditKeyValPair "${setupVars}" "REV_SERVER_TARGET" "${args[8]}"
|
||||||
change_setting "REV_SERVER_DOMAIN" "${args[9]}"
|
addOrEditKeyValPair "${setupVars}" "REV_SERVER_DOMAIN" "${args[9]}"
|
||||||
else
|
else
|
||||||
change_setting "REV_SERVER" "false"
|
addOrEditKeyValPair "${setupVars}" "REV_SERVER" "false"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ProcessDNSSettings
|
ProcessDNSSettings
|
||||||
|
@ -352,11 +352,11 @@ SetDNSServers() {
|
||||||
}
|
}
|
||||||
|
|
||||||
SetExcludeDomains() {
|
SetExcludeDomains() {
|
||||||
change_setting "API_EXCLUDE_DOMAINS" "${args[2]}"
|
addOrEditKeyValPair "${setupVars}" "API_EXCLUDE_DOMAINS" "${args[2]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
SetExcludeClients() {
|
SetExcludeClients() {
|
||||||
change_setting "API_EXCLUDE_CLIENTS" "${args[2]}"
|
addOrEditKeyValPair "${setupVars}" "API_EXCLUDE_CLIENTS" "${args[2]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
Poweroff(){
|
Poweroff(){
|
||||||
|
@ -372,7 +372,7 @@ RestartDNS() {
|
||||||
}
|
}
|
||||||
|
|
||||||
SetQueryLogOptions() {
|
SetQueryLogOptions() {
|
||||||
change_setting "API_QUERY_LOG_SHOW" "${args[2]}"
|
addOrEditKeyValPair "${setupVars}" "API_QUERY_LOG_SHOW" "${args[2]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessDHCPSettings() {
|
ProcessDHCPSettings() {
|
||||||
|
@ -388,19 +388,19 @@ ProcessDHCPSettings() {
|
||||||
|
|
||||||
if [[ "${PIHOLE_DOMAIN}" == "" ]]; then
|
if [[ "${PIHOLE_DOMAIN}" == "" ]]; then
|
||||||
PIHOLE_DOMAIN="lan"
|
PIHOLE_DOMAIN="lan"
|
||||||
change_setting "PIHOLE_DOMAIN" "${PIHOLE_DOMAIN}"
|
addOrEditKeyValPair "${setupVars}" "PIHOLE_DOMAIN" "${PIHOLE_DOMAIN}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${DHCP_LEASETIME}" == "0" ]]; then
|
if [[ "${DHCP_LEASETIME}" == "0" ]]; then
|
||||||
leasetime="infinite"
|
leasetime="infinite"
|
||||||
elif [[ "${DHCP_LEASETIME}" == "" ]]; then
|
elif [[ "${DHCP_LEASETIME}" == "" ]]; then
|
||||||
leasetime="24"
|
leasetime="24"
|
||||||
change_setting "DHCP_LEASETIME" "${leasetime}"
|
addOrEditKeyValPair "${setupVars}" "DHCP_LEASETIME" "${leasetime}"
|
||||||
elif [[ "${DHCP_LEASETIME}" == "24h" ]]; then
|
elif [[ "${DHCP_LEASETIME}" == "24h" ]]; then
|
||||||
#Installation is affected by known bug, introduced in a previous version.
|
#Installation is affected by known bug, introduced in a previous version.
|
||||||
#This will automatically clean up setupVars.conf and remove the unnecessary "h"
|
#This will automatically clean up setupVars.conf and remove the unnecessary "h"
|
||||||
leasetime="24"
|
leasetime="24"
|
||||||
change_setting "DHCP_LEASETIME" "${leasetime}"
|
addOrEditKeyValPair "${setupVars}" "DHCP_LEASETIME" "${leasetime}"
|
||||||
else
|
else
|
||||||
leasetime="${DHCP_LEASETIME}h"
|
leasetime="${DHCP_LEASETIME}h"
|
||||||
fi
|
fi
|
||||||
|
@ -453,24 +453,24 @@ ra-param=*,0,0
|
||||||
}
|
}
|
||||||
|
|
||||||
EnableDHCP() {
|
EnableDHCP() {
|
||||||
change_setting "DHCP_ACTIVE" "true"
|
addOrEditKeyValPair "${setupVars}" "DHCP_ACTIVE" "true"
|
||||||
change_setting "DHCP_START" "${args[2]}"
|
addOrEditKeyValPair "${setupVars}" "DHCP_START" "${args[2]}"
|
||||||
change_setting "DHCP_END" "${args[3]}"
|
addOrEditKeyValPair "${setupVars}" "DHCP_END" "${args[3]}"
|
||||||
change_setting "DHCP_ROUTER" "${args[4]}"
|
addOrEditKeyValPair "${setupVars}" "DHCP_ROUTER" "${args[4]}"
|
||||||
change_setting "DHCP_LEASETIME" "${args[5]}"
|
addOrEditKeyValPair "${setupVars}" "DHCP_LEASETIME" "${args[5]}"
|
||||||
change_setting "PIHOLE_DOMAIN" "${args[6]}"
|
addOrEditKeyValPair "${setupVars}" "PIHOLE_DOMAIN" "${args[6]}"
|
||||||
change_setting "DHCP_IPv6" "${args[7]}"
|
addOrEditKeyValPair "${setupVars}" "DHCP_IPv6" "${args[7]}"
|
||||||
change_setting "DHCP_rapid_commit" "${args[8]}"
|
addOrEditKeyValPair "${setupVars}" "DHCP_rapid_commit" "${args[8]}"
|
||||||
|
|
||||||
# Remove possible old setting from file
|
# Remove possible old setting from file
|
||||||
delete_dnsmasq_setting "dhcp-"
|
removeKey "${dnsmasqconfig}" "dhcp-"
|
||||||
delete_dnsmasq_setting "quiet-dhcp"
|
removeKey "${dnsmasqconfig}" "quiet-dhcp"
|
||||||
|
|
||||||
# If a DHCP client claims that its name is "wpad", ignore that.
|
# If a DHCP client claims that its name is "wpad", ignore that.
|
||||||
# This fixes a security hole. see CERT Vulnerability VU#598349
|
# This fixes a security hole. see CERT Vulnerability VU#598349
|
||||||
# We also ignore "localhost" as Windows behaves strangely if a
|
# We also ignore "localhost" as Windows behaves strangely if a
|
||||||
# device claims this host name
|
# device claims this host name
|
||||||
add_dnsmasq_setting "dhcp-name-match=set:hostname-ignore,wpad
|
addKey "${dnsmasqconfig}" "dhcp-name-match=set:hostname-ignore,wpad
|
||||||
dhcp-name-match=set:hostname-ignore,localhost
|
dhcp-name-match=set:hostname-ignore,localhost
|
||||||
dhcp-ignore-names=tag:hostname-ignore"
|
dhcp-ignore-names=tag:hostname-ignore"
|
||||||
|
|
||||||
|
@ -480,11 +480,11 @@ dhcp-ignore-names=tag:hostname-ignore"
|
||||||
}
|
}
|
||||||
|
|
||||||
DisableDHCP() {
|
DisableDHCP() {
|
||||||
change_setting "DHCP_ACTIVE" "false"
|
addOrEditKeyValPair "${setupVars}" "DHCP_ACTIVE" "false"
|
||||||
|
|
||||||
# Remove possible old setting from file
|
# Remove possible old setting from file
|
||||||
delete_dnsmasq_setting "dhcp-"
|
removeKey "${dnsmasqconfig}" "dhcp-"
|
||||||
delete_dnsmasq_setting "quiet-dhcp"
|
removeKey "${dnsmasqconfig}" "quiet-dhcp"
|
||||||
|
|
||||||
ProcessDHCPSettings
|
ProcessDHCPSettings
|
||||||
|
|
||||||
|
@ -492,11 +492,11 @@ DisableDHCP() {
|
||||||
}
|
}
|
||||||
|
|
||||||
SetWebUILayout() {
|
SetWebUILayout() {
|
||||||
change_setting "WEBUIBOXEDLAYOUT" "${args[2]}"
|
addOrEditKeyValPair "${setupVars}" "WEBUIBOXEDLAYOUT" "${args[2]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
SetWebUITheme() {
|
SetWebUITheme() {
|
||||||
change_setting "WEBTHEME" "${args[2]}"
|
addOrEditKeyValPair "${setupVars}" "WEBTHEME" "${args[2]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckUrl(){
|
CheckUrl(){
|
||||||
|
@ -591,10 +591,10 @@ Options:
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
change_setting "ADMIN_EMAIL" "${args[2]}"
|
addOrEditKeyValPair "${setupVars}" "ADMIN_EMAIL" "${args[2]}"
|
||||||
echo -e " ${TICK} Setting admin contact to ${args[2]}"
|
echo -e " ${TICK} Setting admin contact to ${args[2]}"
|
||||||
else
|
else
|
||||||
change_setting "ADMIN_EMAIL" ""
|
addOrEditKeyValPair "${setupVars}" "ADMIN_EMAIL" ""
|
||||||
echo -e " ${TICK} Removing admin contact"
|
echo -e " ${TICK} Removing admin contact"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -618,16 +618,16 @@ Interfaces:
|
||||||
|
|
||||||
if [[ "${args[2]}" == "all" ]]; then
|
if [[ "${args[2]}" == "all" ]]; then
|
||||||
echo -e " ${INFO} Listening on all interfaces, permitting all origins. Please use a firewall!"
|
echo -e " ${INFO} Listening on all interfaces, permitting all origins. Please use a firewall!"
|
||||||
change_setting "DNSMASQ_LISTENING" "all"
|
addOrEditKeyValPair "${setupVars}" "DNSMASQ_LISTENING" "all"
|
||||||
elif [[ "${args[2]}" == "local" ]]; then
|
elif [[ "${args[2]}" == "local" ]]; then
|
||||||
echo -e " ${INFO} Listening on all interfaces, permitting origins from one hop away (LAN)"
|
echo -e " ${INFO} Listening on all interfaces, permitting origins from one hop away (LAN)"
|
||||||
change_setting "DNSMASQ_LISTENING" "local"
|
addOrEditKeyValPair "${setupVars}" "DNSMASQ_LISTENING" "local"
|
||||||
elif [[ "${args[2]}" == "bind" ]]; then
|
elif [[ "${args[2]}" == "bind" ]]; then
|
||||||
echo -e " ${INFO} Binding on interface ${PIHOLE_INTERFACE}"
|
echo -e " ${INFO} Binding on interface ${PIHOLE_INTERFACE}"
|
||||||
change_setting "DNSMASQ_LISTENING" "bind"
|
addOrEditKeyValPair "${setupVars}" "DNSMASQ_LISTENING" "bind"
|
||||||
else
|
else
|
||||||
echo -e " ${INFO} Listening only on interface ${PIHOLE_INTERFACE}"
|
echo -e " ${INFO} Listening only on interface ${PIHOLE_INTERFACE}"
|
||||||
change_setting "DNSMASQ_LISTENING" "single"
|
addOrEditKeyValPair "${setupVars}" "DNSMASQ_LISTENING" "single"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Don't restart DNS server yet because other settings
|
# Don't restart DNS server yet because other settings
|
||||||
|
@ -697,7 +697,7 @@ clearAudit()
|
||||||
SetPrivacyLevel() {
|
SetPrivacyLevel() {
|
||||||
# Set privacy level. Minimum is 0, maximum is 3
|
# Set privacy level. Minimum is 0, maximum is 3
|
||||||
if [ "${args[2]}" -ge 0 ] && [ "${args[2]}" -le 3 ]; then
|
if [ "${args[2]}" -ge 0 ] && [ "${args[2]}" -le 3 ]; then
|
||||||
changeFTLsetting "PRIVACYLEVEL" "${args[2]}"
|
addOrEditKeyValPair "${FTLconf}" "PRIVACYLEVEL" "${args[2]}"
|
||||||
pihole restartdns reload-lists
|
pihole restartdns reload-lists
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -815,7 +815,7 @@ SetRateLimit() {
|
||||||
|
|
||||||
# Set rate-limit setting inf valid
|
# Set rate-limit setting inf valid
|
||||||
if [ "${rate_limit_count}" -ge 0 ] && [ "${rate_limit_interval}" -ge 0 ]; then
|
if [ "${rate_limit_count}" -ge 0 ] && [ "${rate_limit_interval}" -ge 0 ]; then
|
||||||
changeFTLsetting "RATE_LIMIT" "${rate_limit_count}/${rate_limit_interval}"
|
addOrEditKeyValPair "${FTLconf}" "RATE_LIMIT" "${rate_limit_count}/${rate_limit_interval}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Restart FTL to update rate-limit settings only if $reload not false
|
# Restart FTL to update rate-limit settings only if $reload not false
|
||||||
|
|
Loading…
Reference in a new issue