“Certificate has expired”: what it means and how to fix it

Every HTTPS certificate has a use-by date. When the date has passed, or your device thinks it has, the connection is refused to protect you from a possible impostor.

The messages you might see

WhereWording
Chrome / EdgeNET::ERR_CERT_DATE_INVALID, “Your connection is not private”
FirefoxSEC_ERROR_EXPIRED_CERTIFICATE
Node.js / npmCERT_HAS_EXPIRED, “certificate has expired”
Python (requests, urllib)SSLCertVerificationError: certificate verify failed: certificate has expired
curl / gitSSL certificate problem: certificate has expired

Step 1: find out whose problem it is

Open the same address on another device or network. If it fails everywhere, the site’s certificate has expired and only the site owner can fix it. If it works elsewhere, the problem is on your machine. To read the dates directly:

echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null \
  | openssl x509 -noout -dates -issuer -subject

notAfter is the expiry. If it is in the future but you still get the error, keep reading. (Certificates are just Base64-wrapped data; paste a PEM block into What is this? to see what it is.)

Step 2: the usual causes on your side

Step 3: if it’s your site

Why not just turn verification off?

curl -k, NODE_TLS_REJECT_UNAUTHORIZED=0, verify=False and git config http.sslVerify false do make the error go away, but they also accept a forged certificate from anyone in the middle, and they tend to stay in code long after the emergency. Use them for a one-off test at most, never in production.

Getting wrong version number instead? That error happens before any certificate is sent: see SSL wrong version number.

Seeing unable to get local issuer certificate or self signed certificate in certificate chain instead? The dates are fine but the chain can’t be followed to a root you trust: see unable to get local issuer certificate.

Related

Cloudflare Error 525 · Cloudflare Error 526 · TypeError: fetch failed (Node) · self-signed certificate in certificate chain · WebSocket connection failed (wss)

Questions

How do I check when an SSL certificate expires?

Run: echo | openssl s_client -connect example.com:443 -servername example.com | openssl x509 -noout -dates. The notAfter line is the expiry date. Browsers also show it when you click the padlock and open the certificate details.

Why does my computer say every certificate has expired?

Almost always a wrong system clock. If your device thinks it is a different year, every certificate looks invalid. Turn on automatic date and time and try again.

Is it safe to proceed past an expired certificate warning?

Not for anything involving passwords or payments. The warning means the browser can't confirm it is talking to the real site. On a site you own, renew the certificate instead.

Why does certbot say the certificate was renewed but the site still shows the old one?

The web server keeps the old certificate in memory until it reloads. Run sudo systemctl reload nginx (or apache2), and check its config points at the live fullchain file.

Published .

Try it

Related guides

Newest guides