Certbot renew stopped working at all

Solved it!
Had to do some debugging… -vvv flag did it.
This problem was missing access rights for apache user www-data on
/var/lib/letsencrypt (was: root:root, 750)
For all out there in the wild, here’s a short description what’s going on with letsencrypt’s http authentication:

  1. certbot aquires a one time challenge key from letsencrypt.org
  2. This key is placed in /var/lib/letsencrypt/http-challenges
  3. The apache config is temporarily rewritten by certbot to redirect corresponding requests to that dir.
  4. A graceful restart of apache is performed, so that the rewritten apache config gets activated.
  5. letsencrypt performs a http get on .well-known/acme-challenge/ witch gets redirected to /var/lib/letsencrypt/http-challenges/. That’s why apache needs read access to that path!
  6. The authentication get’s confirmed, the cert is updated and the original apache config get’s restored.

Solution (as root): cd /var/lib; chown -R root:www-data letsencrypt

2 Likes