Skip to content

unable to get local issuer certificate: intermediate cert missing

Networkingtested on Ubuntu 24.04, curl 8.5.0, openssl 3.0.13, nginx 1.24.0

After a certificate swap the shop works fine in the browser, but curl reports unable to get local issuer certificate and a Go service certificate signed by unknown authority. Almost always the server sends only its own certificate without the intermediate CA – or the client does not know the root.

Symptom

sudo ip netns exec client curl -sS --cacert ~/ndbg/pki/root.crt --resolve shop.firma.lab:8443:10.2.0.10 https://shop.firma.lab:8443/
curl: (60) SSL certificate problem: unable to get local issuer certificate

Although curl gets the right root CA, verification fails. The browser does not complain – it caches intermediate certificates or fetches them (AIA). curl, Go, Java and Python do not.

Diagnosis

s_client shows which certificates the server sends, and the verification result.

sudo ip netns exec client openssl s_client -connect 10.2.0.10:8443 -servername shop.firma.lab -CAfile ~/ndbg/pki/root.crt -showcerts </dev/null 2>/dev/null \
  | grep -E '^ *[0-9] s:|Verify return code'
 0 s:CN = shop.firma.lab
Verify return code: 21 (unable to verify the first certificate)

Causes

only 0 s:The server sends the chain without the intermediate CA

The root signs the intermediate CA, the intermediate CA signs the server. Without the middle link no client that only has the root finds the path – openssl verify shows the same message.

openssl verify -CAfile root.crt shop.crt
CN = shop.firma.lab
error 20 at 0 depth lookup: unable to get local issuer certificate
error shop.crt: verification failed

root unknownThe client does not trust the issuing CA

With a company CA the system trust store does not know the root. Without --cacert or distribution into the trust store you get the same message.

sudo ip netns exec client curl -sS --resolve shop.firma.lab:8443:10.2.0.10 https://shop.firma.lab:8443/
curl: (60) SSL certificate problem: unable to get local issuer certificate

Fix

Serve the complete chain (server plus intermediate certificate, “fullchain”) in the web server and prove it with the same check.
sudo ip netns exec client openssl s_client -connect 10.2.0.10:8443 -servername shop.firma.lab -CAfile ~/ndbg/pki/root.crt -showcerts </dev/null 2>/dev/null \
  | grep -E '^ *[0-9] s:|Verify return code'
 0 s:CN = shop.firma.lab
 1 s:CN = Firma Issuing CA
Verify return code: 0 (ok)

Don't: Set curl -k or InsecureSkipVerify. That turns verification off instead of repairing the chain – “it works in the browser” proves nothing with TLS.

▶
Break it yourself and find it – free
Network debugging, Day 8: TLS – your own CA with an intermediate CA, SNI, expired certificates and mTLS.
Go to day 8 →

FAQ

Why does it work in the browser but not with curl?

Browsers remember intermediate certificates from earlier visits or fetch them via the address in the certificate (AIA). curl, Go, Java and Python only check what the server sends.

What is the same error called in other languages?

x509 certificate signed by unknown authority in Go, PKIX path building failed in Java, SSL CERTIFICATE_VERIFY_FAILED in Python – usually the same causes.

Related error patterns

More