Hello Everyone,
I'd like to discuss my problem with you and I have been facing this on multiple servers.
Certificate Renewal is being missed and all the configurations are correct, and when I run the dry run test, it runs successfully, however when I trace the let's encrypt log I get no renewal, and the certificate is due to renewal as it's 30 days before expiration date.
The second renewal done successfully which is crt.sh | 132764979, while the third renewal was not attempted crt.sh | 182708178, so I had to renew the certificate myself manually after the expiration of the certificate.
Processing /etc/letsencrypt/renewal/jobs.espace-technologies.com.conf
** DRY RUN: simulating 'certbot renew' close to cert expiry
** (The test certificates below have not been saved.)
Congratulations, all renewals succeeded. The following certs have been renewed:
/etc/letsencrypt/live/jobs.espace-technologies.com/fullchain.pem (success)
** DRY RUN: simulating 'certbot renew' close to cert expiry
** (The test certificates above have not been saved.)
First note is that it’s recommended to run renewal twice daily, no weekly. Second, if it’s not actually running, you should probably try and figure out why your cron isn’t executing commands as expected. What’s the August 9th logs? Are those also only manual renewals? You should see log entries from certbot every time it runs, indicating that a renewal was or was not attempted and the outcome if it was attempted.
I would try adding webroot to the renewal process:
/bin/certbot renew --webroot -w /var/www/html --post-hook “nginx -s reload” >> /var/log/letsencrypt-renew.log
Adding --webroot is unnecessary and not best practice in general. Renewal uses the same authorization method in use for issuance - this would be webroot in this case.
Webroot can follow https redirects - that’s not an issue.
Something has changed since the last working renewal.
Maybe the redirections.
Maybe the webroot folder was moved.
Maybe the acme-challenge alias was changed.
…
I want to point out by way of agreement with this concern that certbot renew is designed to work in environments where you have perhaps dozens of different certificates which are obtained by all different authentication methods. In that case, specifying authentication information related to just one of the certificates would be a recipe for disaster (failed renewals) because it would be used for various certificates that it didn't actually apply to.
The intended design is indeed to specify the authentication parameters with certonly or run, and then have Certbot remember them for the future and supply them automatically with renew. If you need to change them, the recommended way is via a single (potentially --force-renewal) renewal with certonly and appropriate parameters, which should be saved.
according to these configuration, we want to redirect the root location to go to espace.com.eg/jobs, but when it requires .well-known locations, it servers over https.
The webroot location wasn't changed, and the as you can see the configurations are correct.
Yes do those a --dry-run test by me, just to make sure the configuration was right, and when I traced the log /var/log/letsencrypt/letsencrypt.log, the renewal dry-run was successful.
I'll try to update my cronjob with this, but the execution of the renewal cron during the 30 days before expiration wasn't unreasonable, that's why I'm trying to debug the environment, and I can see all the configurations are right till now.
When /.well-known is requested by the acme challenge, it's created, and I can access secret.txt, so I think the root is fine
I have another question, If the post-hook did not successfully run, will the certificate be issued ?
as I got this in the log file
Congratulations, all renewals succeeded. The following certs have been renewed:
/etc/letsencrypt/live/jobs.espace-technologies.com/fullchain.pem (success)
Unable to find post-hook command nginx in the PATH.
(PATH is /usr/bin:/bin)