Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Who reads the value of ENV['SSL_CERT_FILE']?

I used to receive the following error:

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
from C:/Ruby1.9.2/lib/ruby/1.9.1/net/http.rb:678:in `connect' 

after reading through this, I discovered that the fix is to download the cacert.pem file from here. The post recommends doing something like this:

ENV['SSL_CERT_FILE'] = File.join(File.dirname(__FILE__),"cacert.pem")

And, indeed, this solves the problem. However, who reads the value of SSL_CERT_FILE? Altering the environment doesn't seem like "the Ruby way" of doing it. I'm looking for a solution that could work with both Rails and Sinatra.

like image 1000
Geo Avatar asked Mar 05 '12 10:03

Geo


1 Answers

The openssl library uses the SSL_CERT_FILE environment variable.

like image 103
Chaim Geretz Avatar answered Oct 03 '22 03:10

Chaim Geretz