Knowledgebase

Find frequently asked questions and setup guides by searching or by browsing the categories.

What the Error Means

A TLS client checks a chain: the server's certificate is signed by an intermediate certificate, and the intermediate is signed by a root certificate the client already trusts. The server should send its own certificate plus the intermediates; the client supplies the root from its local store. When a link is missing, OpenSSL-based clients report "unable to get local issuer certificate", verification error 20.

Where It Shows

  • curl: curl: (60) SSL certificate problem: unable to get local issuer certificate.
  • git over HTTPS: the same wording, because git uses curl for HTTPS.
  • pip and Python: CERTIFICATE_VERIFY_FAILED followed by the same reason.
  • Node.js: the error code UNABLE_TO_GET_ISSUER_CERT_LOCALLY.

Step 1: Test the Server's Chain

openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null

Look at the "Certificate chain" section. If it lists only one certificate, numbered 0, the server is not sending its intermediate. The end of the output shows the verify return code: 0 means the chain checked out, 20 is this error. More on the tool is in openssl s_client.

A strong hint: the site works in a browser but curl fails. Browsers can often fill in a missing intermediate on their own, from a cache or by downloading it, so they hide the problem.

Cause 1: The Server Does Not Send the Intermediate

Fix this on the server, not on every client. In Nginx, ssl_certificate must point to a file with the server certificate first and the intermediates after it. With Certbot that file is fullchain.pem, not cert.pem:

ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
sudo nginx -t && sudo systemctl reload nginx

In current Apache 2.4 releases, SSLCertificateFile can hold the full chain in the same way. With a certificate from a commercial CA, join the files yourself: cat example.com.crt intermediate.crt > fullchain.crt. Setup with Certbot is covered in Certbot Nginx.

Cause 2: The Client's CA Store Is Missing or Old

On Ubuntu and Debian:

sudo apt install --reinstall ca-certificates
sudo update-ca-certificates

On AlmaLinux and Rocky Linux:

sudo dnf reinstall ca-certificates
sudo update-ca-trust

Minimal container images often ship without CA certificates: install the ca-certificates package in the Dockerfile. Some tools carry their own list: Python's requests uses the certifi bundle, pip 24.2 and later checks the system store as well as its own copy of certifi, and Node.js has a built-in list that NODE_EXTRA_CA_CERTS can extend. Update the tool, or point it at the system bundle.

Cause 3: A Private CA or an Intercepting Proxy

Internal services signed by a company CA, and company proxies that inspect TLS traffic and re-sign it, need that CA in the trust store. Confirm the CA's fingerprint with whoever runs it, then add it. On Ubuntu and Debian the file must be in PEM format with a .crt extension:

sudo cp company-root-ca.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates

On AlmaLinux and Rocky Linux:

sudo cp company-root-ca.crt /etc/pki/ca-trust/source/anchors/
sudo update-ca-trust

Why Turning Verification Off Is Not a Fix

curl -k, git's http.sslVerify false, the Node.js setting that disables rejection, and pip's trusted-host option all make the error go away by accepting any certificate. Anyone between you and the server can then read and change the traffic, including passwords and tokens. Use them only for a single test, and never leave them in a script or a configuration file. The browser version of this problem is NET::ERR_CERT_AUTHORITY_INVALID.

Related Checks

Was this answer helpful?
Loading...