Initial commit

This commit is contained in:
2026-03-27 10:49:02 +01:00
commit 340b1da992
2 changed files with 276 additions and 0 deletions

35
certificate_check.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/bash
readarray -t domain_list < domain_list.txt
for raw_domain in "${domain_list[@]}"; do
domain=${raw_domain%$'\r'}
if [[ -z "$domain" ]]; then
continue
fi
certificate=$(
openssl s_client \
-connect "${domain}:443" \
-servername "$domain" \
-showcerts \
</dev/null 2>/dev/null |
sed -n '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/p' |
sed -n '1,/-----END CERTIFICATE-----/p'
)
if [[ -z "$certificate" ]]; then
echo "Checking domain: $domain - Could not retrieve certificate"
continue
fi
expiration_date=$(printf '%s\n' "$certificate" | openssl x509 -noout -enddate 2>/dev/null | cut -d= -f2)
if [[ -n "$expiration_date" ]]; then
echo "Checking domain: $domain - $expiration_date"
echo ""
else
echo "Checking domain: $domain - Could not parse certificate"
fi
done