Tighten IP test reponse to user.

This commit is contained in:
Dan Schaper 2016-10-26 11:38:19 -07:00
parent 4269626f5d
commit 98db002770

View file

@ -124,27 +124,27 @@ ip_check() {
echo "::: Locating default gateway and checking connectivity" echo "::: Locating default gateway and checking connectivity"
local IPv4_def_gateway=$(ip r | grep default | cut -d ' ' -f 3) local IPv4_def_gateway=$(ip r | grep default | cut -d ' ' -f 3)
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
echo "::: Pinging default IPv4 gateway..." echo -n "::: Pinging default IPv4 gateway: "
local IPv4_def_gateway_check="$(ping -q -w 3 -c 3 -n "${IPv4_def_gateway}" | tail -n3)" \ local IPv4_def_gateway_check="$(ping -q -w 3 -c 3 -n "${IPv4_def_gateway}" | tail -n3)" \
&& echo "::: IPv4 Default Gateway Responded." || echo "::: IPv4 Default Gateway did not respond." && echo "Gateway responded." || echo "Gateway did not respond."
log_write "${IPv4_def_gateway_check}" log_write "${IPv4_def_gateway_check}"
echo "::: Pinging Internet via IPv4..." echo -n "::: Pinging Internet via IPv4: "
local IPv4_inet_check="$(ping -q -w 5 -c 3 -n 8.8.8.8 | tail -n3)" \ local IPv4_inet_check="$(ping -q -w 5 -c 3 -n 8.8.8.8 | tail -n3)" \
&& echo "::: IPv4 Internet query responded." || echo "::: IPv4 Internet query did not respond." && echo "Query responded." || echo "Query did not respond."
log_write "${IPv4_inet_check}" log_write "${IPv4_inet_check}"
fi fi
local IPv6_def_gateway=$(ip -6 r | grep default | cut -d ' ' -f 3) local IPv6_def_gateway=$(ip -6 r | grep default | cut -d ' ' -f 3)
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
echo "::: Pinging default IPv6 gateway..." echo -n "::: Pinging default IPv6 gateway: "
local IPv6_def_gateway_check="$(ping6 -q -W 3 -c 3 -n "${IPv6_def_gateway}" -I "${IPv6_interface}"| tail -n3)" \ local IPv6_def_gateway_check="$(ping6 -q -W 3 -c 3 -n "${IPv6_def_gateway}" -I "${IPv6_interface}"| tail -n3)" \
&& echo "::: IPv6 Default Gateway Responded." || echo "::: IPv6 Default Gateway did not respond." && echo "Gateway Responded." || echo "Gateway did not respond."
log_write "${IPv6_def_gateway_check}" log_write "${IPv6_def_gateway_check}"
echo "::: Pinging Internet via IPv6..." echo -n "::: Pinging Internet via IPv6: "
local IPv6_inet_check=$(ping6 -q -W 3 -c 3 -n 2001:4860:4860::8888 -I "${IPv6_interface}"| tail -n3) \ local IPv6_inet_check=$(ping6 -q -W 3 -c 3 -n 2001:4860:4860::8888 -I "${IPv6_interface}"| tail -n3) \
&& echo "::: IPv6 Internet query responded." || echo "::: IPv6 Internet query did not respond." && echo "Query responded." || echo "Query did not respond."
else else
IPv6_inet_check="No IPv6 Gateway Detected" IPv6_inet_check="No IPv6 Gateway Detected"
fi fi
@ -172,14 +172,18 @@ hostnameCheck() {
fi fi
} }
portCheck() { daemon_check() {
header_write "Open Port Information" # Check for daemon ${1} on port ${2}
header_write "Daemon Port Listening Information"
echo "::: Detecting local server port 80 and 53 processes." echo "::: Checking port ${2} for ${1} listener."
local found_daemon=false
lsof -i :80 >> ${DEBUG_LOG} local ret_Val=$(lsof -i :${2} -FcL) \
lsof -i :53 >> ${DEBUG_LOG} && (echo "::: Port ${2} is in use." && found_daemon=true) \
log_write "" || (echo "::: Port ${2} is not in use.")
if [[ found_daemon ]]; then
log_echo "Temporary holding place for evaluation code ${ret_Val}"
fi
} }
testResolver() { testResolver() {
@ -289,7 +293,8 @@ files_check "setupVars.conf"
distro_check distro_check
ip_check ip_check
hostnameCheck hostnameCheck
portCheck daemon_check lighttpd http
daemon_check dnsmasq domain
checkProcesses checkProcesses
testResolver testResolver
debugLighttpd debugLighttpd