mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
commit
26fcb1b2a0
5 changed files with 45 additions and 18 deletions
|
@ -25,6 +25,8 @@ addn-hosts=/etc/pihole/local.list
|
||||||
|
|
||||||
domain-needed
|
domain-needed
|
||||||
|
|
||||||
|
localise-queries
|
||||||
|
|
||||||
bogus-priv
|
bogus-priv
|
||||||
|
|
||||||
no-resolv
|
no-resolv
|
||||||
|
|
|
@ -27,6 +27,7 @@ PIHOLELOG="/var/log/pihole.log"
|
||||||
PIHOLEGITDIR="/etc/.pihole/"
|
PIHOLEGITDIR="/etc/.pihole/"
|
||||||
ADMINGITDIR="/var/www/html/admin/"
|
ADMINGITDIR="/var/www/html/admin/"
|
||||||
WHITELISTMATCHES="/tmp/whitelistmatches.list"
|
WHITELISTMATCHES="/tmp/whitelistmatches.list"
|
||||||
|
readonly FTLLOG="/var/log/pihole-FTL.log"
|
||||||
|
|
||||||
TIMEOUT=60
|
TIMEOUT=60
|
||||||
# Header info and introduction
|
# Header info and introduction
|
||||||
|
@ -523,6 +524,18 @@ header_write "Analyzing pihole.log"
|
||||||
&& log_write "${PIHOLELOG} is ${pihole_size}." \
|
&& log_write "${PIHOLELOG} is ${pihole_size}." \
|
||||||
|| log_echo "Warning: No pihole.log file found!"
|
|| log_echo "Warning: No pihole.log file found!"
|
||||||
|
|
||||||
|
header_write "Analyzing pihole-FTL.log"
|
||||||
|
|
||||||
|
FTL_length=$(grep -c ^ "${FTLLOG}") \
|
||||||
|
&& log_write "${FTLLOG} is ${FTL_length} lines long." \
|
||||||
|
|| log_echo "Warning: No pihole-FTL.log file found!"
|
||||||
|
|
||||||
|
FTL_size=$(du -h "${FTLLOG}" | awk '{ print $1 }') \
|
||||||
|
&& log_write "${FTLLOG} is ${FTL_size}." \
|
||||||
|
|| log_echo "Warning: No pihole-FTL.log file found!"
|
||||||
|
|
||||||
|
tail -n50 "${FTLLOG}" >&3
|
||||||
|
|
||||||
trap finalWork EXIT
|
trap finalWork EXIT
|
||||||
|
|
||||||
### Method calls for additional logging ###
|
### Method calls for additional logging ###
|
||||||
|
|
|
@ -67,6 +67,13 @@ SetTemperatureUnit(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HashPassword(){
|
||||||
|
# Compute password hash twice to avoid rainbow table vulnerability
|
||||||
|
return=$(echo -n ${1} | sha256sum | sed 's/\s.*$//')
|
||||||
|
return=$(echo -n ${return} | sha256sum | sed 's/\s.*$//')
|
||||||
|
echo ${return}
|
||||||
|
}
|
||||||
|
|
||||||
SetWebPassword(){
|
SetWebPassword(){
|
||||||
|
|
||||||
if [ "${SUDO_USER}" == "www-data" ]; then
|
if [ "${SUDO_USER}" == "www-data" ]; then
|
||||||
|
@ -81,6 +88,10 @@ SetWebPassword(){
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if (( ${#args[2]} > 0 )) ; then
|
||||||
|
readonly PASSWORD="${args[2]}"
|
||||||
|
readonly CONFIRM="${PASSWORD}"
|
||||||
|
else
|
||||||
read -s -p "Enter New Password (Blank for no password): " PASSWORD
|
read -s -p "Enter New Password (Blank for no password): " PASSWORD
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
@ -92,10 +103,10 @@ SetWebPassword(){
|
||||||
|
|
||||||
read -s -p "Confirm Password: " CONFIRM
|
read -s -p "Confirm Password: " CONFIRM
|
||||||
echo ""
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${PASSWORD}" == "${CONFIRM}" ] ; then
|
if [ "${PASSWORD}" == "${CONFIRM}" ] ; then
|
||||||
# Compute password hash twice to avoid rainbow table vulnerability
|
hash=$(HashPassword ${PASSWORD})
|
||||||
hash=$(echo -n ${PASSWORD} | sha256sum | sed 's/\s.*$//')
|
|
||||||
hash=$(echo -n ${hash} | sha256sum | sed 's/\s.*$//')
|
|
||||||
# Save hash to file
|
# Save hash to file
|
||||||
change_setting "WEBPASSWORD" "${hash}"
|
change_setting "WEBPASSWORD" "${hash}"
|
||||||
echo "New password set"
|
echo "New password set"
|
||||||
|
|
|
@ -105,7 +105,7 @@ if command -v apt-get &> /dev/null; then
|
||||||
phpVer="php5"
|
phpVer="php5"
|
||||||
fi
|
fi
|
||||||
# #########################################
|
# #########################################
|
||||||
INSTALLER_DEPS=(apt-utils debconf dhcpcd5 git ${iproute_pkg} whiptail)
|
INSTALLER_DEPS=(apt-utils dialog debconf dhcpcd5 git ${iproute_pkg} whiptail)
|
||||||
PIHOLE_DEPS=(bc cron curl dnsmasq dnsutils iputils-ping lsof netcat sudo unzip wget)
|
PIHOLE_DEPS=(bc cron curl dnsmasq dnsutils iputils-ping lsof netcat sudo unzip wget)
|
||||||
PIHOLE_WEB_DEPS=(lighttpd ${phpVer}-common ${phpVer}-cgi)
|
PIHOLE_WEB_DEPS=(lighttpd ${phpVer}-common ${phpVer}-cgi)
|
||||||
LIGHTTPD_USER="www-data"
|
LIGHTTPD_USER="www-data"
|
||||||
|
@ -136,7 +136,7 @@ elif command -v rpm &> /dev/null; then
|
||||||
UPDATE_PKG_CACHE=":"
|
UPDATE_PKG_CACHE=":"
|
||||||
PKG_INSTALL=(${PKG_MANAGER} install -y)
|
PKG_INSTALL=(${PKG_MANAGER} install -y)
|
||||||
PKG_COUNT="${PKG_MANAGER} check-update | egrep '(.i686|.x86|.noarch|.arm|.src)' | wc -l"
|
PKG_COUNT="${PKG_MANAGER} check-update | egrep '(.i686|.x86|.noarch|.arm|.src)' | wc -l"
|
||||||
INSTALLER_DEPS=(git iproute net-tools newt procps-ng)
|
INSTALLER_DEPS=(dialog git iproute net-tools newt procps-ng)
|
||||||
PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq findutils nmap-ncat sudo unzip wget)
|
PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq findutils nmap-ncat sudo unzip wget)
|
||||||
PIHOLE_WEB_DEPS=(lighttpd lighttpd-fastcgi php php-common php-cli)
|
PIHOLE_WEB_DEPS=(lighttpd lighttpd-fastcgi php php-common php-cli)
|
||||||
if ! grep -q 'Fedora' /etc/redhat-release; then
|
if ! grep -q 'Fedora' /etc/redhat-release; then
|
||||||
|
@ -1413,7 +1413,8 @@ main() {
|
||||||
pw=""
|
pw=""
|
||||||
if [[ $(grep 'WEBPASSWORD' -c /etc/pihole/setupVars.conf) == 0 ]] ; then
|
if [[ $(grep 'WEBPASSWORD' -c /etc/pihole/setupVars.conf) == 0 ]] ; then
|
||||||
pw=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8)
|
pw=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8)
|
||||||
/usr/local/bin/pihole -a -p "${pw}"
|
. /opt/pihole/webpage.sh
|
||||||
|
echo "WEBPASSWORD=$(HashPassword ${pw})" >> ${setupVars}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,7 @@ gravity_spinup() {
|
||||||
saveLocation=${piholeDir}/list.${i}.${domain}.${justDomainsExtension}
|
saveLocation=${piholeDir}/list.${i}.${domain}.${justDomainsExtension}
|
||||||
activeDomains[$i]=${saveLocation}
|
activeDomains[$i]=${saveLocation}
|
||||||
|
|
||||||
agent="Mozilla/10.0"
|
agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36"
|
||||||
|
|
||||||
# Use a case statement to download lists that need special cURL commands
|
# Use a case statement to download lists that need special cURL commands
|
||||||
# to complete properly and reset the user agent when required
|
# to complete properly and reset the user agent when required
|
||||||
|
|
Loading…
Reference in a new issue