You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10 lines
804 B

# 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