Browse Source

Ajout de commandes pour nettoyer Let's Encrypt

master
Matthieu Patout 8 months ago
parent
commit
5aab3a5e25
  1. 10
      le-cleaning.sh

10
le-cleaning.sh

@ -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
Loading…
Cancel
Save