From 1f3db8b6025e6f81b41d7d134ac07559ea6d8ead Mon Sep 17 00:00:00 2001 From: WaLLy3K Date: Thu, 18 May 2017 12:43:17 +1000 Subject: [PATCH] Confirm Tricorder is online * Scan port 9998 to confirm the availability of "tricorder.pi-hole.net" * Exit codes for upload process --- pihole | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pihole b/pihole index 11369ae1..3db64172 100755 --- a/pihole +++ b/pihole @@ -305,9 +305,15 @@ tricorderFunc() { echo "Please do not call Tricorder directly." exit 1 fi + + if ! timeout 2 nc -z tricorder.pi-hole.net 9998 &> /dev/null; then + echo "Unable to connect to Pi-hole's Tricorder server." + exit 1 + fi if command -v openssl &> /dev/null; then openssl s_client -quiet -connect tricorder.pi-hole.net:9998 2> /dev/null < /dev/stdin + exit "$?" else echo "Your debug log will be transmitted unencrypted via plain-text" echo "There is a possibility that this could be intercepted by a third party" @@ -320,6 +326,7 @@ tricorderFunc() { done echo " " nc tricorder.pi-hole.net 9999 < /dev/stdin + exit "$?" fi }