smartlogic / hobostove

A command line campfire client
MIT License
3 stars 2 forks source link

Getting an SSL error when trying to connect #9

Closed abachman closed 10 years ago

abachman commented 11 years ago

I see:

error: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

in the bottom box and then it crashes, I'm dropped to a prompt, and I have to run reset to get input back.

This is on a MBPr, OSX 10.8.2, ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin12.2.1].

oestrich commented 11 years ago

I suspect that this is something in Tinder. Can you try opening up irb and doing:

require 'hobostove'
Hobostove::Configuration.current_room = 0
campfire = Tinder::Campfire.new Hobostove::Configuration.subdomain, :token => Hobostove::Configuration.token
room = campfire.find_room_by_name(Configuration.room)
room.recent
room.users
abachman commented 11 years ago

failed on the fourth step:

1.9.3p327 :006 > room = campfire.find_room_by_name(Hobostove::Configuration.room)
Faraday::Error::ConnectionFailed: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/http.rb:799:in `connect'
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/http.rb:799:in `block in connect'
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/http.rb:799:in `connect'
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/http.rb:744:in `start'
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/http.rb:1284:in `request'
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/http.rb:1026:in `get'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday-0.8.4/lib/faraday/adapter/net_http.rb:72:in `perform_request'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday-0.8.4/lib/faraday/adapter/net_http.rb:37:in `call'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday-0.8.4/lib/faraday/response.rb:8:in `call'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday-0.8.4/lib/faraday/response.rb:8:in `call'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday_middleware-0.9.0/lib/faraday_middleware/response_middleware.rb:30:in `call'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday-0.8.4/lib/faraday/response.rb:8:in `call'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday_middleware-0.9.0/lib/faraday_middleware/request/encode_json.rb:23:in `call'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday-0.8.4/lib/faraday/connection.rb:226:in `run_request'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday-0.8.4/lib/faraday/connection.rb:87:in `get'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/tinder-1.9.1/lib/tinder/connection.rb:76:in `get'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/tinder-1.9.1/lib/tinder/campfire.rb:34:in `rooms'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/tinder-1.9.1/lib/tinder/campfire.rb:48:in `find_room_by_name'
  from (irb):6
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/bin/irb:16:in `<main>'
oestrich commented 11 years ago

Does your campfire require SSL? It might be that I need to launch campfire with :ssl => true. Can you retry but with

campfire = Tinder::Campfire.new Hobostove::Configuration.subdomain, :token => Hobostove::Configuration.token, :ssl => true
abachman commented 11 years ago

bah, still no dice, same error as before.

1.9.3p327 :004 > campfire = Tinder::Campfire.new Hobostove::Configuration.subdomain, :token => Hobostove::Configuration.token, :ssl => true
 => #<Tinder::Campfire:0x007fc2ceeee560 @connection=#<Tinder::Connection:0x007fc2ceeee538 @subdomain="figure53", @options={:ssl=>true, :ssl_options=>{:verify=>true}, :proxy=>nil, :token=>"4b3ca66c0537a2e353503a5ace6726732f915a71"}, @uri=#<URI::HTTPS:0x007fc2ceeee1c8 URL:https://figure53.campfirenow.com>, @token="4b3ca66c0537a2e353503a5ace6726732f915a71", @connection=#<Faraday::Connection:0x007fc2cefd1e78 @headers={"Authorization"=>"Basic NGIzY2E2NmMwNTM3YTJlMzUzNTAzYTVhY2U2NzI2NzMyZjkxNWE3MTpY"}, @params={}, @options={}, @ssl={:verify=>true}, @parallel_manager=nil, @default_parallel_manager=nil, @builder=#<Faraday::Builder:0x007fc2cefd1ef0 @handlers=[FaradayMiddleware::EncodeJson, FaradayMiddleware::Mashify, FaradayMiddleware::ParseJson, Faraday::Response::RemoveWhitespace, Faraday::Response::RaiseOnAuthenticationFailure, Faraday::Adapter::NetHttp]>, @url_prefix=#<URI::HTTPS:0x007fc2cefd1900 URL:https://figure53.campfirenow.com/>, @proxy=nil>, @raw_connection=#<Faraday::Connection:0x007fc2cefd8cf0 @headers={"Authorization"=>"Basic NGIzY2E2NmMwNTM3YTJlMzUzNTAzYTVhY2U2NzI2NzMyZjkxNWE3MTpY"}, @params={}, @options={}, @ssl={:verify=>true}, @parallel_manager=nil, @default_parallel_manager=nil, @builder=#<Faraday::Builder:0x007fc2cefd8d68 @handlers=[FaradayMiddleware::Mashify, FaradayMiddleware::ParseJson, Faraday::Response::RemoveWhitespace, Faraday::Response::RaiseOnAuthenticationFailure, Faraday::Adapter::NetHttp]>, @url_prefix=#<URI::HTTPS:0x007fc2cefd8778 URL:https://figure53.campfirenow.com/>, @proxy=nil>>> 
1.9.3p327 :005 > room = campfire.find_room_by_name(Configuration.room)
NameError: uninitialized constant Configuration
  from (irb):5
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/bin/irb:16:in `<main>'
1.9.3p327 :006 > room = campfire.find_room_by_name(Hobostove::Configuration.room)
Faraday::Error::ConnectionFailed: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/http.rb:799:in `connect'
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/http.rb:799:in `block in connect'
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/http.rb:799:in `connect'
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/http.rb:744:in `start'
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/http.rb:1284:in `request'
  from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/http.rb:1026:in `get'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday-0.8.4/lib/faraday/adapter/net_http.rb:72:in `perform_request'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday-0.8.4/lib/faraday/adapter/net_http.rb:37:in `call'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday-0.8.4/lib/faraday/response.rb:8:in `call'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday-0.8.4/lib/faraday/response.rb:8:in `call'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday_middleware-0.9.0/lib/faraday_middleware/response_middleware.rb:30:in `call'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday-0.8.4/lib/faraday/response.rb:8:in `call'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday_middleware-0.9.0/lib/faraday_middleware/request/encode_json.rb:23:in `call'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday-0.8.4/lib/faraday/connection.rb:226:in `run_request'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/faraday-0.8.4/lib/faraday/connection.rb:87:in `get'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/tinder-1.9.1/lib/tinder/connection.rb:76:in `get'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/tinder-1.9.1/lib/tinder/campfire.rb:34:in `rooms'
  from /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/tinder-1.9.1/lib/tinder/campfire.rb:48:in `find_room_by_name'
  from (irb):6

I'm going to try the "install CA root bundles on your machine" route. Ruby net/https is overzealous.

abachman commented 11 years ago

boo on Tinder and Mac OSX.

I got it working by adding :ssl_verify => false to the Tinder::Campfire.new command:

campfire = Tinder::Campfire.new Hobostove::Configuration.subdomain, :token => Hobostove::Configuration.token, :ssl => true, :ssl_verify => false

It looks related to RVM's compilation of the openssl library: https://github.com/collectiveidea/tinder/pull/12

kgrz commented 11 years ago

I use Rbenv. This fixed it for me:

http://meeech.amihod.com/troubleshooting-ssl-cert-with-rbenvruby-193