Merge pull request #4812 from pi-hole/development

Pi-hole core 5.11.4
This commit is contained in:
Adam Warner 2022-07-10 13:52:38 +01:00 committed by GitHub
commit aefbe1f5b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 41 additions and 32 deletions

View file

@ -9,7 +9,7 @@
# Please see LICENSE file for your rights under this license. # Please see LICENSE file for your rights under this license.
readonly PI_HOLE_FILES_DIR="/etc/.pihole" readonly PI_HOLE_FILES_DIR="/etc/.pihole"
PH_TEST="true" SKIP_INSTALL="true"
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh" source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
# webInterfaceGitUrl set in basic-install.sh # webInterfaceGitUrl set in basic-install.sh

View file

@ -581,7 +581,7 @@ disk_usage() {
# Some lines of df might contain sensitive information like usernames and passwords. # Some lines of df might contain sensitive information like usernames and passwords.
# E.g. curlftpfs filesystems (https://www.looklinux.com/mount-ftp-share-on-linux-using-curlftps/) # E.g. curlftpfs filesystems (https://www.looklinux.com/mount-ftp-share-on-linux-using-curlftps/)
# We are not interested in those lines so we collect keyword, to remove them from the output # We are not interested in those lines so we collect keyword, to remove them from the output
# Additinal keywords can be added, separated by "|" # Additional keywords can be added, separated by "|"
hide="curlftpfs" hide="curlftpfs"
# only show those lines not containing a sensitive phrase # only show those lines not containing a sensitive phrase
@ -990,7 +990,7 @@ make_array_from_file() {
else else
# Otherwise, read the file line by line # Otherwise, read the file line by line
while IFS= read -r line;do while IFS= read -r line;do
# Othwerise, strip out comments and blank lines # Otherwise, strip out comments and blank lines
new_line=$(echo "${line}" | sed -e 's/^\s*#.*$//' -e '/^$/d') new_line=$(echo "${line}" | sed -e 's/^\s*#.*$//' -e '/^$/d')
# If the line still has content (a non-zero value) # If the line still has content (a non-zero value)
if [[ -n "${new_line}" ]]; then if [[ -n "${new_line}" ]]; then
@ -1048,7 +1048,7 @@ parse_file() {
} }
check_name_resolution() { check_name_resolution() {
# Check name resolution from localhost, Pi-hole's IP, and Google's name severs # Check name resolution from localhost, Pi-hole's IP, and Google's name servers
# using the function we created earlier # using the function we created earlier
dig_at 4 dig_at 4
dig_at 6 dig_at 6
@ -1309,7 +1309,7 @@ obfuscated_pihole_log() {
# If the variable does not a value (the current default behavior), so do not obfuscate anything # If the variable does not a value (the current default behavior), so do not obfuscate anything
if [[ -z ${OBFUSCATE} ]]; then if [[ -z ${OBFUSCATE} ]]; then
log_write " ${line}" log_write " ${line}"
# Othwerise, a flag was passed to this command to obfuscate domains in the log # Otherwise, a flag was passed to this command to obfuscate domains in the log
else else
# So first check if there are domains in the log that should be obfuscated # So first check if there are domains in the log that should be obfuscated
if [[ -n ${line_to_obfuscate} ]]; then if [[ -n ${line_to_obfuscate} ]]; then

View file

@ -49,7 +49,7 @@ echo /usr/local/bin/chronometer.sh >> /home/pi/.bashrc
# OR # OR
#$SUDO echo /usr/local/bin/chronometer.sh >> /etc/profile #$SUDO echo /usr/local/bin/chronometer.sh >> /etc/profile
# Set up the LCD screen based on Adafruits instuctions: # Set up the LCD screen based on Adafruits instructions:
# https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi/easy-install # https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi/easy-install
curl -SLs https://apt.adafruit.com/add-pin | bash curl -SLs https://apt.adafruit.com/add-pin | bash
apt-get -y install raspberrypi-bootloader apt-get -y install raspberrypi-bootloader

View file

@ -17,7 +17,7 @@ readonly PI_HOLE_GIT_URL="https://github.com/pi-hole/pi-hole.git"
readonly PI_HOLE_FILES_DIR="/etc/.pihole" readonly PI_HOLE_FILES_DIR="/etc/.pihole"
# shellcheck disable=SC2034 # shellcheck disable=SC2034
PH_TEST=true SKIP_INSTALL=true
# when --check-only is passed to this script, it will not perform the actual update # when --check-only is passed to this script, it will not perform the actual update
CHECK_ONLY=false CHECK_ONLY=false

View file

@ -24,8 +24,8 @@ readonly gravityDBfile="/etc/pihole/gravity.db"
# Source install script for ${setupVars}, ${PI_HOLE_BIN_DIR} and valid_ip() # Source install script for ${setupVars}, ${PI_HOLE_BIN_DIR} and valid_ip()
readonly PI_HOLE_FILES_DIR="/etc/.pihole" readonly PI_HOLE_FILES_DIR="/etc/.pihole"
# shellcheck disable=SC2034 # used in basic-install # shellcheck disable=SC2034 # used in basic-install to source the script without running it
PH_TEST="true" SKIP_INSTALL="true"
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh" source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
utilsfile="/opt/pihole/utils.sh" utilsfile="/opt/pihole/utils.sh"

View file

@ -395,7 +395,7 @@ select_rpm_php(){
exit exit
fi fi
# php-json is not required on CentOS 7 as it is already compiled into php # php-json is not required on CentOS 7 as it is already compiled into php
# verifiy via `php -m | grep json` # verify via `php -m | grep json`
if [[ $CURRENT_CENTOS_VERSION -eq 7 ]]; then if [[ $CURRENT_CENTOS_VERSION -eq 7 ]]; then
# create a temporary array as arrays are not designed for use as mutable data structures # create a temporary array as arrays are not designed for use as mutable data structures
CENTOS7_PIHOLE_WEB_DEPS=() CENTOS7_PIHOLE_WEB_DEPS=()
@ -912,7 +912,7 @@ It is also possible to use a DHCP reservation, but if you are going to do that,
# Ask for the IPv4 address # Ask for the IPv4 address
_staticIPv4Temp=$(dialog --no-shadow --keep-tite --output-fd 1 \ _staticIPv4Temp=$(dialog --no-shadow --keep-tite --output-fd 1 \
--cancer-label "Exit" \ --cancel-label "Exit" \
--ok-label "Continue" \ --ok-label "Continue" \
--backtitle "Calibrating network interface" \ --backtitle "Calibrating network interface" \
--title "IPv4 Address" \ --title "IPv4 Address" \
@ -1955,6 +1955,16 @@ installLogrotate() {
printf "\\n %b %s..." "${INFO}" "${str}" printf "\\n %b %s..." "${INFO}" "${str}"
if [[ -f ${target} ]]; then if [[ -f ${target} ]]; then
# Account for changed logfile paths from /var/log -> /var/log/pihole/ made in core v5.11.
if grep -q "/var/log/pihole.log" ${target} || grep -q "/var/log/pihole-FTL.log" ${target}; then
sed -i 's/\/var\/log\/pihole.log/\/var\/log\/pihole\/pihole.log/g' ${target}
sed -i 's/\/var\/log\/pihole-FTL.log/\/var\/log\/pihole\/FTL.log/g' ${target}
printf "\\n\\t%b Old log file paths updated in existing logrotate file. \\n" "${INFO}"
return 3
fi
printf "\\n\\t%b Existing logrotate file found. No changes made.\\n" "${INFO}" printf "\\n\\t%b Existing logrotate file found. No changes made.\\n" "${INFO}"
# Return value isn't that important, using 2 to indicate that it's not a fatal error but # Return value isn't that important, using 2 to indicate that it's not a fatal error but
# the function did not complete. # the function did not complete.
@ -2050,22 +2060,22 @@ checkSelinux() {
DEFAULT_SELINUX=$(awk -F= '/^SELINUX=/ {print $2}' /etc/selinux/config) DEFAULT_SELINUX=$(awk -F= '/^SELINUX=/ {print $2}' /etc/selinux/config)
case "${DEFAULT_SELINUX,,}" in case "${DEFAULT_SELINUX,,}" in
enforcing) enforcing)
printf " %b %bDefault SELinux: %s%b\\n" "${CROSS}" "${COL_RED}" "${DEFAULT_SELINUX}" "${COL_NC}" printf " %b %bDefault SELinux: %s%b\\n" "${CROSS}" "${COL_RED}" "${DEFAULT_SELINUX,,}" "${COL_NC}"
SELINUX_ENFORCING=1 SELINUX_ENFORCING=1
;; ;;
*) # 'permissive' and 'disabled' *) # 'permissive' and 'disabled'
printf " %b %bDefault SELinux: %s%b\\n" "${TICK}" "${COL_GREEN}" "${DEFAULT_SELINUX}" "${COL_NC}" printf " %b %bDefault SELinux: %s%b\\n" "${TICK}" "${COL_GREEN}" "${DEFAULT_SELINUX,,}" "${COL_NC}"
;; ;;
esac esac
# Check the current state of SELinux # Check the current state of SELinux
CURRENT_SELINUX=$(getenforce) CURRENT_SELINUX=$(getenforce)
case "${CURRENT_SELINUX,,}" in case "${CURRENT_SELINUX,,}" in
enforcing) enforcing)
printf " %b %bCurrent SELinux: %s%b\\n" "${CROSS}" "${COL_RED}" "${CURRENT_SELINUX}" "${COL_NC}" printf " %b %bCurrent SELinux: %s%b\\n" "${CROSS}" "${COL_RED}" "${CURRENT_SELINUX,,}" "${COL_NC}"
SELINUX_ENFORCING=1 SELINUX_ENFORCING=1
;; ;;
*) # 'permissive' and 'disabled' *) # 'permissive' and 'disabled'
printf " %b %bCurrent SELinux: %s%b\\n" "${TICK}" "${COL_GREEN}" "${CURRENT_SELINUX}" "${COL_NC}" printf " %b %bCurrent SELinux: %s%b\\n" "${TICK}" "${COL_GREEN}" "${CURRENT_SELINUX,,}" "${COL_NC}"
;; ;;
esac esac
else else
@ -2797,8 +2807,7 @@ main() {
stop_service pihole-FTL &> /dev/null stop_service pihole-FTL &> /dev/null
if [ ! -d /var/log/pihole/ ]; then if [ ! -d /var/log/pihole/ ]; then
mkdir /var/log/pihole/ mkdir -m 0755 /var/log/pihole/
chmod 0775 /var/log/pihole/
fi fi
# Special handling for pihole-FTL.log -> pihole/FTL.log # Special handling for pihole-FTL.log -> pihole/FTL.log
@ -2814,7 +2823,6 @@ main() {
# Remaining log files # Remaining log files
if [ -f /var/log/pihole.log ] && [ ! -L /var/log/pihole.log ]; then if [ -f /var/log/pihole.log ] && [ ! -L /var/log/pihole.log ]; then
mkdir -p /var/log/pihole/
mv /var/log/pihole*.* /var/log/pihole/ 2>/dev/null mv /var/log/pihole*.* /var/log/pihole/ 2>/dev/null
fi fi
@ -2866,6 +2874,7 @@ main() {
fi fi
} }
if [[ "${PH_TEST}" != true ]] ; then # allow to source this script without running it
if [[ "${SKIP_INSTALL}" != true ]] ; then
main "$@" main "$@"
fi fi

View file

@ -36,7 +36,7 @@ else
fi fi
readonly PI_HOLE_FILES_DIR="/etc/.pihole" readonly PI_HOLE_FILES_DIR="/etc/.pihole"
PH_TEST="true" SKIP_INSTALL="true"
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh" source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
# setupVars set in basic-install.sh # setupVars set in basic-install.sh
source "${setupVars}" source "${setupVars}"

View file

@ -13,7 +13,7 @@ ADD test/centos7.epel.override /etc/yum/pluginconf.d/fastestmirror.conf
RUN true && \ RUN true && \
chmod +x $SCRIPTDIR/* chmod +x $SCRIPTDIR/*
ENV PH_TEST true ENV SKIP_INSTALL true
ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net
#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \

View file

@ -12,7 +12,7 @@ ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR
RUN true && \ RUN true && \
chmod +x $SCRIPTDIR/* chmod +x $SCRIPTDIR/*
ENV PH_TEST true ENV SKIP_INSTALL true
ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net
#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \

View file

@ -11,7 +11,7 @@ ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR
RUN true && \ RUN true && \
chmod +x $SCRIPTDIR/* chmod +x $SCRIPTDIR/*
ENV PH_TEST true ENV SKIP_INSTALL true
ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net
#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \

View file

@ -11,7 +11,7 @@ ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR
RUN true && \ RUN true && \
chmod +x $SCRIPTDIR/* chmod +x $SCRIPTDIR/*
ENV PH_TEST true ENV SKIP_INSTALL true
ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net
#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \

View file

@ -12,7 +12,7 @@ ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR
RUN true && \ RUN true && \
chmod +x $SCRIPTDIR/* chmod +x $SCRIPTDIR/*
ENV PH_TEST true ENV SKIP_INSTALL true
ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net
#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \

View file

@ -11,7 +11,7 @@ ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR
RUN true && \ RUN true && \
chmod +x $SCRIPTDIR/* chmod +x $SCRIPTDIR/*
ENV PH_TEST true ENV SKIP_INSTALL true
ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net
#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \

View file

@ -12,7 +12,7 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN true && \ RUN true && \
chmod +x $SCRIPTDIR/* chmod +x $SCRIPTDIR/*
ENV PH_TEST true ENV SKIP_INSTALL true
ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net
#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \

View file

@ -12,7 +12,7 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN true && \ RUN true && \
chmod +x $SCRIPTDIR/* chmod +x $SCRIPTDIR/*
ENV PH_TEST true ENV SKIP_INSTALL true
ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net
#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \

View file

@ -12,7 +12,7 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN true && \ RUN true && \
chmod +x $SCRIPTDIR/* chmod +x $SCRIPTDIR/*
ENV PH_TEST true ENV SKIP_INSTALL true
ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net
#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \

View file

@ -30,7 +30,7 @@ def test_selinux_enforcing_exit(host):
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
checkSelinux checkSelinux
''') ''')
expected_stdout = cross_box + ' Current SELinux: Enforcing' expected_stdout = cross_box + ' Current SELinux: enforcing'
assert expected_stdout in check_selinux.stdout assert expected_stdout in check_selinux.stdout
expected_stdout = 'SELinux Enforcing detected, exiting installer' expected_stdout = 'SELinux Enforcing detected, exiting installer'
assert expected_stdout in check_selinux.stdout assert expected_stdout in check_selinux.stdout
@ -46,7 +46,7 @@ def test_selinux_permissive(host):
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
checkSelinux checkSelinux
''') ''')
expected_stdout = tick_box + ' Current SELinux: Permissive' expected_stdout = tick_box + ' Current SELinux: permissive'
assert expected_stdout in check_selinux.stdout assert expected_stdout in check_selinux.stdout
assert check_selinux.rc == 0 assert check_selinux.rc == 0
@ -60,6 +60,6 @@ def test_selinux_disabled(host):
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
checkSelinux checkSelinux
''') ''')
expected_stdout = tick_box + ' Current SELinux: Disabled' expected_stdout = tick_box + ' Current SELinux: disabled'
assert expected_stdout in check_selinux.stdout assert expected_stdout in check_selinux.stdout
assert check_selinux.rc == 0 assert check_selinux.rc == 0