Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
929 views
in Technique[技术] by (71.8m points)

macos - SSL Certificates - OS X Mavericks

I am trying to connect to application on localhost which uses SSL. I am using Mac OS X Mavericks. The error I am getting is following:

Error sending cURL get request to https://dev.site.com:5555/version  
Error code: 60 Error msg: SSL certificate problem: Invalid certificate chain

I tried to add certificates to the chain:

/usr/bin/security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" /etc/path/ca_key.pem 

Still getting the same error.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In some cases will be better to use standard curl (eg if you develop on Mac code for Linux or *BSD). In this case you can do like that:

  1. Install Homebrew

  2. Install curl with standard certificates support (no more Keychain certs).

    brew install curl --with-openssl && brew link curl --force

  3. Install root CA certs from http://curl.haxx.se/ca/cacert.pem into /usr/local/etc/openssl/certs/cacert.pem

  4. Add into your ~/.bash_profile

    export CURL_CA_BUNDLE=/usr/local/etc/openssl/certs/cacert.pem

  5. After 4 steps you can use curl with certificates from file, not from Keychain.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...