Merge pull request #1464 from pi-hole/new/tricorder_option
Tricorder debug logs are now uploaded using SSL when `openssl` is available
This commit is contained in:
commit
703ff09a91
16
pihole
16
pihole
|
@ -94,7 +94,7 @@ scanList(){
|
||||||
|
|
||||||
queryFunc() {
|
queryFunc() {
|
||||||
method="${3}"
|
method="${3}"
|
||||||
|
|
||||||
# If domain contains non ASCII characters, convert domain to punycode if python exists
|
# If domain contains non ASCII characters, convert domain to punycode if python exists
|
||||||
# Cr: https://serverfault.com/a/335079
|
# Cr: https://serverfault.com/a/335079
|
||||||
if [ -z "${2}" ]; then
|
if [ -z "${2}" ]; then
|
||||||
|
@ -105,7 +105,7 @@ queryFunc() {
|
||||||
else
|
else
|
||||||
domain="${2}"
|
domain="${2}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Scan Whitelist, Blacklist and Wildcards
|
# Scan Whitelist, Blacklist and Wildcards
|
||||||
lists="/etc/pihole/whitelist.txt /etc/pihole/blacklist.txt $wildcardlist"
|
lists="/etc/pihole/whitelist.txt /etc/pihole/blacklist.txt $wildcardlist"
|
||||||
result=$(scanList ${domain} "${lists}" ${method})
|
result=$(scanList ${domain} "${lists}" ${method})
|
||||||
|
@ -122,7 +122,7 @@ queryFunc() {
|
||||||
[ -n "$method" ] && exact="exact "
|
[ -n "$method" ] && exact="exact "
|
||||||
echo "::: No ${exact}results found for ${domain}"
|
echo "::: No ${exact}results found for ${domain}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,6 +268,14 @@ piholeCheckoutFunc() {
|
||||||
checkout "$@"
|
checkout "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tricorderFunc() {
|
||||||
|
if command -v openssl &> /dev/null; then
|
||||||
|
openssl s_client -quiet -connect tricorder.pi-hole.net:9998 2> /dev/null < /dev/stdin
|
||||||
|
else
|
||||||
|
nc tricorder.pi-hole.net 9999 < /dev/stdin
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
helpFunc() {
|
helpFunc() {
|
||||||
cat << EOM
|
cat << EOM
|
||||||
::: Control all Pi-hole specific functions
|
::: Control all Pi-hole specific functions
|
||||||
|
@ -302,6 +310,7 @@ helpFunc() {
|
||||||
::: 'pihole disable 5m' - will disable blocking for 5 minutes
|
::: 'pihole disable 5m' - will disable blocking for 5 minutes
|
||||||
::: restartdns Restart dnsmasq
|
::: restartdns Restart dnsmasq
|
||||||
::: checkout Check out different branches
|
::: checkout Check out different branches
|
||||||
|
::: tricorder Upload log to Pi-hole's medical tricorder (uses SSL when possible)
|
||||||
EOM
|
EOM
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
@ -333,5 +342,6 @@ case "${1}" in
|
||||||
"-a" | "admin" ) webpageFunc "$@";;
|
"-a" | "admin" ) webpageFunc "$@";;
|
||||||
"-t" | "tail" ) tailFunc;;
|
"-t" | "tail" ) tailFunc;;
|
||||||
"checkout" ) piholeCheckoutFunc "$@";;
|
"checkout" ) piholeCheckoutFunc "$@";;
|
||||||
|
"tricorder" ) tricorderFunc;;
|
||||||
* ) helpFunc;;
|
* ) helpFunc;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in New Issue