Ssl – curl not using cert from /etc/ssl/certs/ca-certificate.crt

curlssl

When I try following curl

devendermishra@myhost:~$ curl   https://iam.endpoint.com
curl: (60) SSL certificate problem: self signed certificate
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

However, when I explicitly mention ca certificate file, it works fine.

devendermishra@myhost:~$ curl --cacert /etc/ssl/certs/ca-certificates.crt  https://iam.endpoint.com
{"error": {"message": "Auth Signature not provided", "code": 401, "title": "Unauthorized"}}

What is the issue with endpoint or installation in CA certificate?

Best Answer

I suspect libcurlwasn't compiled to look in that location. You can display the built-in path to the CA cert bundle that libcurl uses by running curl-config --ca. You can also display the arguments that were passed at build time by running curl-config --configure. I suspect the first command will return nothing (the flags weren't present and auto detection didn't work) and the later command will be missing the expected flags.

More information can be found here:

https://curl.haxx.se/docs/sslcerts.html