applicationsonline / librarian-chef

Librarian-Chef - A Bundler for your Chef Cookbooks. Librarian is at: https://github.com/applicationsonline/librarian.
http://applicationsonline.com/
MIT License
360 stars 55 forks source link

SSL_connect returned =1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (Ope nSSL::SSL::SSLError) ---> Windows #47

Open ddpdevang opened 9 years ago

ddpdevang commented 9 years ago

C:\Users\Devang\Desktop\chef-rails-dev-box\chef>librarian-chef install DL is deprecated, please use Fiddle Installing chef_handler (1.1.6) C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:921:in connect': SSL_connect returned =1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (Ope nSSL::SSL::SSLError) from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:921:inblock in connect'

    from C:/Ruby200-x64/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
    from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:921:in `connect'
    from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
    from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:851:in `start'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-chef-0.0.3/lib/li

brarian/chef/source/site.rb:352:in block in http_get' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-chef-0.0.3/lib/li brarian/chef/source/site.rb:348:inloop' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-chef-0.0.3/lib/li brarian/chef/source/site.rb:348:in http_get' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-chef-0.0.3/lib/li brarian/chef/source/site.rb:238:incache_remote_object!' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-chef-0.0.3/lib/li brarian/chef/source/site.rb:207:in cache_version_uri_package!' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-chef-0.0.3/lib/li brarian/chef/source/site.rb:216:incache_version_uri_unpacked!' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-chef-0.0.3/lib/li brarian/chef/source/site.rb:212:in cache_version_unpacked!' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-chef-0.0.3/lib/li brarian/chef/source/site.rb:30:ininstall_version!' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-chef-0.0.3/lib/li brarian/chef/source/site.rb:436:in install!' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-0.1.2/lib/librari an/manifest.rb:101:ininstall!' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-0.1.2/lib/librari an/action/install.rb:49:in block in install_manifests' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-0.1.2/lib/librari an/action/install.rb:48:ineach' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-0.1.2/lib/librari an/action/install.rb:48:in install_manifests' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-0.1.2/lib/librari an/action/install.rb:39:inperform_installation' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-0.1.2/lib/librari an/action/install.rb:12:in run' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-0.1.2/lib/librari an/cli.rb:165:ininstall!' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-chef-0.0.3/lib/li brarian/chef/cli.rb:42:in install' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/comman d.rb:27:inrun' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/invoca tion.rb:126:in invoke_command' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor.rb:359 :indispatch' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/base.r b:440:in start' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-0.1.2/lib/librari an/cli.rb:26:inblock (2 levels) in bin!' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-0.1.2/lib/librari an/cli.rb:31:in returning_status' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-0.1.2/lib/librari an/cli.rb:26:inblock in bin!' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-0.1.2/lib/librari an/cli.rb:47:in with_environment' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-0.1.2/lib/librari an/cli.rb:26:inbin!' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-chef-0.0.3/bin/li brarian-chef:7:in <top (required)>' from C:/Ruby200-x64/bin/librarian-chef:23:inload' from C:/Ruby200-x64/bin/librarian-chef:23:in `

'

YouSysAdmin commented 9 years ago

C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/librarian-chef-0.0.3/lib/li brarian/chef/source/site.rb

def http(uri)
  net_http = environment.net_http_class(uri.host).new(uri.host, uri.port)
  net_http.use_ssl = true if uri.scheme == 'https'
  net_http
end

replace

def http(uri)
  net_http = environment.net_http_class(uri.host).new(uri.host, uri.port)
  net_http.use_ssl = true if uri.scheme == 'https'
  net_http.verify_mode = OpenSSL::SSL::VERIFY_NONE if net_http.use_ssl?
  net_http
end

:)

Variant for realese

def ssl_chek_win(net)
  case RUBY_PLATFORM
    when /win/i, /ming/i
      net.verify_mode = OpenSSL::SSL::VERIFY_NONE if net.use_ssl?
  end
end

def http(uri)
  net_http = environment.net_http_class(uri.host).new(uri.host, uri.port)
  net_http.use_ssl = true if uri.scheme == 'https'
  ssl_chek_win(net_http)
  net_http
end
whaleyHF commented 8 years ago

Thank you @POStroi

That resolved the issue for me.

YouSysAdmin commented 8 years ago

@whaleyHF The long-standing problem :( Pull request https://github.com/applicationsonline/librarian-chef/pull/49 Automatic windows platform chek and disable SSL verify.

Treeless commented 8 years ago

Still running into this problem. Thanks for the solution @SysAlex

citrusoft commented 7 years ago

excellent, how do you know these things?