Last Updated: February 25, 2016
·
1.331K
· netbe

[Ruby] Fix SSL connect certificate verify error

While working with time saver tool CocoaPods, , to handle libraries' dependencies on a new iOS project, I stumbled upon this ruby error while retrieving a file via SSL.

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

Anyway, that's an issue you can encounter with ruby in other cases, so here's the solution thanks to @alloy

Download a fresh set of CA certificates, for example:

[EDIT] As mentioned in the comments use this certificate at your own risk.

$ [sudo] curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem

Use those certificates to verify SSL connections by setting an env variable:

$ export SSL_CERT_FILE= /usr/local/share/cacert.pem

FYI: You can the details of the issue here

2 Responses
Add your response

You're telling people to download and subseqeuntly trust a CA cert they're fetching over http from a host they're not verifying, and without verifying the cert itself.

Please remove this tip, or amend it to not do anything that's a travesty to infosec.

over 1 year ago ·

@richoh thanks, edited the tip, hope it's ok like that;)

over 1 year ago ·