Two causes behind one message#
OpenSSL returns X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY with the text unable to get local issuer certificate when the issuer of an untrusted certificate cannot be found. A close relative, unable to verify the first certificate (X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE), appears when the chain holds only one certificate that is not self-signed. curl prints these after SSL certificate problem:, Node.js reports the codes UNABLE_TO_GET_ISSUER_CERT_LOCALLY and UNABLE_TO_VERIFY_LEAF_SIGNATURE, and Go reports x509: certificate signed by unknown authority. OpenSSL verify error codes · curl OpenSSL backend · Node.js TLS error codes · Go x509 verify
Two different faults produce it:
- The server omits the intermediate. The dependency serves its leaf without the intermediate CA that signed it. Your client has the root, but no certificate connects the leaf to it.
- The client lacks the root. The server sends a complete chain, but the root it ends at is not in your client's store. This is common with a private or corporate CA, a new public root an old store has not added, or a client pointed at a custom CA file that replaces the default store.
Why browsers work and your client does not#
A certificate can carry an Authority Information Access extension whose caIssuers entry points to a URL for the issuing CA's certificate. RFC 5280 describes it as an aid to building a path to a trusted point. Chromium's certificate verifier has an issuer source that retrieves issuers from these AIA URLs, so a browser can repair a chain the server left incomplete. OpenSSL's path building uses the certificates the server sent and its trust store, and the OpenSSL verification documentation describes no AIA fetch. So curl, Python, Node.js and most service clients fail on a chain that a browser accepts. RFC 5280 Authority Information Access · Chromium AIA issuer source · OpenSSL path building
"It works in the browser" therefore does not clear the server. Check what the server sends.
Count what the server sends#
From the failing host or container, print the certificates the server sends, in the order it sends them. -showcerts shows that list; it is not a verified chain. openssl s_client
openssl s_client -connect payments.example.com:443 -servername payments.example.com \
-showcerts </dev/null 2>/dev/null \
| awk '/BEGIN CERTIFICATE/{n++; p=1} p{print > ("chain-" n ".pem")} /END CERTIFICATE/{p=0}'
for f in chain-*.pem; do
echo "== $f"
openssl x509 -in "$f" -noout -subject -issuer
done
Run it in a scratch directory, since awk writes the files there. Read the subject and issuer of each certificate. In a complete chain, each issuer is the next subject, and the last certificate's issuer is a root you expect to trust.
Next, find the AIA URL in the leaf and the store your OpenSSL uses by default. openssl version -d prints the OPENSSLDIR setting; the default file and directory sit under it unless SSL_CERT_FILE or SSL_CERT_DIR override them. openssl x509 -ext · openssl version · OpenSSL environment variables
openssl x509 -in chain-1.pem -noout -ext authorityInfoAccess
openssl version -d
env | grep -E '^SSL_CERT_(FILE|DIR)='
Then verify the leaf against an explicit store, with the sent intermediates as untrusted helpers. This reads files only. openssl verify
cat chain-[2-9].pem > sent-intermediates.pem 2>/dev/null
openssl verify -show_chain -CAfile /etc/ssl/certs/ca-certificates.crt \
-untrusted sent-intermediates.pem chain-1.pem
The path /etc/ssl/certs/ca-certificates.crt is the Debian and Ubuntu bundle; other distributions use other paths. If the server sent only the leaf, sent-intermediates.pem is empty and the verify fails for that reason.
Read the result#
| Server sends | Last issuer in your store? | Points to |
|---|---|---|
| Leaf only | n/a | Server omits the intermediate |
| Leaf plus intermediates | Yes, yet the service fails | Service uses another store |
| Leaf plus intermediates | No | Client store lacks the root |
| Leaf plus intermediates | Root is private | Private CA not installed |
If s_client on the host verifies but the service in its container fails, the container has another store: container image CA bundle. Node.js can use a bundled snapshot of the Mozilla store, chosen at build time, instead of the system store; --use-openssl-ca and --use-system-ca switch to the system's, and NODE_EXTRA_CA_CERTS adds certificates. Java uses its own cacerts truststore unless javax.net.ssl.trustStore names another. Node.js CA store options · JSSE default truststore
A worked example with two outcomes#
This example is illustrative. After a certificate renewal on payments.example.com, checkout logs unable to get local issuer certificate. Engineers open the payments page in a browser and it loads.
In the first outcome, the chain printout has one file, chain-1.pem, issued by Example Issuing CA 3. Its AIA extension names http://ca.example.com/issuing-ca-3.cer. The renewal installed the new leaf without the new intermediate. Browsers fetched the intermediate from the AIA URL; checkout did not. The payments team adds the intermediate to the served chain, and nothing changes in checkout.
In the second outcome, the server sends the leaf and Example Issuing CA 3, whose issuer is Example Internal Root 2. That root was distributed to laptops by device management, which is why the browser works. checkout's image trusts only public roots. openssl verify against the image's bundle fails; against a file holding Example Internal Root 2 it succeeds. The fix belongs in the checkout image or its configuration.
Limits#
openssl verify uses your OpenSSL build and the file you name. A service that pins its own CA file, uses a language runtime's bundle or runs a different library can still fail where this passes. Read the service's TLS configuration for a CA file setting before concluding.
Different servers behind one name can send different chains during a rollout. Repeat the printout several times, or against each address the name resolves to. A chain that contains an expired certificate fails with another message: which certificate expired. For the other layers a dependency call can fail at, see the hub for runtime dependency failures.
Questions#
Should the server send the root certificate too?
It does not need to. RFC 8446 allows a certificate that specifies a trust anchor to be left out of the chain, since clients must already have it. The server must send the intermediates. RFC 8446 Certificate message
Why does Go say "signed by unknown authority" instead?
Go's verifier uses its own message for the same condition: it could not build a path from the leaf to a root in its pool. On Linux, Go reads the system bundle from a list of known paths, and SSL_CERT_FILE and SSL_CERT_DIR override them. Go x509 root paths · Go SystemCertPool
Is turning off verification a reasonable test?
It proves only that the failure is in verification, which the message already told you. Use openssl verify with an explicit CA file instead: it tells you which certificate is missing without changing the service.