Files
aios/ops/gitops-migration/check_cnnetmkt_ingress.sh
T

49 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
echo "== host =="
hostname
date -Is
echo "== /etc/hosts cnnetmkt =="
grep -nE 'cnnetmkt|gitea|aios' /etc/hosts || true
echo "== local resolver =="
for n in cnnetmkt.top g.cnnetmkt.top user.cnnetmkt.top portal.cnnetmkt.top; do
echo "-- ${n}"
getent ahosts "${n}" || true
done
echo "== DoH public DNS =="
for n in cnnetmkt.top g.cnnetmkt.top user.cnnetmkt.top portal.cnnetmkt.top; do
echo "-- ${n}"
curl -fsS --connect-timeout 10 --max-time 20 \
-H 'accept: application/dns-json' \
"https://cloudflare-dns.com/dns-query?name=${n}&type=A" || true
echo
done
echo "== local SNI HTTP/TLS =="
for h in cnnetmkt.top g.cnnetmkt.top user.cnnetmkt.top portal.cnnetmkt.top; do
echo "-- ${h} curl /"
rm -f /tmp/aios-ingress-body
curl -k -sS -D - -o /tmp/aios-ingress-body \
--resolve "${h}:443:127.0.0.1" \
"https://${h}/" | sed -n '1,20p' || true
sed -n '1,16p' /tmp/aios-ingress-body 2>/dev/null || true
echo "-- ${h} curl /git/"
curl -k -sS -D - -o /tmp/aios-ingress-body \
--resolve "${h}:443:127.0.0.1" \
"https://${h}/git/" | sed -n '1,12p' || true
grep -ao '<title>[^<]*' /tmp/aios-ingress-body 2>/dev/null | head -1 || true
echo "-- ${h} cert"
echo | openssl s_client -connect 127.0.0.1:443 -servername "${h}" 2>/dev/null \
| openssl x509 -noout -subject -issuer -dates -ext subjectAltName 2>/dev/null || true
done
echo "== certbot certificates =="
sudo certbot certificates || true
echo "== nginx matched config =="
sudo nginx -T 2>/dev/null | grep -nE 'server_name|ssl_certificate|location = /git|location /git|proxy_pass http://127.0.0.1:3000' || true