@@ -66,6 +66,8 @@ RUN_DIRECTORY="/run"
66
66
LOG_DIRECTORY=" /var/log/pihole"
67
67
WEB_SERVER_LOG_DIRECTORY=" /var/log/lighttpd"
68
68
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"
69
71
HTML_DIRECTORY=" /var/www/html"
70
72
WEB_GIT_DIRECTORY=" ${HTML_DIRECTORY} /admin"
71
73
SHM_DIRECTORY=" /dev/shm"
@@ -77,6 +79,8 @@ PIHOLE_CRON_FILE="${CRON_D_DIRECTORY}/pihole"
77
79
78
80
WEB_SERVER_CONFIG_FILE=" ${WEB_SERVER_CONFIG_DIRECTORY} /lighttpd.conf"
79
81
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"
80
84
81
85
PIHOLE_INSTALL_LOG_FILE=" ${PIHOLE_DIRECTORY} /install.log"
82
86
PIHOLE_RAW_BLOCKLIST_FILES=" ${PIHOLE_DIRECTORY} /list.*"
@@ -140,6 +144,8 @@ PIHOLE_PROCESSES=( "lighttpd" "pihole-FTL" )
140
144
REQUIRED_FILES=(" ${PIHOLE_CRON_FILE} "
141
145
" ${WEB_SERVER_CONFIG_FILE} "
142
146
" ${WEB_SERVER_CUSTOM_CONFIG_FILE} "
147
+ " ${WEB_SERVER_PIHOLE_CONFIG_FILE_DEBIAN} "
148
+ " ${WEB_SERVER_PIHOLE_CONFIG_FILE_FEDORA} "
143
149
" ${PIHOLE_INSTALL_LOG_FILE} "
144
150
" ${PIHOLE_RAW_BLOCKLIST_FILES} "
145
151
" ${PIHOLE_LOCAL_HOSTS_FILE} "
@@ -977,6 +983,20 @@ ftl_full_status(){
977
983
fi
978
984
}
979
985
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
+
980
1000
make_array_from_file () {
981
1001
local filename=" ${1} "
982
1002
# The second argument can put a limit on how many line should be read from the file
@@ -1069,17 +1089,33 @@ dir_check() {
1069
1089
# check if exists first; if it does,
1070
1090
if ls " ${filename} " 1> /dev/null 2>&1 ; then
1071
1091
# do nothing
1072
- :
1092
+ true
1093
+ return
1073
1094
else
1074
1095
# Otherwise, show an error
1075
1096
log_write " ${COL_RED}${directory} does not exist.${COL_NC} "
1097
+ false
1098
+ return
1076
1099
fi
1077
1100
done
1078
1101
}
1079
1102
1080
1103
list_files_in_dir () {
1081
1104
# Set the first argument passed to this function as a named variable for better readability
1082
1105
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
+
1083
1119
# Store the files found in an array
1084
1120
mapfile -t files_found < <( ls " ${dir_to_parse} " )
1085
1121
# For each file in the array,
@@ -1095,11 +1131,8 @@ list_files_in_dir() {
1095
1131
[[ " ${dir_to_parse} /${each_file} " == " ${PIHOLE_WEB_SERVER_ACCESS_LOG_FILE} " ]] || \
1096
1132
[[ " ${dir_to_parse} /${each_file} " == " ${PIHOLE_LOG_GZIPS} " ]]; then
1097
1133
:
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} " ) "
1101
1134
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
1103
1136
log_write " \\ n${COL_GREEN} $( ls -lhd " ${dir_to_parse} " /" ${each_file} " ) ${COL_NC} "
1104
1137
make_array_from_file " ${dir_to_parse} /${each_file} "
1105
1138
else
@@ -1132,16 +1165,19 @@ show_content_of_files_in_dir() {
1132
1165
# Set a local variable for better readability
1133
1166
local directory=" ${1} "
1134
1167
# 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
1138
1172
}
1139
1173
1140
1174
show_content_of_pihole_files () {
1141
1175
# Show the content of the files in each of Pi-hole's folders
1142
1176
show_content_of_files_in_dir " ${PIHOLE_DIRECTORY} "
1143
1177
show_content_of_files_in_dir " ${DNSMASQ_D_DIRECTORY} "
1144
1178
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} "
1145
1181
show_content_of_files_in_dir " ${CRON_D_DIRECTORY} "
1146
1182
show_content_of_files_in_dir " ${WEB_SERVER_LOG_DIRECTORY} "
1147
1183
show_content_of_files_in_dir " ${LOG_DIRECTORY} "
@@ -1496,6 +1532,7 @@ check_name_resolution
1496
1532
check_dhcp_servers
1497
1533
process_status
1498
1534
ftl_full_status
1535
+ lighttpd_test_configuration
1499
1536
parse_setup_vars
1500
1537
check_x_headers
1501
1538
analyze_ftl_db
0 commit comments