How to set ca-bundle path for OpenSSL in ruby

本秂侑毒 提交于 2019-12-04 00:04:31

OpenSSL uses the SSL_CERT_FILE environment variable. You can set it in your ruby script using something like before the first require which pulls in OpenSSL:

ENV['SSL_CERT_FILE'] = '/path/to/ca-bundle.pem'

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:

SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt

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 as ENV['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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!