Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set ca-bundle path for OpenSSL in ruby

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?

like image 991
Coxer Avatar asked Feb 07 '13 10:02

Coxer


People also ask

How do I bundle CA certs?

You can contact the customer support team of your vendor or CA and request them to provide the CA bundle. If you have bought your SSL certificate from RapidSSLonline.com, you can easily access the CA bundle from here.

What is bundle file in SSL certificate?

CA Bundle is the file that contains root and intermediate certificates. Together with your server certificate (issued specifically for your domain), these files complete the SSL chain of trust. The chain is required to improve the compatibility of the certificates with web browsers, email clients, and mobile devices.


2 Answers

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.

like image 83
Daniel Roethlisberger Avatar answered Oct 17 '22 05:10

Daniel Roethlisberger


You can do so by the following:

SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
like image 25
Kumar Akarsh Avatar answered Oct 17 '22 03:10

Kumar Akarsh