In order to get a successful response I am using curl --cacert <path of ca.pem> ...
but how can i set the path of ca.pem in a configuration file in mac in order to not specify the path of the certificate every time, and i can directly use curl ...
If you are using the curl command line tool, you can specify your own CA cert file by setting the environment variable CURL_CA_BUNDLE to the path of your choice. If you are using the curl command line tool on Windows, curl will search for a CA cert file named "curl-ca-bundle.
This can be changed at compile time with curl by passing --with-ca-path=DIRECTORY when building curl but I'd recommend leaving it as is. Better yet, find out what CA path/file your OS and/or OpenSSL are using and add the relevant certificate there.
You need to pass the -k or --insecure option to the curl command. This option explicitly allows curl to perform “insecure” SSL connections and transfers. All SSL connections are attempted to be made secure by using the CA certificate bundle installed by default.
On your system you can set environment variables to point to these files.
Try:
export SSL_CERT_FILE=/path/to/ca.pem
There is also SSL_CERT_DIR
environment variable to specify the directory containing certificates.
You can add this to your .bashrc
or .bash_profile
file to make this permanent.
This can be changed at compile time with curl by passing --with-ca-path=DIRECTORY
when building curl but I'd recommend leaving it as is.
Better yet, find out what CA path/file your OS and/or OpenSSL are using and add the relevant certificate there. I have no idea where they live on Mac but you should have a directory of trusted CA certs which curl is using for verification (probably somewhere in /etc).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With