mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Merge pull request #3259 from pi-hole/update_devel
Update development from release/v5.0
This commit is contained in:
commit
1632632668
4 changed files with 43 additions and 23 deletions
|
@ -36,13 +36,6 @@ flushARP(){
|
||||||
echo -ne " ${INFO} Flushing network table ..."
|
echo -ne " ${INFO} Flushing network table ..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Flush ARP cache to avoid re-adding of dead entries
|
|
||||||
if ! output=$(ip neigh flush all 2>&1); then
|
|
||||||
echo -e "${OVER} ${CROSS} Failed to clear ARP cache"
|
|
||||||
echo " Output: ${output}"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Truncate network_addresses table in pihole-FTL.db
|
# Truncate network_addresses table in pihole-FTL.db
|
||||||
# This needs to be done before we can truncate the network table due to
|
# This needs to be done before we can truncate the network table due to
|
||||||
# foreign key contraints
|
# foreign key contraints
|
||||||
|
|
|
@ -179,7 +179,6 @@ ProcessDNSSettings() {
|
||||||
|
|
||||||
if [[ "${DNSSEC}" == true ]]; then
|
if [[ "${DNSSEC}" == true ]]; then
|
||||||
echo "dnssec
|
echo "dnssec
|
||||||
trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE32F24E8FB5
|
|
||||||
trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC683457104237C7F8EC8D
|
trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC683457104237C7F8EC8D
|
||||||
" >> "${dnsmasqconfig}"
|
" >> "${dnsmasqconfig}"
|
||||||
fi
|
fi
|
||||||
|
@ -402,22 +401,38 @@ SetWebUILayout() {
|
||||||
change_setting "WEBUIBOXEDLAYOUT" "${args[2]}"
|
change_setting "WEBUIBOXEDLAYOUT" "${args[2]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CheckUrl(){
|
||||||
|
local regex
|
||||||
|
# Check for characters NOT allowed in URLs
|
||||||
|
regex="[^a-zA-Z0-9:/?&%=~._-]"
|
||||||
|
if [[ "${1}" =~ ${regex} ]]; then
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
CustomizeAdLists() {
|
CustomizeAdLists() {
|
||||||
local address
|
local address
|
||||||
address="${args[3]}"
|
address="${args[3]}"
|
||||||
local comment
|
local comment
|
||||||
comment="${args[4]}"
|
comment="${args[4]}"
|
||||||
|
|
||||||
if [[ "${args[2]}" == "enable" ]]; then
|
if CheckUrl "${address}"; then
|
||||||
sqlite3 "${gravityDBfile}" "UPDATE adlist SET enabled = 1 WHERE address = '${address}'"
|
if [[ "${args[2]}" == "enable" ]]; then
|
||||||
elif [[ "${args[2]}" == "disable" ]]; then
|
sqlite3 "${gravityDBfile}" "UPDATE adlist SET enabled = 1 WHERE address = '${address}'"
|
||||||
sqlite3 "${gravityDBfile}" "UPDATE adlist SET enabled = 0 WHERE address = '${address}'"
|
elif [[ "${args[2]}" == "disable" ]]; then
|
||||||
elif [[ "${args[2]}" == "add" ]]; then
|
sqlite3 "${gravityDBfile}" "UPDATE adlist SET enabled = 0 WHERE address = '${address}'"
|
||||||
sqlite3 "${gravityDBfile}" "INSERT OR IGNORE INTO adlist (address, comment) VALUES ('${address}', '${comment}')"
|
elif [[ "${args[2]}" == "add" ]]; then
|
||||||
elif [[ "${args[2]}" == "del" ]]; then
|
sqlite3 "${gravityDBfile}" "INSERT OR IGNORE INTO adlist (address, comment) VALUES ('${address}', '${comment}')"
|
||||||
sqlite3 "${gravityDBfile}" "DELETE FROM adlist WHERE address = '${address}'"
|
elif [[ "${args[2]}" == "del" ]]; then
|
||||||
|
sqlite3 "${gravityDBfile}" "DELETE FROM adlist WHERE address = '${address}'"
|
||||||
|
else
|
||||||
|
echo "Not permitted"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Not permitted"
|
echo "Invalid Url"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -502,6 +517,13 @@ Options:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "${args[2]}" ]]; then
|
if [[ -n "${args[2]}" ]]; then
|
||||||
|
|
||||||
|
# Sanitize email address in case of security issues
|
||||||
|
if [[ ! "${args[2]}" =~ ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$ ]]; then
|
||||||
|
echo -e " ${CROSS} Invalid email address"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
change_setting "ADMIN_EMAIL" "${args[2]}"
|
change_setting "ADMIN_EMAIL" "${args[2]}"
|
||||||
echo -e " ${TICK} Setting admin contact to ${args[2]}"
|
echo -e " ${TICK} Setting admin contact to ${args[2]}"
|
||||||
else
|
else
|
||||||
|
|
|
@ -244,7 +244,7 @@ if is_command apt-get ; then
|
||||||
# These programs are stored in an array so they can be looped through later
|
# These programs are stored in an array so they can be looped through later
|
||||||
INSTALLER_DEPS=(dhcpcd5 git "${iproute_pkg}" whiptail)
|
INSTALLER_DEPS=(dhcpcd5 git "${iproute_pkg}" whiptail)
|
||||||
# Pi-hole itself has several dependencies that also need to be installed
|
# Pi-hole itself has several dependencies that also need to be installed
|
||||||
PIHOLE_DEPS=(cron curl dnsutils iputils-ping lsof netcat psmisc sudo unzip idn2 sqlite3 libcap2-bin dns-root-data resolvconf libcap2)
|
PIHOLE_DEPS=(cron curl dnsutils iputils-ping lsof netcat psmisc sudo unzip wget idn2 sqlite3 libcap2-bin dns-root-data libcap2)
|
||||||
# The Web dashboard has some that also need to be installed
|
# The Web dashboard has some that also need to be installed
|
||||||
# It's useful to separate the two since our repos are also setup as "Core" code and "Web" code
|
# It's useful to separate the two since our repos are also setup as "Core" code and "Web" code
|
||||||
PIHOLE_WEB_DEPS=(lighttpd "${phpVer}-common" "${phpVer}-cgi" "${phpVer}-${phpSqlite}" "${phpVer}-xml" "php-intl")
|
PIHOLE_WEB_DEPS=(lighttpd "${phpVer}-common" "${phpVer}-cgi" "${phpVer}-${phpSqlite}" "${phpVer}-xml" "php-intl")
|
||||||
|
@ -855,7 +855,7 @@ setDHCPCD() {
|
||||||
echo "interface ${PIHOLE_INTERFACE}
|
echo "interface ${PIHOLE_INTERFACE}
|
||||||
static ip_address=${IPV4_ADDRESS}
|
static ip_address=${IPV4_ADDRESS}
|
||||||
static routers=${IPv4gw}
|
static routers=${IPv4gw}
|
||||||
static domain_name_servers=127.0.0.1" | tee -a /etc/dhcpcd.conf >/dev/null
|
static domain_name_servers=${PIHOLE_DNS_1} ${PIHOLE_DNS_2}" | tee -a /etc/dhcpcd.conf >/dev/null
|
||||||
# Then use the ip command to immediately set the new address
|
# Then use the ip command to immediately set the new address
|
||||||
ip addr replace dev "${PIHOLE_INTERFACE}" "${IPV4_ADDRESS}"
|
ip addr replace dev "${PIHOLE_INTERFACE}" "${IPV4_ADDRESS}"
|
||||||
# Also give a warning that the user may need to reboot their system
|
# Also give a warning that the user may need to reboot their system
|
||||||
|
@ -1212,8 +1212,7 @@ chooseBlocklists() {
|
||||||
MalwareDom "MalwareDomains" on
|
MalwareDom "MalwareDomains" on
|
||||||
Cameleon "Cameleon" on
|
Cameleon "Cameleon" on
|
||||||
DisconTrack "Disconnect.me Tracking" on
|
DisconTrack "Disconnect.me Tracking" on
|
||||||
DisconAd "Disconnect.me Ads" on
|
DisconAd "Disconnect.me Ads" on)
|
||||||
HostsFile "Hosts-file.net Ads" on)
|
|
||||||
|
|
||||||
# In a variable, show the choices available; exit if Cancel is selected
|
# In a variable, show the choices available; exit if Cancel is selected
|
||||||
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) || { printf " %bCancel was selected, exiting installer%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"; rm "${adlistFile}" ;exit 1; }
|
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) || { printf " %bCancel was selected, exiting installer%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"; rm "${adlistFile}" ;exit 1; }
|
||||||
|
@ -1235,7 +1234,6 @@ appendToListsFile() {
|
||||||
Cameleon ) echo "https://sysctl.org/cameleon/hosts" >> "${adlistFile}";;
|
Cameleon ) echo "https://sysctl.org/cameleon/hosts" >> "${adlistFile}";;
|
||||||
DisconTrack ) echo "https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt" >> "${adlistFile}";;
|
DisconTrack ) echo "https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt" >> "${adlistFile}";;
|
||||||
DisconAd ) echo "https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt" >> "${adlistFile}";;
|
DisconAd ) echo "https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt" >> "${adlistFile}";;
|
||||||
HostsFile ) echo "https://hosts-file.net/ad_servers.txt" >> "${adlistFile}";;
|
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -374,7 +374,14 @@ gravity_DownloadBlocklists() {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo -e " ${INFO} Target: ${url}"
|
echo -e " ${INFO} Target: ${url}"
|
||||||
gravity_DownloadBlocklistFromUrl "${url}" "${cmd_ext}" "${agent}" "${sourceIDs[$i]}" "${saveLocation}" "${target}"
|
local regex
|
||||||
|
# Check for characters NOT allowed in URLs
|
||||||
|
regex="[^a-zA-Z0-9:/?&%=~._-]"
|
||||||
|
if [[ "${url}" =~ ${regex} ]]; then
|
||||||
|
echo -e " ${CROSS} Invalid Target"
|
||||||
|
else
|
||||||
|
gravity_DownloadBlocklistFromUrl "${url}" "${cmd_ext}" "${agent}" "${sourceIDs[$i]}" "${saveLocation}" "${target}"
|
||||||
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue