3

I have rails 4.1.8 with ruby version "ruby 2.1.5p273 (2014-11-13 revision 48405) [i386-mingw32]" in windows 8. I followed this tutorial to install ruby on rails-"http://installfest.railsbridge.org/installfest/windows". Now whenever I run any rails app I am getting this error-

Fetching source index from https://rubygems.org/ Retrying source fetch due to error (2/3):Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/. There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'. Retrying source fetch due to error (3/3): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/. There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'. Could not verify the SSL certificate for https://rubygems.org/. There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'. 

Shall I change the https to http? Is it secure?

1
  • I had the issue with ruby v2.2.7 and after upgrading to ruby v2.6.10 the error was gone. I had to change github: to git: for the git-based gem definitions. Commented Nov 15, 2022 at 12:37

6 Answers 6

5

As the error message says:

For information about OpenSSL certificates, see bit.ly/ruby-ssl.

bit.ly/ruby-ssl points to http://railsapps.github.io/openssl-certificate-verify-failed.html which has the explanation for what is happening, and suggestions on how to fix it.

Changing https to http in source 'http://rubygems.org' is one of the recommended workarounds.

There is a windows specific solution at the bottom which recommends downloading a cacert.pem for RailsInstaller

Sign up to request clarification or add additional context in comments.

4 Comments

I'd recommend against this as http is less secure than https.
I downlaoded the cacert.pem...it Worked!! Thanks a lot :)
I am also getting this error- DL is deprecated, please use Fiddle. Why so? Should I be bothered about this message?
Not sure about the new error; might be worth adding a new question.
2

This can be solved by running gem update --system

I ran into the same problem myself not too long ago and that fixed it for me.

3 Comments

I tried this but its giving me an error- "ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certif icate verify failed (rubygems.org/specs.4.8.gz)
Ran into same issue today also - ran gem update --system but got same error as @dips
I was getting certificate errors trying this update as well as other updates (on Windows). I went with installing a new version of ruby 2.5.x (old install was 2.2.x). That solved the ssl certificate problem. Gem was a newer version. Bundler wasn't in this install, but was easy to install from the command line.
1

Just go to gem file in root directory and replace change "https" to "http" in the top most line.

Comments

0

Changing https to http is just asking for trouble, especially if you're on a production machine. The security was put there for a reason.

There are many solutions to list, all the way from updating your certs, updating your openssl, to rebuilding your ruby against an updated cert directory etc.

But the one solution that covers all bases is to nuke your rvm:

rvm implode brew uninstall openssl --force # now reinstall rvm for your system # install ruby 2.3.1 via rvm (at this point RVM will install openssl 1.0.2j via homebrew) # issue should be fixed. 

Solution taken from https://github.com/rubygems/rubygems/issues/1758.

Comments

0

I too had the same problem. As said by others earlier. The simplest solution would be

  • Download the cacert.pem file from cacert.pem download link.
  • Save this file to "C:\RailsInstaller\cacert.pem". Incase you are trying this for redmine you can move it to the redmine root folder. In my case I'm using bitnami redmine stack, I moved the file to "C:\Bitnami\redmine-3.3.2-2\apps\redmine\htdocs\ssl_certs"
  • Now set a system environment variable as,

    Variable Name: SSL_CERT_FILE Value: C:\RailsInstaller\cacert.pem [My value was C:\Bitnami\redmine-3.3.2-2\apps\redmine\htdocs\ssl_certs] 

This worked for me.

Comments

0

Turning off my VPN solves the problem

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.