Browsers not picking up new SSL certificate

I've never had an issue with renewing the certificates manually in the past. In fact, my initial issue was that the certs would renew but not get picked up by the browsers. This is the first time the cert didn't even renew.

I'm quite certain that the command you provided will work to renew my certs immediately, but then I will need to wait 60 days before I will know if they renew on their own. So I'm reluctant to go ahead and renew them without understanding 1) Why they did not renew on their own most recently and 2) Why, in the past, they renewed but did not get picked up by browsers.

What is the difference between this command,
sudo certbot certonly --cert-name vestasit.com --webroot -w /var/www/html -d "vestasit.com,www.vestasit.com" --deploy-hook "/usr/local/lsws/bin/lswsctrl reload" --force-renewal

which I used just over two months ago, and the command you have provided:

sudo certbot certonly --webroot -w /var/www/html -d "vestasit.com,www.vestasit.com" --deploy-hook "/usr/local/lsws/bin/lswsctrl reload"

aside from not using the --force-renewal?

2 Likes

I'm not 100% certain, but it is working now.

That's an easy one.
The "sudo certbot certonly ..." command will literally only get the updated/renewed cert.
You have to do something to let the web server know about that change and take the necessary action to being using the new cert (usually a reload or restart).
Adding "--deploy-hook "/usr/local/lsws/bin/lswsctrl reload"" should take care of that part for you.
Which was previously seen as a "renew-hook"

But for whatever reason that did NOT work for you.

If not these things... then the moon is in the right place today/now - LOL

You don't have to wait 60 days to test this out.
I'll address that on the next post.

3 Likes

You need to ensure that the cert was renewed with the full command shown above.
To confirm that, show

  1. the renewal config file
  2. the corresponding output of: sudo certbot certificates

[more to come... over]

2 Likes

Looks like it worked to renew the cert and has been picked up by browsers. Output:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Cert is due for renewal, auto-renewing...
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for vestasit.com
http-01 challenge for www.vestasit.com
Using the webroot path /var/www/html for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Running deploy-hook command: /usr/local/lsws/bin/lswsctrl reload
Output from lswsctrl:
[OK] Send SIGUSR1 to 24325
IMPORTANT NOTES:

  • Congratulations! Your certificate and chain have been saved at:
    /etc/letsencrypt/live/vestasit.com/fullchain.pem
    Your key file has been saved at:
    /etc/letsencrypt/live/vestasit.com/privkey.pem
    Your cert will expire on 2021-05-23. To obtain a new or tweaked
    version of this certificate in the future, simply run certbot
    again. To non-interactively renew all of your certificates, run
    "certbot renew"

So I'll check in 60 days and see if it auto renewed. I'll update this thread in 60 days either way.

Thanks to everyone for the help!

3 Likes

You'll want to try the following to ensure that your renewal configuration is correct:

sudo certbot renew --dry-run

If that works, try the following ONLY ONCE:

sudo certbot renew --force-renewal

If that works, the only likely reason your renewal would not go smoothly in 60 days is if you don't have an automated task functioning to run the following (usually once per day):

sudo certbot renew

4 Likes

This worked.

As did this.

So how would I know if I don't have an automated task functioning to run the renewal?

2 Likes

That depends on your system. @rg305 is usually much better at addressing this aspect than I. You around Rudy?

2 Likes

Try this:

sudo crontab -l

1 Like

cat /etc/letsencrypt/renewal/vestasit.com.conf

output:
#renew_before_expiry = 30 days
version = 0.31.0
archive_dir = /etc/letsencrypt/archive/vestasit.com
cert = /etc/letsencrypt/live/vestasit.com/cert.pem
privkey = /etc/letsencrypt/live/vestasit.com/privkey.pem
chain = /etc/letsencrypt/live/vestasit.com/chain.pem
fullchain = /etc/letsencrypt/live/vestasit.com/fullchain.pem
#Options used in the renewal process
[renewalparams]
account = [account number]
authenticator = webroot
server = https://acme-v02.api.letsencrypt.org/directory
renew_hook = /usr/local/lsws/bin/lswsctrl reload
[[webroot_map]]
vestasit.com = /var/www/html
www.vestasit.com = /var/www/html

I see that there is a webroot_map now, which wasn't there before!

Found the following certs:
Certificate Name: vestasit.com
Domains: vestasit.com www.vestasit.com
Expiry Date: 2021-05-23 23:10:50+00:00 (VALID: 89 days)
Certificate Path: /etc/letsencrypt/live/vestasit.com/fullchain.pem
Private Key Path: /etc/letsencrypt/live/vestasit.com/privkey.pem

2 Likes

Is that actually written like that in the file!? With the # ?

1 Like

0 */12 * * * root test -x /usr/bin/certbot -a ! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && cert
bot -q renew --deploy-hook "/usr/local/lsws/bin/lswsctrl restart"

This was something I edited a while back when I was trying to figure out why browsers were not picking up new certificates. There's more detail about it in a previous thread: SSL certificate renewed but browsers not updating with new certificate

2 Likes

# renew_before_expiry = 30 days

This is exactly how it looks in the file. Sorry, I edited it to remove the markdown heading. There is a space between the '#' and the 'renew...'screenshot-conf

2 Likes

Let's try this:

sudo crontab -e

That should let us edit the root crontab file.

Change the line you posted to this:

*/3 * * * * certbot renew -q


That should cause a renewal attempt to occur every 3 minutes for testing purposes. The certificate will only actually renew if it will expire within 30 days.


For reference:

* * * * * command to be executed
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)

We should be able to view a log of executions with this:

grep 'CRON.*' /var/log/syslog

1 Like

You only need the default (up to) "certbot -q renew" in the cron job.
All else is read from the renewal config file.
[which might explain why it wasn't doing things as expected]

Are you a glutton for (typing errors) punishment?
Just use:
*/3 in the minute field to do it every 3 minutes.
It resolves it like:
If [[absolute value of (current minute integer / 3)] * 3] = [current minute integer], then do it now.

3 Likes

I put a -q to suppress output.

Must... have... pain... :crazy_face: :dagger:

3 Likes

ok, so now when I sudo crontab -l

this is the only un-commented line:
*/3 * * * * certbot renew -q

2 Likes

Yep! Let's see what happens in the next 3 minutes.

Run the grep command I gave you in a couple minutes.

2 Likes

Here is your pain:
image

2 Likes

Clears the mind...

:exploding_head:

2 Likes

Has it been three minutes yet?...

Are we there yet?...

Can I go to the bathroom?...

2 Likes