mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 06:48:07 +00:00
Add pihole-admin.conf to debug log (#5144)
This commit is contained in:
commit
788e7cc777
@ -66,6 +66,8 @@ RUN_DIRECTORY="/run"
|
|||||||
LOG_DIRECTORY="/var/log/pihole"
|
LOG_DIRECTORY="/var/log/pihole"
|
||||||
WEB_SERVER_LOG_DIRECTORY="/var/log/lighttpd"
|
WEB_SERVER_LOG_DIRECTORY="/var/log/lighttpd"
|
||||||
WEB_SERVER_CONFIG_DIRECTORY="/etc/lighttpd"
|
WEB_SERVER_CONFIG_DIRECTORY="/etc/lighttpd"
|
||||||
|
WEB_SERVER_CONFIG_DIRECTORY_FEDORA="${WEB_SERVER_CONFIG_DIRECTORY}/conf.d"
|
||||||
|
WEB_SERVER_CONFIG_DIRECTORY_DEBIAN="${WEB_SERVER_CONFIG_DIRECTORY}/conf-enabled"
|
||||||
HTML_DIRECTORY="/var/www/html"
|
HTML_DIRECTORY="/var/www/html"
|
||||||
WEB_GIT_DIRECTORY="${HTML_DIRECTORY}/admin"
|
WEB_GIT_DIRECTORY="${HTML_DIRECTORY}/admin"
|
||||||
SHM_DIRECTORY="/dev/shm"
|
SHM_DIRECTORY="/dev/shm"
|
||||||
@ -77,6 +79,8 @@ PIHOLE_CRON_FILE="${CRON_D_DIRECTORY}/pihole"
|
|||||||
|
|
||||||
WEB_SERVER_CONFIG_FILE="${WEB_SERVER_CONFIG_DIRECTORY}/lighttpd.conf"
|
WEB_SERVER_CONFIG_FILE="${WEB_SERVER_CONFIG_DIRECTORY}/lighttpd.conf"
|
||||||
WEB_SERVER_CUSTOM_CONFIG_FILE="${WEB_SERVER_CONFIG_DIRECTORY}/external.conf"
|
WEB_SERVER_CUSTOM_CONFIG_FILE="${WEB_SERVER_CONFIG_DIRECTORY}/external.conf"
|
||||||
|
WEB_SERVER_PIHOLE_CONFIG_FILE_DEBIAN="${WEB_SERVER_CONFIG_DIRECTORY_DEBIAN}/15-pihole-admin.conf"
|
||||||
|
WEB_SERVER_PIHOLE_CONFIG_FILE_FEDORA="${WEB_SERVER_CONFIG_DIRECTORY_FEDORA}/pihole-admin.conf"
|
||||||
|
|
||||||
PIHOLE_INSTALL_LOG_FILE="${PIHOLE_DIRECTORY}/install.log"
|
PIHOLE_INSTALL_LOG_FILE="${PIHOLE_DIRECTORY}/install.log"
|
||||||
PIHOLE_RAW_BLOCKLIST_FILES="${PIHOLE_DIRECTORY}/list.*"
|
PIHOLE_RAW_BLOCKLIST_FILES="${PIHOLE_DIRECTORY}/list.*"
|
||||||
@ -140,6 +144,8 @@ PIHOLE_PROCESSES=( "lighttpd" "pihole-FTL" )
|
|||||||
REQUIRED_FILES=("${PIHOLE_CRON_FILE}"
|
REQUIRED_FILES=("${PIHOLE_CRON_FILE}"
|
||||||
"${WEB_SERVER_CONFIG_FILE}"
|
"${WEB_SERVER_CONFIG_FILE}"
|
||||||
"${WEB_SERVER_CUSTOM_CONFIG_FILE}"
|
"${WEB_SERVER_CUSTOM_CONFIG_FILE}"
|
||||||
|
"${WEB_SERVER_PIHOLE_CONFIG_FILE_DEBIAN}"
|
||||||
|
"${WEB_SERVER_PIHOLE_CONFIG_FILE_FEDORA}"
|
||||||
"${PIHOLE_INSTALL_LOG_FILE}"
|
"${PIHOLE_INSTALL_LOG_FILE}"
|
||||||
"${PIHOLE_RAW_BLOCKLIST_FILES}"
|
"${PIHOLE_RAW_BLOCKLIST_FILES}"
|
||||||
"${PIHOLE_LOCAL_HOSTS_FILE}"
|
"${PIHOLE_LOCAL_HOSTS_FILE}"
|
||||||
@ -977,6 +983,20 @@ ftl_full_status(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lighttpd_test_configuration(){
|
||||||
|
# let lighttpd test it's own configuration
|
||||||
|
local lighttpd_conf_test
|
||||||
|
echo_current_diagnostic "Lighttpd configuration test"
|
||||||
|
lighttpd_conf_test=$(lighttpd -tt -f /etc/lighttpd/lighttpd.conf)
|
||||||
|
if [ -z "${lighttpd_conf_test}" ]; then
|
||||||
|
# empty output
|
||||||
|
log_write "${TICK} ${COL_GREEN}No error in lighttpd configuration${COL_NC}"
|
||||||
|
else
|
||||||
|
log_write "${CROSS} ${COL_RED}Error in lighttpd configuration${COL_NC}"
|
||||||
|
log_write " ${lighttpd_conf_test}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
make_array_from_file() {
|
make_array_from_file() {
|
||||||
local filename="${1}"
|
local filename="${1}"
|
||||||
# The second argument can put a limit on how many line should be read from the file
|
# The second argument can put a limit on how many line should be read from the file
|
||||||
@ -1069,10 +1089,13 @@ dir_check() {
|
|||||||
# check if exists first; if it does,
|
# check if exists first; if it does,
|
||||||
if ls "${filename}" 1> /dev/null 2>&1; then
|
if ls "${filename}" 1> /dev/null 2>&1; then
|
||||||
# do nothing
|
# do nothing
|
||||||
:
|
true
|
||||||
|
return
|
||||||
else
|
else
|
||||||
# Otherwise, show an error
|
# Otherwise, show an error
|
||||||
log_write "${COL_RED}${directory} does not exist.${COL_NC}"
|
log_write "${COL_RED}${directory} does not exist.${COL_NC}"
|
||||||
|
false
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -1080,6 +1103,19 @@ dir_check() {
|
|||||||
list_files_in_dir() {
|
list_files_in_dir() {
|
||||||
# Set the first argument passed to this function as a named variable for better readability
|
# Set the first argument passed to this function as a named variable for better readability
|
||||||
local dir_to_parse="${1}"
|
local dir_to_parse="${1}"
|
||||||
|
|
||||||
|
# show files and sizes of some directories, don't print the file content (yet)
|
||||||
|
if [[ "${dir_to_parse}" == "${SHM_DIRECTORY}" ]]; then
|
||||||
|
# SHM file - we do not want to see the content, but we want to see the files and their sizes
|
||||||
|
log_write "$(ls -lh "${dir_to_parse}/")"
|
||||||
|
elif [[ "${dir_to_parse}" == "${WEB_SERVER_CONFIG_DIRECTORY_FEDORA}" ]]; then
|
||||||
|
# we want to see all files files in /etc/lighttpd/conf.d
|
||||||
|
log_write "$(ls -lh "${dir_to_parse}/" 2> /dev/null )"
|
||||||
|
elif [[ "${dir_to_parse}" == "${WEB_SERVER_CONFIG_DIRECTORY_DEBIAN}" ]]; then
|
||||||
|
# we want to see all files files in /etc/lighttpd/conf.d
|
||||||
|
log_write "$(ls -lh "${dir_to_parse}/"/ 2> /dev/null )"
|
||||||
|
fi
|
||||||
|
|
||||||
# Store the files found in an array
|
# Store the files found in an array
|
||||||
mapfile -t files_found < <(ls "${dir_to_parse}")
|
mapfile -t files_found < <(ls "${dir_to_parse}")
|
||||||
# For each file in the array,
|
# For each file in the array,
|
||||||
@ -1095,11 +1131,8 @@ list_files_in_dir() {
|
|||||||
[[ "${dir_to_parse}/${each_file}" == "${PIHOLE_WEB_SERVER_ACCESS_LOG_FILE}" ]] || \
|
[[ "${dir_to_parse}/${each_file}" == "${PIHOLE_WEB_SERVER_ACCESS_LOG_FILE}" ]] || \
|
||||||
[[ "${dir_to_parse}/${each_file}" == "${PIHOLE_LOG_GZIPS}" ]]; then
|
[[ "${dir_to_parse}/${each_file}" == "${PIHOLE_LOG_GZIPS}" ]]; then
|
||||||
:
|
:
|
||||||
elif [[ "${dir_to_parse}" == "${SHM_DIRECTORY}" ]]; then
|
|
||||||
# SHM file - we do not want to see the content, but we want to see the files and their sizes
|
|
||||||
log_write "$(ls -lhd "${dir_to_parse}"/"${each_file}")"
|
|
||||||
elif [[ "${dir_to_parse}" == "${DNSMASQ_D_DIRECTORY}" ]]; then
|
elif [[ "${dir_to_parse}" == "${DNSMASQ_D_DIRECTORY}" ]]; then
|
||||||
# in case of the dnsmasq directory inlcuede all files in the debug output
|
# in case of the dnsmasq directory include all files in the debug output
|
||||||
log_write "\\n${COL_GREEN}$(ls -lhd "${dir_to_parse}"/"${each_file}")${COL_NC}"
|
log_write "\\n${COL_GREEN}$(ls -lhd "${dir_to_parse}"/"${each_file}")${COL_NC}"
|
||||||
make_array_from_file "${dir_to_parse}/${each_file}"
|
make_array_from_file "${dir_to_parse}/${each_file}"
|
||||||
else
|
else
|
||||||
@ -1132,9 +1165,10 @@ show_content_of_files_in_dir() {
|
|||||||
# Set a local variable for better readability
|
# Set a local variable for better readability
|
||||||
local directory="${1}"
|
local directory="${1}"
|
||||||
# Check if the directory exists
|
# Check if the directory exists
|
||||||
dir_check "${directory}"
|
if dir_check "${directory}"; then
|
||||||
# if it does, list the files in it
|
# if it does, list the files in it
|
||||||
list_files_in_dir "${directory}"
|
list_files_in_dir "${directory}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
show_content_of_pihole_files() {
|
show_content_of_pihole_files() {
|
||||||
@ -1142,6 +1176,8 @@ show_content_of_pihole_files() {
|
|||||||
show_content_of_files_in_dir "${PIHOLE_DIRECTORY}"
|
show_content_of_files_in_dir "${PIHOLE_DIRECTORY}"
|
||||||
show_content_of_files_in_dir "${DNSMASQ_D_DIRECTORY}"
|
show_content_of_files_in_dir "${DNSMASQ_D_DIRECTORY}"
|
||||||
show_content_of_files_in_dir "${WEB_SERVER_CONFIG_DIRECTORY}"
|
show_content_of_files_in_dir "${WEB_SERVER_CONFIG_DIRECTORY}"
|
||||||
|
show_content_of_files_in_dir "${WEB_SERVER_CONFIG_DIRECTORY_FEDORA}"
|
||||||
|
show_content_of_files_in_dir "${WEB_SERVER_CONFIG_DIRECTORY_DEBIAN}"
|
||||||
show_content_of_files_in_dir "${CRON_D_DIRECTORY}"
|
show_content_of_files_in_dir "${CRON_D_DIRECTORY}"
|
||||||
show_content_of_files_in_dir "${WEB_SERVER_LOG_DIRECTORY}"
|
show_content_of_files_in_dir "${WEB_SERVER_LOG_DIRECTORY}"
|
||||||
show_content_of_files_in_dir "${LOG_DIRECTORY}"
|
show_content_of_files_in_dir "${LOG_DIRECTORY}"
|
||||||
@ -1496,6 +1532,7 @@ check_name_resolution
|
|||||||
check_dhcp_servers
|
check_dhcp_servers
|
||||||
process_status
|
process_status
|
||||||
ftl_full_status
|
ftl_full_status
|
||||||
|
lighttpd_test_configuration
|
||||||
parse_setup_vars
|
parse_setup_vars
|
||||||
check_x_headers
|
check_x_headers
|
||||||
analyze_ftl_db
|
analyze_ftl_db
|
||||||
|
Loading…
Reference in New Issue
Block a user