Curl: unable to get local issuer certificate. How to debug?
Solution 1:
Using openssl s_client -connect thawte.com:443
shows:
---
Certificate chain
0 s:/1.3.6.1.4.1.311.60.2.1.3=US/1.3.6.1.4.1.311.60.2.1.2=Delaware/O=Thawte, Inc./C=US/ST=California/L=Mountain View/businessCategory=Private Organization/serialNumber=3898261/OU=Infrastructure Operations/CN=www.thawte.com
i:/C=US/O=thawte, Inc./CN=thawte Extended Validation SHA256 SSL CA
1 s:/C=US/O=thawte, Inc./CN=thawte Extended Validation SHA256 SSL CA
i:/C=US/O=thawte, Inc./OU=Certification Services Division/OU=(c) 2008 thawte, Inc. - For authorized use only/CN=thawte Primary Root CA - G3
---
That last "i" shows the issuing self-signed root CA. I'm guessing that that particular Thawte root CA, _i.e. the Primary Root CA - G3 cert, is not in your /etc/ssl/certs
directory (as stated in the curl
output; openssl s_client
does not have a default CA path, and needs to given one explicitly, e.g. -CApath /etc/ssl/certs
).
Adding that certificate explicitly to your /etc/ssl/certs
directory (and re-running c_rehash
) certainly wouldn't hurt. And if it works, e.g. as verified using openssl s_client -connect example.com:443 -CApath /etc/ssl/certs
, then you know that that update-ca-certificates
command may need some examination/debugging, as to why it hadn't picked up this root CA.
Now, it may be that the above root CA is already in your /etc/ssl/certs
directory, and the above steps had no effect. In that case, there are two other issuing CA certs to check (at least in the cert chain offered by thawte.com:443
): thawte Primary Root CA, and thawte SSL CA - G2. Repeating the above steps to install these certs into your /etc/ssl/certs
directory (and re-running c_rehash
) might work. Since these two are intermediate CAs, and not root CAs, the absence of one of them would explain your results, and might be expected as overlooked certs by update-ca-certificates
.
Hope this helps!