When downloading files, interacting with REST APIs, or running automated shell scripts using the curl CLI utility on Ubuntu, Debian, CentOS, AlmaLinux, or Fedora, you may be halted by the transport-layer error: curl: (60) SSL certificate problem: unable to get local issuer certificate. More details here: https://curl.se/docs/sslcerts.html. This failure prevents curl from establishing a trusted HTTPS connection with the remote server. In Linux, curl validates public server certificates by checking them against an operating system Certificate Authority (CA) trust store. When local CA certificate bundles are outdated, when a company proxy terminates SSL sessions, or when intermediate certificate chains are omitted by the server, curl aborts to protect against man-in-the-middle attacks.
Why Does curl Fail to Verify the Local Issuer Certificate?
TLS/SSL verification failures in Linux environments typically stem from issues with the local certificate trust store or incomplete remote certificate handshakes:
- Outdated Local CA Certificates Package: The operating system certificate store (
ca-certificates) lacks recently minted root certificates issued by modern certificate authorities such as Let’s Encrypt or DigiCert. - Missing Intermediate Certificates on the Server: The remote web server provides only its leaf certificate and fails to serve the required intermediate certificate chain to complete trust verification.
- Corporate SSL Inspection Proxies: Enterprise firewalls (Zscaler, Fortinet, Palo Alto Networks) decrypting HTTPS traffic and re-signing payloads with a self-signed corporate root CA that Linux does not yet trust.
- Custom curl Binary Built Without Default CA Paths: Binaries compiled from source or installed via Snap/Flatpak searching for non-existent CA bundle locations (such as
/etc/pki/tls/certs/ca-bundle.crtinstead of/etc/ssl/certs/ca-certificates.crt). - System Time and Clock Drift: The Linux system clock being skewed ahead or behind the true UTC time, causing valid certificates to be misidentified as expired or not yet active.
Step 1: Check and Correct System Time and Clock Synchronisation
Certificates have strict Not Before and Not After validity timestamps. Clock drift causes curl to reject perfectly valid certificates.
- Open your terminal and check the system clock:
timedatectl status - Verify that NTP service: active (or System clock synchronized: yes) is reported.
- If the system time is incorrect, synchronise your clock with network time servers:
sudo systemctl restart systemd-timesyncd - On systems using chrony or ntpd, run:
sudo chronyc makestep - Test your curl request again to see if clock alignment resolved the certificate verification failure.
Step 2: Update the Operating System CA Certificates Package
Updating your Linux distribution’s core certificate bundle ensures that all current global root certificate authorities are recognised.
- On Ubuntu / Debian / Linux Mint:
sudo apt update sudo apt install --reinstall ca-certificates sudo update-ca-certificates - On RHEL / CentOS / AlmaLinux / Rocky Linux / Fedora:
sudo dnf reinstall ca-certificates sudo update-ca-trust - On Arch Linux / Manjaro:
sudo pacman -Syu ca-certificates-utils sudo update-ca-trust
Step 3: Install Custom or Corporate Root Certificates in the System Trust Store
If you are working behind an enterprise proxy that performs SSL decryption, you must import the corporate root CA certificate into the system trust store.
- Obtain your organization’s root certificate in PEM or CRT format (e.g.,
corp-root-ca.crt). - For Ubuntu and Debian:
- Copy the certificate to the extra certificates directory:
sudo cp corp-root-ca.crt /usr/local/share/ca-certificates/corp-root-ca.crt - Update the system trust store:
sudo update-ca-certificates
- Copy the certificate to the extra certificates directory:
- For RHEL / CentOS / Fedora:
- Copy the certificate to the source anchors directory:
sudo cp corp-root-ca.crt /etc/pki/ca-trust/source/anchors/ - Update the trust bundle:
sudo update-ca-trust extract
- Copy the certificate to the source anchors directory:
Step 4: Explicitly Define the CA Bundle Path for curl
If your curl installation is searching for certificates in an unconventional path, pass the certificate path explicitly or store it in your curl configuration file.
- Test passing the local trust bundle path directly using the
--cacertflag:# On Debian/Ubuntu: curl --cacert /etc/ssl/certs/ca-certificates.crt https://api.example.com # On RHEL/CentOS: curl --cacert /etc/pki/tls/certs/ca-bundle.crt https://api.example.com - To configure this permanently so that curl always uses the correct bundle without typing the flag, create or edit
~/.curlrc:nano ~/.curlrc - Add the following line (adjusting path for your distribution):
capath="/etc/ssl/certs" cacert="/etc/ssl/certs/ca-certificates.crt" - Save the file and exit the editor. All subsequent curl commands will automatically reference the specified bundle.
Step 5: Bypass Verification for Temporary Troubleshooting (Caution)
While never recommended for production or automated deployments due to security vulnerabilities, you can bypass certificate validation temporarily to confirm that the API endpoint is otherwise functional.
- Append the
-kor--insecureflag to your curl command:curl -k https://api.example.com/health - If the request succeeds with
-k, the endpoint is live, confirming that the failure is strictly isolated to local certificate chain verification. - Proceed to resolve the certificate installation using Steps 2 through 4 rather than permanently relying on insecure transmission.