Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wget and Curl stopped working with HTTPS. Wrongly complain about an expired certificate

Tags:

curl

ssl

wget

I have a script that runs every day on an Ubuntu 14.04 server. The script is a simple wget command that downloads a file from a remote server and saves it to the local file system:

wget https://example.com/resources/scripts/myfile.php -O myfile.php

It has worked fine for months until this morning when suddenly when I run it I get:

--2020-05-30 11:57:16--  https://example.com/resources/scripts/myfile.php
Resolving example.com (example.com)... xx.xx.xx.xx
Connecting to example.com (example.com)|xx.xx.xx.xx|:443... connected.
ERROR: cannot verify example.com's certificate, issued by ‘/C=GB/ST=Greater Manchester/L=Salford/O=Sectigo Limited/CN=Sectigo RSA Domain Validation Secure Server CA’:
  Issued certificate has expired.
To connect to example.com insecurely, use `--no-check-certificate'.

The SSL for the domain is valid and expires in Jan. 2022. Nothing has changed on that front. And yet somehow wget no longer sees that.

Here is another interesting fact. If I run this same exact command on an Ubuntu 18 box, it works like a charm without any complaints. This tells me something is wrong with my Ubuntu 14.04 machine.

Curl produces the same error:

curl https://example.com
curl: (60) SSL certificate problem: certificate has expired

This post suggest that the certificate bundle is out of date. I have downloaded the suggested PEM file and tried running wget with by specifying the --ca-certificate=cacert.pem option, but to no avail.

I have also tried running: apt install ca-certificates and update-ca-certificates, but that did not work either.

Again, everything works great on an Ubuntu 18 box, but not Ubuntu 14 or 16. Also why did it work fine until this morning when I know nobody has touched the box? Clearly something is out of date, but I can't seem to figure out how to fix it.

Does anybody have any suggestions?

like image 493
codemonkey Avatar asked May 30 '20 19:05

codemonkey


People also ask

How do you fix SSL certificate problem certificate has expired?

The only solution to this problem is to get your host to update the root certificate on your server. So, you need to contact your server host and ask them to insert a new cacert.

How do I bypass certificate error in wget?

simplified. guide insecurely, use `--no-check-certificate'. You can turn off check-certificate option in Wget to skip certificate check, thus ignoring SSL errors. This is equivalent to using insecure option for cURL.

What happens when https certificate expires?

After an SSL certificate expires, you will no longer be able to communicate over a secure, encrypted HTTPS connection. All the information will be transmitted in plaintext, leaving your (or your customer's) data exposed to any attacker listening in on the network.

Does cURL check SSL certificate?

libcurl performs peer SSL certificate verification by default. This is done by using a CA certificate store that the SSL library can use to make sure the peer's server certificate is valid.


1 Answers

I had the same error two days ago with Comodo Certificate and ubuntu 16.04. The problem was like say mrmuggles this https://support.sectigo.com/Com_KnowledgeDetailPage?Id=kA03l00000117LT.

I fixed with this steps:

  • vi /etc/ca-certificates.conf
  • Remove the line (or comment) specifying AddTrust_External_Root.crt
  • apt update && apt install ca-certificates
  • update-ca-certificates -f -v
like image 126
Ximix Avatar answered Sep 25 '22 09:09

Ximix