Ajout de commandes pour nettoyer Let's Encrypt

Matthieu Patout 2 years ago
parent c547089631
commit 5aab3a5e25

@ -0,0 +1,10 @@
# Commands to clean domains managed by Let's Encrypt
# Removal of expired domains
cat /var/log/letsencrypt/letsencrypt.log | grep "Detail: DNS problem: NXDOMAIN looking up A for" > /tmp/failresolv.lst
cat /tmp/failresolv.lst | sed 's/^Detail: DNS problem: NXDOMAIN looking up A for //' | sed 's/ - check that a DNS record exists for this domain//' | sed 's/www.//' | sort | uniq > failresolv.lst
for domain in $(cat failresolv.lst); do certbot delete --cert-name $domain ; done
# Removing broken configurations
cat /var/log/letsencrypt/letsencrypt.log | grep "conf is broken" > /tmp/broken.lst
cat /tmp/broken.lst | sed 's/^.*\/etc\/letsencrypt\/renewal\///' | sed 's/.conf is broken. Skipping.//' | sort | uniq > broken.lst
for domain in $(cat broken.lst); do certbot delete --cert-name $domain ; done