Skip to main content

CWP: How to Auto Renew Let's Encrypt SSL Certificate for your server Hostname/FQDN on CWP7.admin

Check certificate expiry time to verify that renewal has worked:
# openssl x509 -noout -dates -in /etc/letsencrypt/live/host.datahead.biz/cert.pem 
notBefore=Jan 12 13:16:11 2019 GMT
notAfter=Apr 12 13:16:11 2019 GMT
Add the Cron job
# crontab -e
0 */12 * * * certbot renew --cert-name host.datahead.biz --renew-hook "systemctl restart httpd && systemctl restart cwpsrv" 
To test the renewal process, you can use the certbot --dry-run switch:
 # certbot renew --cert-name example.com --dry-run 
If there are no errors, it means that the renewal process was successful.

Check the log:
# tail -f /var/log/letsencrypt/letsencrypt.log

n5Z5MqkYhlMI3J1tPRTp1nEt9fyGspBOO05gi148Qasp+3N+svqKomoQglNoAxU=
-----END CERTIFICATE-----

2019-01-13 02:05:42,952:DEBUG:certbot.renewal:Dry run: skipping updating lineage at /etc/letsencrypt/live/host.datahead.biz
2019-01-13 02:05:42,954:DEBUG:certbot.updater:Skipping updaters in dry-run mode.
2019-01-13 02:05:42,955:DEBUG:certbot.renewal:no renewal failures
 

Helpful Link:
https://www.onepagezen.com/letsencrypt-auto-renew-certbot-apache/
https://community.letsencrypt.org/t/how-to-automatically-renew-certificates/4393/25
https://serverfault.com/questions/790772/cron-job-for-lets-encrypt-renewal
https://dev-notes.eu/2018/05/set-up-an-automatic-letsencrypt-renewal-cronjob/

Comments