Wrong certificates in ruby

Hello there!

I have updated the ssl package in my ubuntu vs, I signed the new certificates and installed them correctly using nginx, when I access my website it works perfectly, however… seems like ruby is not getting the new certificates because when in my rails app (running on unicorn) try to use the ssl package I got this error: <pre> OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed </pre> I got the same error when I try to run this code: <pre> test.rb
require ‘open-uri’ open(‘’) </pre> I try to set this export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt, but it didn’t work :(

I will appreciate if anyone can point me to the right direction.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Thank you so much for your help!! this works!! Just by running this: <pre> sudo apt-get install ca-certificates </pre> Regards

This is most likely due to ruby not finding any up-to-date root certificates. The first thing to do is make sure the ca-certificates package is up-to-date: <pre> sudo apt-get update sudo apt-get install ca-certificates </pre> If that doesn’t work, you can grab the most recent CA bundle file with: <pre> wget </pre> Then in your environment.rb file, you can add something like: <pre> ENV[‘SSL_CERT_FILE’] = /path/to/your/new/cacert.pem </pre>