Skip to content

Commit 741717a

Browse files
authored
Pi-hole core v5.15.4 (#5165)
2 parents c7ad711 + 2d13cd2 commit 741717a

File tree

6 files changed

+71
-25
lines changed

6 files changed

+71
-25
lines changed

advanced/Scripts/piholeDebug.sh

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ RUN_DIRECTORY="/run"
6666
LOG_DIRECTORY="/var/log/pihole"
6767
WEB_SERVER_LOG_DIRECTORY="/var/log/lighttpd"
6868
WEB_SERVER_CONFIG_DIRECTORY="/etc/lighttpd"
69+
WEB_SERVER_CONFIG_DIRECTORY_FEDORA="${WEB_SERVER_CONFIG_DIRECTORY}/conf.d"
70+
WEB_SERVER_CONFIG_DIRECTORY_DEBIAN="${WEB_SERVER_CONFIG_DIRECTORY}/conf-enabled"
6971
HTML_DIRECTORY="/var/www/html"
7072
WEB_GIT_DIRECTORY="${HTML_DIRECTORY}/admin"
7173
SHM_DIRECTORY="/dev/shm"
@@ -77,6 +79,8 @@ PIHOLE_CRON_FILE="${CRON_D_DIRECTORY}/pihole"
7779

7880
WEB_SERVER_CONFIG_FILE="${WEB_SERVER_CONFIG_DIRECTORY}/lighttpd.conf"
7981
WEB_SERVER_CUSTOM_CONFIG_FILE="${WEB_SERVER_CONFIG_DIRECTORY}/external.conf"
82+
WEB_SERVER_PIHOLE_CONFIG_FILE_DEBIAN="${WEB_SERVER_CONFIG_DIRECTORY_DEBIAN}/15-pihole-admin.conf"
83+
WEB_SERVER_PIHOLE_CONFIG_FILE_FEDORA="${WEB_SERVER_CONFIG_DIRECTORY_FEDORA}/pihole-admin.conf"
8084

8185
PIHOLE_INSTALL_LOG_FILE="${PIHOLE_DIRECTORY}/install.log"
8286
PIHOLE_RAW_BLOCKLIST_FILES="${PIHOLE_DIRECTORY}/list.*"
@@ -140,6 +144,8 @@ PIHOLE_PROCESSES=( "lighttpd" "pihole-FTL" )
140144
REQUIRED_FILES=("${PIHOLE_CRON_FILE}"
141145
"${WEB_SERVER_CONFIG_FILE}"
142146
"${WEB_SERVER_CUSTOM_CONFIG_FILE}"
147+
"${WEB_SERVER_PIHOLE_CONFIG_FILE_DEBIAN}"
148+
"${WEB_SERVER_PIHOLE_CONFIG_FILE_FEDORA}"
143149
"${PIHOLE_INSTALL_LOG_FILE}"
144150
"${PIHOLE_RAW_BLOCKLIST_FILES}"
145151
"${PIHOLE_LOCAL_HOSTS_FILE}"
@@ -977,6 +983,20 @@ ftl_full_status(){
977983
fi
978984
}
979985

986+
lighttpd_test_configuration(){
987+
# let lighttpd test it's own configuration
988+
local lighttpd_conf_test
989+
echo_current_diagnostic "Lighttpd configuration test"
990+
lighttpd_conf_test=$(lighttpd -tt -f /etc/lighttpd/lighttpd.conf)
991+
if [ -z "${lighttpd_conf_test}" ]; then
992+
# empty output
993+
log_write "${TICK} ${COL_GREEN}No error in lighttpd configuration${COL_NC}"
994+
else
995+
log_write "${CROSS} ${COL_RED}Error in lighttpd configuration${COL_NC}"
996+
log_write " ${lighttpd_conf_test}"
997+
fi
998+
}
999+
9801000
make_array_from_file() {
9811001
local filename="${1}"
9821002
# The second argument can put a limit on how many line should be read from the file
@@ -1069,17 +1089,33 @@ dir_check() {
10691089
# check if exists first; if it does,
10701090
if ls "${filename}" 1> /dev/null 2>&1; then
10711091
# do nothing
1072-
:
1092+
true
1093+
return
10731094
else
10741095
# Otherwise, show an error
10751096
log_write "${COL_RED}${directory} does not exist.${COL_NC}"
1097+
false
1098+
return
10761099
fi
10771100
done
10781101
}
10791102

10801103
list_files_in_dir() {
10811104
# Set the first argument passed to this function as a named variable for better readability
10821105
local dir_to_parse="${1}"
1106+
1107+
# show files and sizes of some directories, don't print the file content (yet)
1108+
if [[ "${dir_to_parse}" == "${SHM_DIRECTORY}" ]]; then
1109+
# SHM file - we do not want to see the content, but we want to see the files and their sizes
1110+
log_write "$(ls -lh "${dir_to_parse}/")"
1111+
elif [[ "${dir_to_parse}" == "${WEB_SERVER_CONFIG_DIRECTORY_FEDORA}" ]]; then
1112+
# we want to see all files files in /etc/lighttpd/conf.d
1113+
log_write "$(ls -lh "${dir_to_parse}/" 2> /dev/null )"
1114+
elif [[ "${dir_to_parse}" == "${WEB_SERVER_CONFIG_DIRECTORY_DEBIAN}" ]]; then
1115+
# we want to see all files files in /etc/lighttpd/conf.d
1116+
log_write "$(ls -lh "${dir_to_parse}/"/ 2> /dev/null )"
1117+
fi
1118+
10831119
# Store the files found in an array
10841120
mapfile -t files_found < <(ls "${dir_to_parse}")
10851121
# For each file in the array,
@@ -1095,11 +1131,8 @@ list_files_in_dir() {
10951131
[[ "${dir_to_parse}/${each_file}" == "${PIHOLE_WEB_SERVER_ACCESS_LOG_FILE}" ]] || \
10961132
[[ "${dir_to_parse}/${each_file}" == "${PIHOLE_LOG_GZIPS}" ]]; then
10971133
:
1098-
elif [[ "${dir_to_parse}" == "${SHM_DIRECTORY}" ]]; then
1099-
# SHM file - we do not want to see the content, but we want to see the files and their sizes
1100-
log_write "$(ls -lhd "${dir_to_parse}"/"${each_file}")"
11011134
elif [[ "${dir_to_parse}" == "${DNSMASQ_D_DIRECTORY}" ]]; then
1102-
# in case of the dnsmasq directory inlcuede all files in the debug output
1135+
# in case of the dnsmasq directory include all files in the debug output
11031136
log_write "\\n${COL_GREEN}$(ls -lhd "${dir_to_parse}"/"${each_file}")${COL_NC}"
11041137
make_array_from_file "${dir_to_parse}/${each_file}"
11051138
else
@@ -1132,16 +1165,19 @@ show_content_of_files_in_dir() {
11321165
# Set a local variable for better readability
11331166
local directory="${1}"
11341167
# Check if the directory exists
1135-
dir_check "${directory}"
1136-
# if it does, list the files in it
1137-
list_files_in_dir "${directory}"
1168+
if dir_check "${directory}"; then
1169+
# if it does, list the files in it
1170+
list_files_in_dir "${directory}"
1171+
fi
11381172
}
11391173

11401174
show_content_of_pihole_files() {
11411175
# Show the content of the files in each of Pi-hole's folders
11421176
show_content_of_files_in_dir "${PIHOLE_DIRECTORY}"
11431177
show_content_of_files_in_dir "${DNSMASQ_D_DIRECTORY}"
11441178
show_content_of_files_in_dir "${WEB_SERVER_CONFIG_DIRECTORY}"
1179+
show_content_of_files_in_dir "${WEB_SERVER_CONFIG_DIRECTORY_FEDORA}"
1180+
show_content_of_files_in_dir "${WEB_SERVER_CONFIG_DIRECTORY_DEBIAN}"
11451181
show_content_of_files_in_dir "${CRON_D_DIRECTORY}"
11461182
show_content_of_files_in_dir "${WEB_SERVER_LOG_DIRECTORY}"
11471183
show_content_of_files_in_dir "${LOG_DIRECTORY}"
@@ -1496,6 +1532,7 @@ check_name_resolution
14961532
check_dhcp_servers
14971533
process_status
14981534
ftl_full_status
1535+
lighttpd_test_configuration
14991536
parse_setup_vars
15001537
check_x_headers
15011538
analyze_ftl_db

advanced/lighttpd.conf.debian

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
# This file is copyright under the latest version of the EUPL.
88
# Please see LICENSE file for your rights under this license.
99

10-
###############################################################################
11-
# FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE. #
12-
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
13-
# #
14-
# CHANGES SHOULD BE MADE IN A SEPARATE CONFIG FILE: #
15-
# /etc/lighttpd/external.conf #
16-
###############################################################################
10+
###################################################################################################
11+
# IF THIS HEADER EXISTS, THE FILE WILL BE OVERWRITTEN BY PI-HOLE'S UPDATE PROCEDURE. #
12+
# ANY CHANGES MADE TO THIS FILE WILL BE LOST ON THE NEXT UPDATE UNLESS YOU REMOVE THIS HEADER #
13+
# #
14+
# ENSURE THAT YOU DO NOT REMOVE THE REQUIRED LINE: #
15+
# #
16+
# include "/etc/lighttpd/conf-enabled/*.conf" #
17+
# #
18+
###################################################################################################
1719

1820
server.modules = (
1921
"mod_access",

advanced/lighttpd.conf.fedora

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
# This file is copyright under the latest version of the EUPL.
88
# Please see LICENSE file for your rights under this license.
99

10-
###############################################################################
11-
# FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE. #
12-
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
13-
# #
14-
# CHANGES SHOULD BE MADE IN A SEPARATE CONFIG FILE: #
15-
# /etc/lighttpd/external.conf #
16-
###############################################################################
10+
###################################################################################################
11+
# IF THIS HEADER EXISTS, THE FILE WILL BE OVERWRITTEN BY PI-HOLE'S UPDATE PROCEDURE. #
12+
# ANY CHANGES MADE TO THIS FILE WILL BE LOST ON THE NEXT UPDATE UNLESS YOU REMOVE THIS HEADER #
13+
# #
14+
# ENSURE THAT YOU DO NOT REMOVE THE REQUIRED LINE: #
15+
# #
16+
# include "/etc/lighttpd/conf.d/pihole-admin.conf" #
17+
# #
18+
###################################################################################################
1719

1820
server.modules = (
1921
"mod_access",

automated install/basic-install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ installConfigs() {
14091409
mkdir -p /run/lighttpd
14101410
chown ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} /run/lighttpd
14111411

1412-
if grep -q -F "FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE" "${lighttpdConfig}"; then
1412+
if grep -q -F "FILE WILL BE OVERWRITTEN BY PI-HOLE" "${lighttpdConfig}"; then
14131413
# Attempt to preserve backwards compatibility with older versions
14141414
install -D -m 644 -T ${PI_HOLE_LOCAL_REPO}/advanced/${LIGHTTPD_CFG} "${lighttpdConfig}"
14151415
# Make the directories if they do not exist and set the owners

pihole

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
2424
source "${utilsfile}"
2525

2626
versionsfile="/etc/pihole/versions"
27-
source "${versionsfile}"
27+
if [ -f "${versionsfile}" ]; then
28+
# Only source versionsfile if the file exits
29+
# fixes a warning during installation where versionsfile does not exist yet
30+
# but gravity calls `pihole -status` and thereby sourcing the file
31+
source "${versionsfile}"
32+
fi
2833

2934
webpageFunc() {
3035
source "${PI_HOLE_SCRIPT_DIR}/webpage.sh"

test/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ docker-compose == 1.29.2
22
pytest == 7.2.1
33
pytest-xdist == 3.1.0
44
pytest-testinfra == 7.0.0
5-
tox == 4.3.5
5+
tox == 4.4.4
66

0 commit comments

Comments
 (0)