1
C:\>gem install rhc

ERROR: Could not find a valid gem 'rhc' (>= 0), here is why: Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.org/latest_specs.4.8.gz)

tried with the following commands:

gem sources -r https://rubygems.org
gem sources -a http://rubygems.org

But still same error exists when trying to setup rhc.

rhc setup

By following these steps rhc gem is installed successfully, but when executing "rhc setup" for connecting to openshift here is the error message rather connecting to openshift server

enter image description here

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
Vivaswan
  • 337
  • 4
  • 17

2 Answers2

3

The problem is that your Windows machine does not recognize the rubygems server certificate as a trusted certificate because Windows don't have its authority certificate present in its trusted certs store.

As a quick fix you'd need to remove the HTTPS version of the rubygems source URL (not HTTP as you did):

gem sources -r https://rubygems.org

This quick fix should make rubygems use the HTTP version which has no certificate checks involved.

But this should not be the definitive fix. Instead you should add the HTTPS source back (using the -a option) and install a proper CA certificate for the rubygems server cert into your windows trusted CA certs store.

There are quite a few pages that deal with this procedure on the net (google this), e.g. the post here has steps to download and install all CA certificates from the curl command, to your Windows machine, that fixes the problem permanently and without lowering security.

Matouš Borák
  • 15,606
  • 1
  • 42
  • 53
  • CA certificate is added in trust store as steps provided in https://superdevresources.com/ssl-error-ruby-gems-windows/. rhc installed successfully, but while executing the command "C:\Users\raju>rhc setup" here is the error message: C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/commander-4.2.1/lib/commander/user_interaction.rb:328: warning: constant ::TimeoutError is deprecated. Tried to close and open the command prompt and tried to remove http://rubygems.org and adding https://rubygems.org, but with no proper execution. – Vivaswan May 17 '16 at 05:12
  • @Vivaswan, that's just a warning, not error, thus it seems that the rhc gem is installed properly now. – Matouš Borák May 17 '16 at 05:23
  • As mentioned earlier comment, rhc gem is installed successfully, but when trying to connect openshift server the error message is displaying. Unable to connect the server. – Vivaswan May 17 '16 at 11:40
  • Aha, now I see the screenshot, this seems to be another, unrelated error and [this SO answer](http://stackoverflow.com/questions/28896733/rhc-setup-gives-error-no-such-file-dl-import) may help you there. – Matouš Borák May 17 '16 at 12:44
  • In the first comment, the same error message was pasted. It is not possible to paste the error screenshot in comment, so added it in the question itself for clear picture of the error message. Let me see whether solution works. – Vivaswan May 18 '16 at 04:57
0

The reason and fix for the problem is stated here

Previously, this certificate was provided by one Certificate Authority, but the new certificate is provided by a different one.

Because of this, verions of RubyGems with both certificates were released, in an attempt to simplify the change.

However, at the scale RubyGems operates at, it’s impossible to make sure everybody updates the software. There are also operating systems shipping with old versions. As such, sometimes manual intervention (as described above) is required.

This has been described on Issue #1050

To fix the problem, follow these steps:

  1. Download rubygems-update-2.6.7.gem. The download should be saved in a location you can later easily point to. Let's use like C:\rubygems-update-2.6.7.gem

  2. On the command line, run the following commands:
    C:\>gem install --local C:\rubygems-update-2.6.7.gem

    C:\>update_rubygems --no-ri --no-rdoc

  3. Run the following commands to uninstall rubygems-update:
    C:\>gem uninstall rubygems-update -x

This should solve the problem.

Community
  • 1
  • 1
Tundebabzy
  • 829
  • 2
  • 11
  • 24