Created
March 3, 2020 20:52
-
-
Save kaworu/2050b5913b56465e300cbfa257858ebd to your computer and use it in GitHub Desktop.
Check all installed certificate against Let's Encrypt CAA problem - see https://letsencrypt.org/caaproblem/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
SERIALURI=https://d4twhgtvn0ff5.cloudfront.net/caa-rechecking-incident-affected-serials.txt.gz | |
SERIALTMPFILE=/tmp/caa-rechecking-incident-affected-serials.txt | |
download_serials() { | |
curl "$SERIALURI" | gunzip | awk '{print $2}' > "$SERIALTMPFILE" | |
} | |
# EFF's Certbot | |
certbot_list_certificates() { | |
if command -v certbot 1>/dev/null 2>&1; then | |
certbot certificates 2>/dev/null | \ | |
awk -F: '/Certificate Path/ {sub(/fullchain\.pem$/, "cert.pem", $2); print $2}' | |
fi | |
} | |
# OpenBSD's acme-client | |
acme_client_list_certificates() { | |
if command -v acme-client 1>/dev/null 2>&1; then | |
acme-client -n 2>/dev/null | grep 'domain certificate' | cut -d \" -f 2 | |
fi | |
} | |
list_all_certificates() { | |
certbot_list_certificates | |
acme_client_list_certificates | |
} | |
print_serial() { | |
openssl x509 -noout -serial | awk '{sub(/^serial=/, "", $0); print tolower($0)}' | |
} | |
test -f "$SERIALTMPFILE" || download_serials | |
list_all_certificates | while read cert; do | |
serial=$(cat $cert | print_serial) | |
if grep "$serial" "$SERIALTMPFILE" >/dev/null; then | |
echo "${cert} is affected." | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MIT Licensed, if your computer burns because of this script it's not my fault.