Skip to content
ecdsa.com
GNU Wget built with GnuTLS (Debian)curl

Error message

ERROR: The certificate of 'api.example.com' has expired.

GnuTLS builds of wget print this line after the generic "ERROR: The certificate of '<host>' is not trusted." and before "The certificate has expired". OpenSSL builds print "ERROR: cannot verify <host>'s certificate, issued by '…':" followed by "Issued certificate has expired."

What it means

The server's certificate (or another certificate in its chain) is past its notAfter date according to this machine's clock, and wget's GnuTLS backend refuses the connection. The CA is trusted; only the validity period fails. wget exits with status 5.

Why it happens

How to fix it

  1. 1.

    Check the dates of the certificate actually served

    Compare notAfter with the current UTC time. If the served certificate is old but a newer one exists, the server has not picked it up.

    bash
    echo | openssl s_client -connect api.example.com:443 -servername api.example.com 2>/dev/null \
      | openssl x509 -noout -subject -startdate -enddate
  2. 2.

    Renew and reload

    Renew through your ACME client or CA, then reload every service that terminates TLS for the name; automate both steps so the next renewal does not depend on someone remembering.

    bash
    sudo certbot renew --cert-name api.example.com
    sudo systemctl reload nginx     # or apache2 / haproxy: reload whatever terminates TLS
  3. 3.

    Fix the client's time

    If the certificate is valid when checked from another machine, enable NTP on the failing one.

    bash
    date -u
    timedatectl status
    sudo timedatectl set-ntp true

Related errors

Browse the full signature error database