Renewing LetsEncrypt Certs
This is a quick tip for you if you want to automatically renew your SSL certs with Lets Encrypt on Linux. I say Linux because this should work with any distro, but in my case, I’m using Ubuntu 20.
To begin, I am assuming you have already created your certs; you just want to make sure that before the magic 90 days are up, you renew them in a timely fashion automatically.
Also, I am using certbot
. Aren’t you? Why :-) ?
For this, we’re going to use the cron system to run a task every day which checks our certs and renews them if required. It’s not a problem running them daily either because the tool will just exit gracefully if there is no work to do.
Let’s start by editing the crontab file - that’s the file which contains all the scheduled commands that run, and when. As root
:
> crontab -e |
It may ask you which editor you want to use; choose nano if you aren’t sure.
Now add this:
0 5 * * * /usr/bin/certbot renew |
This will run the /usr/bin/certbot command at 5 am (on the dot, mind you!), every day, forever and ever.
Save the file using which ever editor’s command does that (nano it is control-o control-x)
That’s it. Sit back and rest assured that your certs will be renewed.
Hi! Did you find this useful or interesting? I have an email list coming soon, but in the meantime, if you ready anything you fancy chatting about, I would love to hear from you. You can contact me here or at stephen ‘at’ logicalmoon.com