How To Renew Your Let's Encrypt SSL Certificate AUTOMATICALLY (with crontab)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone this is tony teaches tech i'm tony and in this video i'm going to show you how to keep your let's encrypt ssl certificate automatically up to date and pretty much never have to worry about ssl certificates for your website again now if you're not familiar typically the ssl certificate from let's encrypt only last three months now that means every three months you would have to log into your web server via ssh issue some commands to get a ssl certificate renewal and you know repeat that process every three months or you know four times a year now with the power of technology specifically a cron job we can have these commands executed on a regular basis so that whenever there is an ssl certificate renewal available it will automatically happen for us without us ever having to lift a finger so if that's something you're interested in let's take a look and get started with this tutorial okay so this is a once and done thing this is something that we're going to do today and you'll never have to do again hopefully so first thing you want to do is ssh into your server so i'm going to be working at my website called site2.xyz if you're on windows you can use putty to do the same exact thing that we're doing here and now i am logged into my server so the first thing i want to do is to show you how this command works and actually if you haven't seen my previous video i have installed a ssl certificate using lesson let's encrypt for this specific website so if you don't have that already you're going to have to do that but once you do that you'll have a let's encrypt ssl configuration file for your website whether that's wordpress or not doesn't matter so that's going to be if you're an engine if you're using nginx that'll be in the etc nginx directory in apache it'll be the ect apache 2 directory okay so right now we do have an ssl certificate installed for my website site 2 and you can see that here it is expiring on sunday november 15 2020. okay so that's important information because when we execute the cert bot renew command on the command line and we're just doing this for demonstration purposes it's going to come back and say that no renewals were attempted because like we just said the certificate expires november 15th now let's encrypt allows you to update your ssl certificate within 30 days of expiration so because today is august 17th we won't be able to execute the ssl renewal until 30 days before november 15th so right around october 15th or 16th um the same con like this will happen at an interval when we install it via a cron tab and that's what we'll do next but i just want to show you that when we do use cron tabs to run this on a regular basis we want to suppress this output we don't want this output to show up and you can do that with the dash n flag for non-interactive in the dash q flag for quiet so when we execute that same exact command that we just executed up here we won't see any of that output show up but we're still logging that to the back end and i know a lot of you won't care about this but if something does go wrong you can look at the logs in var log let's encrypt and then there's a let's encrypt log in there and you'll see if you go very all the way down to the bottom of this file just a few minutes ago at 22 52 34 we checked for the ssl certificate and we can confirm that that time matches up with our server time right here okay so now that we got all that out of the way how do we actually schedule this command to run on a regular basis you can do that very very easily with a cron tab and you can access your cron tabs by typing in cron tab dash e and it might prompt you for what editor you want to use in this case i'm using the vim basic editor and if you need a tutorial with vim i'll link that in the video as well so here we already have one existing cron tab if you're new to crown tabs i'll do my best to explain how they work so this looks kind of funky but if you want something to run every minute of every day it's going to look like this star star star star star okay but you can actually add other values to each of these columns repre represents a different i guess quantity of time so the first column here is the minute and then the hour and then the day the month and the week so we can technically execute our command every minute but i think that's overkill i'm going to say let's do it every week i'm going to pick 6 a.m on sunday so um for that we would say zero six so that's six a.m on sunday sunday is the first day of the week according to cron jobs so that would be the zeroth day monday would be one tuesday would be two and if for whatever reason you want to do it monday or sunday and monday you can do something like that but we're just gonna do every sunday at six a.m we're going to execute that command that we were looking at so it's cert bot renew dash n non-interactive dash q for quiet so we can save this if you're using vim escape shift colon wq and that will say crontab installing a new cron tab okay so um that's pretty much it for this tutorial if you guys have any questions please let me know in the comments below i'll be more than happy to help you out i know some of these topics especially this one is a little bit complicated because you're working on the command line but you know that's what my channel is all about i'm here to help you with ssl certificates website hosting email everything in between so uh yeah definitely don't hesitate and especially if you like this content consider subscribing to this channel and if you do i will see you in the next [Music] one [Music] you
Info
Channel: Tony Teaches Tech
Views: 30,579
Rating: undefined out of 5
Keywords: letsencrypt renew, renew lets encrypt, renew let's encrypt certificate certbot, renew let's encrypt certificate linux, letsencrypt auto renew, renew let's encrypt certificate ubuntu, certbot renew, how to renew letsencrypt certificate, let encrypt auto renew, lets encrypt cron, lets encrypt cronjob, lets encrypt crontab
Id: J6LTMsa5bPM
Channel Id: undefined
Length: 6min 56sec (416 seconds)
Published: Tue Aug 18 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.