I am experiencing a problem in ruby, where an SSL cert could not be validated by OpenSSL. I think this is caused by the ca-bundle.pem not being known by the script. Is there a possibility to configure the path of the ca-bundle.pem manually?
相关问题
- Mechanize getting “Errno::ECONNRESET: Connection r
- How to specify memcache server to Rack::Session::M
- Why am I getting a “C compiler cannot create execu
- reference to a method?
- ruby 1.9 wrong file encoding on windows
相关文章
- Ruby using wrong version of openssl
- Difference between Thread#run and Thread#wakeup?
- how to call a active record named scope with a str
- “No explicit conversion of Symbol into String” for
- Segmentation fault with ruby 2.0.0p247 leading to
- How to detect if an element exists in Watir
- Git Clone Fails: Server Certificate Verification F
- uninitialized constant Mysql2::Client::SECURE_CONN
OpenSSL uses the
SSL_CERT_FILE
environment variable. You can set it in your ruby script using something like before the firstrequire
which pulls in OpenSSL:or, if you prefer, you can set the
SSL_CERT_FILE
environment variable in your OS environment, web server configuration etc depending on your situation.You can do so by the following:
It's all because
SSL_CERT_FILE
has a wrong value, the value it has might not exist. So, you have to set its value to your certificate file asENV['SSL_CERT_FILE]='path/to/ca-bundle.p'
. If you are using Rails, you can put it in an initializer. If you want a gem that does everything for you, use https://github.com/stevegraham/certified.