-
Notifications
You must be signed in to change notification settings - Fork 3
openssl certificate verify failed
Last updated 16 April 2012
Are you getting an error “OpenSSL certificate verify failed” with Ruby? Here are suggestions.
This is a note for developers using the starter apps from the Rails Apps repository. Others may find it helpful as well.
You may have received an error message if you’ve tried to create a new Rails application using an application template hosted on GitHub.
For example, you may have entered
$ rails new myapp -m https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-mongoid-devise-template.rb -T -O
and seen the following error message:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
The Ruby language interpreter uses OpenSSL to connect to GitHub to request an application template file. GitHub requires all connections to be made using SSL. The connection failed because OpenSSL was unable to verify the server certificate.
This can happen when the certificate file on your computer is out of date, missing, or can’t be found.
Download a certificate file:
$ cd /opt/local/etc/openssl $ sudo curl -O http://curl.haxx.se/ca/cacert.pem $ sudo mv cacert.pem cert.pem
Doesn’t work for you? Please add to the comments below.
Fletcher Nichol shows how to download a cacert.pem file and set an environment variable to install the certificate authorities needed by the OpenSSL library.
You can also try hacking the open-uri source: How to Use an Application Template from Github when You’re Developing in Rails on Windows
Any advice to offer? Please add to the comments below.
RVM users :
If you have compiled your ruby version with the openssl package version
$ rvm pkg install openssl $rvm install 1.9.2 --with-openssl-dir=$rvm_path/usr
You have to link certs directory with /etc/ssl/certs
$ rmdir $rvm_path/usr/ssl/certs $ ln -s /etc/ssl/certs $rvm_path/usr/ssl
Any advice to offer? Please add to the comments below.