mirror of
https://github.com/pi-hole/pi-hole
synced 2025-01-10 16:10:56 +00:00
Daemon check for lighttpd and dnsmasq.
This commit is contained in:
parent
f169da8fd0
commit
13e488dace
@ -188,10 +188,21 @@ hostnameCheck() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lsof_parse() {
|
lsof_parse() {
|
||||||
# Dummy function for now
|
local user
|
||||||
echo "Dummy function lsof_parse got called"
|
local process
|
||||||
|
local match
|
||||||
|
|
||||||
|
user=$(echo ${1} | cut -f 3 -d ' ' | cut -c 2-)
|
||||||
|
process=$(echo ${1} | cut -f 2 -d ' ' | cut -c 2-)
|
||||||
|
if [[ ${2} -eq ${process} ]]; then
|
||||||
|
match="as required."
|
||||||
|
else
|
||||||
|
match="incorrectly."
|
||||||
|
fi
|
||||||
|
log_echo "by ${user} for ${process} ${match}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
daemon_check() {
|
daemon_check() {
|
||||||
# Check for daemon ${1} on port ${2}
|
# Check for daemon ${1} on port ${2}
|
||||||
header_write "Daemon Port Listening Information"
|
header_write "Daemon Port Listening Information"
|
||||||
@ -200,15 +211,19 @@ daemon_check() {
|
|||||||
local found_daemon=false
|
local found_daemon=false
|
||||||
local lsof_value
|
local lsof_value
|
||||||
|
|
||||||
|
|
||||||
if [[ ${IPV6_ENABLED} ]]; then
|
if [[ ${IPV6_ENABLED} ]]; then
|
||||||
lsof_value=$(lsof -i 6:${2} -F0cL) \
|
lsof_value=$(lsof -i 6:${2} -FcL | tr '\n' ' ') \
|
||||||
&& (echo "::: Port ${2} is in use on IPv6." && found_daemon=true && echo "${lsof_value}") \
|
&& (log_echo "Port ${2} is in use on IPv6" && (lsof_parse "${lsof_value}" "${1}" && found_daemon=true)) \
|
||||||
|| (echo "::: Port ${2} is not in use.")
|
|| (log_echo "Port ${2} is not in use on IPv6.")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
lsof_value=$(lsof -i 4:${2} -F0cL) \
|
lsof_value=$(lsof -i 4:${2} -FcL | tr '\n' ' ') \
|
||||||
&& (echo "::: Port ${2} is in use on IPv4." && found_daemon=true && echo "${lsof_value}") \
|
&& (log_echo "Port ${2} is in use on IPv4" && (lsof_parse "${lsof_value}" "${1}" && found_daemon=true)) \
|
||||||
|| (echo "::: Port ${2} is not in use.")
|
|| (log_echo "Port ${2} is not in use on IPv4.")
|
||||||
|
if [[ "${found_daemon}" == false ]]; then
|
||||||
|
log_echo "Missing required daemon ${1}, please check configuration."
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
testResolver() {
|
testResolver() {
|
||||||
|
Loading…
Reference in New Issue
Block a user