wget: Unable to locally verify the issuer’s authority — Causes, Fixes, and Troubleshooting
Short version: wget received a certificate from the server but could not build a chain from it to a root CA in its local trust store. Either the CA bundle is missing or stale, wget is configured to load the wrong file, or the chain terminates at a private root (corporate proxy, internal PKI, self-signed appliance) that was never installed. In the overwhelming majority of cases the correct fix is a one-line package install or trust-store refresh — not --no-check-certificate.
What the error actually means
A typical failure looks like this:
$ wget https://internal.example.com/tool.tar.gz
--2024-05-14 09:12:03-- https://internal.example.com/tool.tar.gz
Resolving internal.example.com... 10.0.4.21
Connecting to internal.example.com|10.0.4.21|:443... connected.
ERROR: cannot verify internal.example.com's certificate, issued by '/C=US/O=Example Corp/CN=Example Corp Issuing CA 2':
Unable to locally verify the issuer's authority.
To connect to internal.example.com insecurely, use `--no-check-certificate'.
The indented line is wget’s English rendering of OpenSSL verify error 20, X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY. wget’s OpenSSL backend maps that code to the string Unable to locally verify the issuer’s authority. — so if you have seen the same problem reported by openssl or curl as unable to get local issuer certificate, it is the identical condition.
Translated into plain terms, one of three things is true:
- The trust store is absent, empty, or outdated. Minimal container images, freshly built VMs, and old distro releases frequently ship without
ca-certificates, or with a bundle older than the root the site now uses (Let’s Encrypt’s 2021 DST Root CA X3 expiry, the 2025 wave of root rotations, etc.). - wget is pointed somewhere wrong. A leftover
ca_certificate =line in/etc/wgetrcor~/.wgetrc, a--ca-certificateflag in a wrapper script, or aca_directorythat points at a directory without hashed symlinks. - The chain ends at a root wget does not have. Internal PKI, a TLS-inspecting proxy that re-signs traffic, a self-signed appliance, or a server that sends an incomplete chain.
It is not the same as a hostname mismatch (no certificate subject alternative name matches), an expired certificate (certificate has expired), or a handshake/protocol failure (Unable to establish SSL connection). Distinguishing these early saves a lot of time — see the troubleshooting table below.
30-second triage: five commands
Run these before changing anything. Together they tell you whether the problem is the bundle, the config, or the server.
1. Which TLS backend is this wget using?
wget --version | head -n 3
# GNU Wget 1.21.4 built on linux-gnu.
# +digest +https +ipv6 +iri +large-file +nls +ntlm +opie +psl +ssl/openssl
+ssl/openssl and +ssl/gnutls behave differently: OpenSSL builds honour SSL_CERT_FILE/SSL_CERT_DIR, GnuTLS builds use a compiled-in file and print slightly different error strings. wget2 (libwget) is a separate codebase with its own messages.
2. What does the server actually send, and who issued it?
openssl s_client -connect internal.example.com:443 -servername internal.example.com -showcerts </dev/null 2>/dev/null
| openssl x509 -noout -subject -issuer -dates
If the issuer is your company’s own CA, a proxy vendor (Zscaler, Blue Coat, Squid with sslbump), or the subject equals the issuer (self-signed), stop reading the distro-package section and jump to the private-CA section.
3. Does the bundle exist, and how big is it?
ls -l /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt 2>/dev/null
awk 'BEGIN{n=0} /BEGIN CERTIFICATE/{n++} END{print n " certificates"}' /etc/ssl/certs/ca-certificates.crt
A healthy Debian/Ubuntu bundle contains roughly 120–150 certificates. A file of 0 bytes, or one that does not exist, is your answer.
4. Does forcing an explicit bundle change anything?
wget --ca-certificate=/etc/ssl/certs/ca-certificates.crt -O /dev/null https://internal.example.com
If this succeeds while the plain wget call fails, wget’s default path is wrong — a config problem, not a missing-package problem.
5. Is anything in wgetrc overriding the defaults?
grep -nE '^[[:space:]]*(ca_certificate|ca_directory|check_certificate|no_check_certificate)' /etc/wgetrc ~/.wgetrc 2>/dev/null
Also compare against a different client to isolate wget: curl -sSI https://internal.example.com | head -n 1. If curl succeeds and wget fails, the CA store itself is fine.
Fix 1 — Install or refresh the CA bundle
This resolves the majority of cases, especially on minimal images and containers.
# Debian / Ubuntu
sudo apt-get update
sudo apt-get install --reinstall ca-certificates
sudo update-ca-certificates --fresh
# RHEL / CentOS Stream / Fedora / Rocky / AlmaLinux
sudo dnf install -y ca-certificates
sudo update-ca-trust extract
# Alpine
sudo apk add --no-cache ca-certificates
sudo update-ca-certificates
# openSUSE / SLES
sudo zypper install -y ca-certificates
sudo update-ca-certificates
# Arch
sudo pacman -S --needed ca-certificates ca-certificates-mozilla
sudo trust extract-compat
Notes that matter in practice:
--freshon Debian rebuilds/etc/ssl/certs/from scratch and re-creates the hashed symlinks. Without it, stale symlinks can survive an upgrade.- On RHEL family systems
update-ca-trust extractis what writes/etc/pki/tls/certs/ca-bundle.crt. Installing the package alone is not always enough. - In a Dockerfile, do this in the same layer as the install and before any download that needs TLS:
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates. - Inside a container, changes to the host bundle do not propagate. Rebuild or bind-mount the bundle.
Verify with a request that prints status without saving anything:
wget --spider -S https://example.com 2>&1 | head -n 5
Fix 2 — Point wget at the right CA file
wget resolves its trust store in this order: --ca-certificate/--ca-directory on the command line, then ca_certificate/ca_directory from ~/.wgetrc, then /etc/wgetrc, then the compiled-in OpenSSL defaults.
A correct system-wide configuration looks like this:
# /etc/wgetrc
ca_certificate = /etc/ssl/certs/ca-certificates.crt
check_certificate = on
Per-invocation equivalents:
wget --ca-certificate=/etc/ssl/certs/ca-certificates.crt https://example.com
wget --ca-directory=/etc/ssl/certs https://example.com
Two traps are worth calling out:
ca_certificateis a single PEM file, not a directory. Pointing it at/etc/ssl/certs/produces an unreadable-file error, or silently no trust.ca_directorymust be a hashed directory — files namedxxxxxxxx.0created byopenssl rehashorc_rehash. A plain folder of.pemfiles will not be found.
On OpenSSL builds without an explicit ca_certificate, the standard OpenSSL environment variables also work:
SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt wget -O /dev/null https://example.com
SSL_CERT_DIR=/etc/ssl/certs wget -O /dev/null https://example.com
To see exactly which file wget opens at runtime:
strace -f -e trace=openat wget -O /dev/null https://example.com 2>&1 | grep -Ei 'ca-cert|ca-bundle|cert.pem'
If nothing matches, wget is not loading a bundle at all — that is the bug.
Fix 3 — Private CA, internal PKI, and TLS-inspecting proxies
If triage step 2 showed an issuer that is not a public CA, the root has to be added to the local trust store. Extract it first (the last certificate in the -showcerts output is usually the root or the closest available intermediate), save it as PEM, and install it:
# Debian / Ubuntu — filename must end in .crt and contain PEM
sudo cp corp-root-ca.crt /usr/local/share/ca-certificates/corp-root-ca.crt
sudo update-ca-certificates
# RHEL family
sudo cp corp-root-ca.crt /etc/pki/ca-trust/source/anchors/corp-root-ca.crt
sudo update-ca-trust extract
To trust the private CA for one command only, without touching the system store, concatenate it with the public bundle — --ca-certificate replaces the default bundle rather than adding to it:
cat corp-root-ca.crt /etc/ssl/certs/ca-certificates.crt > corp-bundle.pem
wget --ca-certificate=corp-bundle.pem -O /dev/null https://internal.example.com
For corporate proxies that intercept HTTPS, remember that the proxy performs a second TLS handshake with the client. Trusting the public CAs is irrelevant there — the certificate wget sees is signed by the proxy’s own CA. Export it from the proxy documentation (or from a browser that already trusts it) and install it as above. Set the proxy itself with:
export https_proxy=http://proxy.corp.example.com:3128
export http_proxy=http://proxy.corp.example.com:3128
wget -O /dev/null https://example.com
Finally, check whether the server sends the full chain. If openssl s_client -showcerts returns only the leaf certificate and the issuer is a public intermediate, the fix belongs on the server (add the intermediate to its certificate file), not on the client.
Comparison table: bundle paths and refresh commands
| Platform | Default bundle path | Refresh command | Local anchor directory | Package |
|---|---|---|---|---|
| Debian / Ubuntu | /etc/ssl/certs/ca-certificates.crt |
update-ca-certificates --fresh |
/usr/local/share/ca-certificates/ |
ca-certificates |
| RHEL / Fedora / Rocky / Alma | /etc/pki/tls/certs/ca-bundle.crt |
update-ca-trust extract |
/etc/pki/ca-trust/source/anchors/ |
ca-certificates |
| Alpine Linux | /etc/ssl/certs/ca-certificates.crt |
update-ca-certificates |
/usr/local/share/ca-certificates/ |
ca-certificates |
| openSUSE / SLES | /etc/ssl/ca-bundle.pem |
update-ca-certificates |
/usr/share/pki/trust/anchors/ |
ca-certificates |
| Arch Linux | /etc/ssl/certs/ca-certificates.crt |
trust extract-compat |
/etc/ca-certificates/trust-source/anchors/ |
ca-certificates-mozilla |
| macOS (Homebrew wget) | $(brew --prefix)/etc/ca-certificates/cert.pem |
brew install ca-certificates |
same directory | ca-certificates |
| FreeBSD | /usr/local/share/certs/ca-root-nss.crt |
certctl rehash |
/usr/local/share/certs/ |
ca_root_nss |
The flags themselves are easier to reason about side by side:
| Setting | Scope | Effect |
|---|---|---|
--ca-certificate=FILE |
single command | Replaces the default bundle entirely; must include public roots if you also need them |
--ca-directory=DIR |
single command | Uses a hashed directory (c_rehash) instead of the bundle file |
ca_certificate in wgetrc |
persistent, per user or system | Same as the flag; a common source of stale paths after OS upgrades |
check_certificate = off |
persistent | Disables verification everywhere for that user — avoid |
--no-check-certificate |
single command | Skips verification for this run; equivalent to trusting anything |
When --no-check-certificate is acceptable
It is acceptable for a one-off diagnostic request to a host you control, to confirm that trust is the only problem:
wget --no-check-certificate -O /dev/null https://internal.example.com
If that succeeds, you have proven the network path and the certificate content are fine and the only remaining issue is trust — go fix the trust store.
It is not acceptable in a script, a Dockerfile, a CI job, a cron entry, or anything that will outlive the debugging session. Once verification is off, a proxy, a captive portal, or an on-path attacker can serve arbitrary content and wget will download and execute it without complaint. If you need a narrow exception, prefer --ca-certificate with a pinned bundle — it keeps verification on for everything else while trusting exactly the one CA you mean.
Troubleshooting: real messages and what they indicate
| Message | Cause | Fix |
|---|---|---|
Unable to locally verify the issuer's authority. |
OpenSSL error 20: no matching root in the local store | Install/refresh ca-certificates; verify the path with strace |
OpenSSL: error:0A000086:SSL routines::certificate verify failed: unable to get local issuer certificate |
Same condition, newer OpenSSL wording | Same as above |
ERROR: The certificate of 'example.com' is not trusted. |
GnuTLS backend; unknown or distrusted root | Refresh the bundle; check for a distrusted root entry |
ERROR: The certificate of 'example.com' hasn't got a known issuer. |
Self-signed leaf, or server omits the intermediate | Import the private CA, or fix the chain on the server |
GnuTLS: Error in the certificate. |
Generic GnuTLS verification failure | Re-run with openssl s_client to get the specific reason |
ERROR: no certificate subject alternative name matches |
Hostname mismatch — a different failure | Use the correct hostname, or add a SAN on the server |
ERROR: The certificate of 'example.com' has expired / is not yet valid |
Expired leaf, or a badly skewed local clock | Renew the certificate; check date -u and NTP |
Unable to establish SSL connection. |
Handshake failure: protocol, cipher, or SNI problem | Test with openssl s_client -tls1_2 and inspect the handshake |
To connect to example.com insecurely, use `--no-check-certificate'. |
Not an error — wget’s hint appended to any verification failure | Ignore the hint; fix the trust store |
If you are on wget2, expect the same root cause with different surrounding text, such as Failed to establish TLS connection followed by the issuer line. The remedies are identical, but note that wget2 reads ~/.wget2rc rather than ~/.wgetrc, so a fix written into the old config file will be silently ignored.
FAQ
Does this error mean the server’s certificate is forged?
No. It means wget could not find the root that issued the certificate chain. On the public internet that is almost always a missing or outdated CA bundle; on a corporate network it is almost always an internal CA that was never installed. A forged certificate from a random attacker would normally produce the same message, which is exactly why the fix is to repair trust rather than disable it.
Why does curl work but wget fails on the same URL?
They resolve trust differently. curl may have been built against a different TLS library, may ship its own bundle, or may read CURL_CA_BUNDLE. wget may be a snap or Flatpak build with a confined view of the filesystem, or may have a stale ca_certificate line in ~/.wgetrc. Compare curl -vI https://host with strace -e openat wget -O /dev/null https://host to see which bundle each one actually opens.
Where is wget’s default CA path compiled in?
wget --version shows the TLS backend but not the path. Use strace -f -e trace=openat wget -O /dev/null https://example.com 2>&1 | grep -Ei 'ca-cert|ca-bundle', or inspect the binary with strings $(command -v wget) | grep -Ei 'ca-cert|ca-bundle'. On Debian-derived systems it is normally /etc/ssl/certs/ca-certificates.crt; on RHEL-derived systems, /etc/pki/tls/certs/ca-bundle.crt.
Do I need to restart anything after update-ca-certificates?
No daemon restart is needed — each new wget process reads the bundle at startup. Two exceptions: long-running processes that already loaded the bundle keep the old copy, and any shell that exported SSL_CERT_FILE or SSL_CERT_DIR to a now-stale path needs those variables re-exported or unset.
Does SSL_CERT_FILE affect wget?
Only for OpenSSL-backed builds that have no explicit ca_certificate configured. If /etc/wgetrc or ~/.wgetrc sets ca_certificate, the environment variable is ignored. GnuTLS builds do not honour it at all.
How do I test the fix without downloading a file?
wget --spider -S https://example.com performs the full TLS handshake and prints the response headers without saving anything. Exit status 0 means the trust problem is resolved.
Can I skip verification just for one internal host in my scripts?
Yes, but do it by trusting that host’s CA rather than by disabling checks: wget --ca-certificate=/etc/ssl/certs/corp-bundle.pem https://internal.example.com/file, where corp-bundle.pem is your private root concatenated with the public bundle. That keeps verification active for everything else the script touches.
Does this affect plain HTTP downloads?
No. The CA bundle is only consulted for TLS connections. An http:// URL will download fine with a completely empty trust store — which is a good reason to confirm your failing URL really does start with https:// before going further.
What if the machine has no outbound access to update packages?
Copy a known-good bundle from a healthy host (scp healthy:/etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt) or fetch the Mozilla bundle from curl.se/ca/cacert.pem through an allowed channel, then point wget at it with ca_certificate = in /etc/wgetrc. Document the file’s provenance and refresh date so it does not quietly rot.