Query flanagan.zeus.gent directly to avoid stale cached results

This commit is contained in:
Midgard 2024-10-29 14:37:11 +01:00
parent 2bb22b06b4
commit fa1f6d9945
Signed by: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -1,15 +1,6 @@
#!/bin/bash #!/bin/bash
# This program is free software: you can redistribute it and/or modify it under the terms of the FLANAGAN="5.75.131.131"
# GNU Affero General Public License as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
source members.sh source members.sh
NUMGRP="${#MEMBERS[@]}" NUMGRP="${#MEMBERS[@]}"
@ -39,8 +30,7 @@ total_ipv4=0
total_ipv6=0 total_ipv6=0
try_url() { try_url() {
# Use shell redirection to send all output to /dev/null because cURL is noisy at times, even with --silent curl --max-time 4 --connect-timeout 3 --resolve "*:443:$2" "$1" &>/dev/null
wget -O/dev/null --timeout 3 "$1" "$2" &>/dev/null
} }
# Begin list of groups # Begin list of groups
@ -50,20 +40,24 @@ for i in "${MEMBERS[@]}"; do
hostname="$i.user.zeus.gent" hostname="$i.user.zeus.gent"
https="https://$hostname" https="https://$hostname"
ipv4=""
ipv6=""
dns_ipv4=false dns_ipv4=false
dns_ipv6=false dns_ipv6=false
has_ipv4=false has_ipv4=false
has_ipv6=false has_ipv6=false
ipv4="<td>no</td>" ipv4_report="<td>no</td>"
ipv6="<td>no</td>" ipv6_report="<td>no</td>"
# Fetch DNS records # Fetch DNS records
dns="$(host "$hostname")" dns="$(host "$hostname" "$FLANAGAN")"
if printf '%s' "$dns" | grep -q "has address"; then if printf '%s' "$dns" | grep -q "has address"; then
dns_ipv4=true dns_ipv4=true
ipv4="$(printf '%s' "$dns" | sed -En '/has address/{s/^.* address //p;q}')"
fi fi
if printf '%s' "$dns" | grep -q "has IPv6 address"; then if printf '%s' "$dns" | grep -q "has IPv6 address"; then
dns_ipv6=true dns_ipv6=true
ipv6="$(printf '%s' "$dns" | sed -En '/has IPv6 address/{s/^.* address //p;q}')"
fi fi
if [ $dns_ipv4 = false -a $dns_ipv6 = false ]; then if [ $dns_ipv4 = false -a $dns_ipv6 = false ]; then
@ -71,11 +65,11 @@ for i in "${MEMBERS[@]}"; do
fi fi
# Try site over HTTPS # Try site over HTTPS
if try_url --inet4-only "$https"; then if [ $dns_ipv4 = true ] && try_url "$https" "$ipv4"; then
((total_ipv4 ++)) ((total_ipv4 ++))
has_ipv4=true has_ipv4=true
fi fi
if try_url --inet6-only "$https"; then if [ $dns_ipv6 = true ] && try_url "$https" "$ipv6"; then
((total_ipv6 ++)) ((total_ipv6 ++))
has_ipv6=true has_ipv6=true
fi fi
@ -85,14 +79,14 @@ for i in "${MEMBERS[@]}"; do
ssltest="<a href='https://www.ssllabs.com/ssltest/analyze.html?d=$hostname' class='httpstestlink'>analyze</a>" ssltest="<a href='https://www.ssllabs.com/ssltest/analyze.html?d=$hostname' class='httpstestlink'>analyze</a>"
fi fi
if [ "$has_ipv4" = true ]; then if [ "$has_ipv4" = true ]; then
ipv4="<td class='success'>yes</td>" ipv4_report="<td class='success'>yes</td>"
elif [ "$dns_ipv4" = true ]; then elif [ "$dns_ipv4" = true ]; then
ipv4="<td>no HTTPS</td>" ipv4_report="<td>no HTTPS</td>"
fi fi
if [ "$has_ipv6" = true ]; then if [ "$has_ipv6" = true ]; then
ipv6="<td class='success'>yes</td>" ipv6_report="<td class='success'>yes</td>"
elif [ "$dns_ipv6" = true ]; then elif [ "$dns_ipv6" = true ]; then
ipv6="<td>no HTTPS</td>" ipv6_report="<td>no HTTPS</td>"
fi fi
if [ "$has_ipv4" = true -o "$has_ipv6" = true ]; then if [ "$has_ipv4" = true -o "$has_ipv6" = true ]; then
@ -100,7 +94,7 @@ for i in "${MEMBERS[@]}"; do
else else
name="$i" name="$i"
fi fi
printf '\t<tr><td>%s</td>%s%s<td>%s</td></tr>\n' "$name" "$ipv4" "$ipv6" "$ssltest" >> "$TMPOUT" printf '\t<tr><td>%s</td>%s%s<td>%s</td></tr>\n' "$name" "$ipv4_report" "$ipv6_report" "$ssltest" >> "$TMPOUT"
done done
printf '</table>\n' >> "$TMPOUT" printf '</table>\n' >> "$TMPOUT"