mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Merge pull request #4304 from pi-hole/fix/tricorder
Fix pipe to pihole tricorder
This commit is contained in:
commit
a7ba55ffb0
2 changed files with 7 additions and 23 deletions
|
@ -1336,7 +1336,6 @@ curl_to_tricorder() {
|
||||||
# transmit he log via TLS and store the token returned in a variable
|
# transmit he log via TLS and store the token returned in a variable
|
||||||
tricorder_token=$(curl --silent --upload-file ${PIHOLE_DEBUG_LOG} https://tricorder.pi-hole.net)
|
tricorder_token=$(curl --silent --upload-file ${PIHOLE_DEBUG_LOG} https://tricorder.pi-hole.net)
|
||||||
if [ -z "${tricorder_token}" ]; then
|
if [ -z "${tricorder_token}" ]; then
|
||||||
# curl failed, fallback to nc
|
|
||||||
log_write " * ${COL_GREEN}curl${COL_NC} failed, contact Pi-hole support for assistance."
|
log_write " * ${COL_GREEN}curl${COL_NC} failed, contact Pi-hole support for assistance."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
29
pihole
29
pihole
|
@ -399,34 +399,19 @@ Branches:
|
||||||
}
|
}
|
||||||
|
|
||||||
tricorderFunc() {
|
tricorderFunc() {
|
||||||
|
local tricorder_token
|
||||||
if [[ ! -p "/dev/stdin" ]]; then
|
if [[ ! -p "/dev/stdin" ]]; then
|
||||||
echo -e " ${INFO} Please do not call Tricorder directly"
|
echo -e " ${INFO} Please do not call Tricorder directly"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! (echo > /dev/tcp/tricorder.pi-hole.net/9998) >/dev/null 2>&1; then
|
tricorder_token="$(curl --no-progress-meter --upload-file "-" https://tricorder.pi-hole.net/upload < /dev/stdin)"
|
||||||
echo -e " ${CROSS} Unable to connect to Pi-hole's Tricorder server"
|
if [ -z "${tricorder_token}" ]; then
|
||||||
exit 1
|
echo -e "${CROSS} uploading failed, contact Pi-hole support for assistance."
|
||||||
fi
|
exit 1
|
||||||
|
|
||||||
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 -e " ${INFO} ${COL_YELLOW}Security Notice${COL_NC}: ${COL_WHITE}openssl${COL_NC} is not installed
|
|
||||||
Your debug log will be transmitted unencrypted via plain-text
|
|
||||||
There is a possibility that this could be intercepted by a third party
|
|
||||||
If you wish to cancel, press Ctrl-C to exit within 10 seconds"
|
|
||||||
secs="10"
|
|
||||||
while [[ "$secs" -gt "0" ]]; do
|
|
||||||
echo -ne "."
|
|
||||||
sleep 1
|
|
||||||
: $((secs--))
|
|
||||||
done
|
|
||||||
echo " "
|
|
||||||
nc tricorder.pi-hole.net 9999 < /dev/stdin
|
|
||||||
exit "$?"
|
|
||||||
fi
|
fi
|
||||||
|
echo "Upload successful, your token is: ${COL_BLUE}${tricorder_token}${COL_NC}"
|
||||||
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCheckFunc() {
|
updateCheckFunc() {
|
||||||
|
|
Loading…
Reference in a new issue