Certificate Verification Failed

Hi,

As I posted in another thread, I’m creating a script to communicate with the Amazon Mechanical Turk API. I finally figured out the error I was having, but now am having an SSL problem in the Ruby SDK.

All I have is this, to test it:

#!/usr/bin/env ruby

require 'rubygems'
require 'ruby-aws'

@mturk = Amazon::WebServices::MechanicalTurkRequester.new :Host => :Production, :SSL => false
puts "I have $#{@mturk.availableBalance}"

I get this error:

fatal: Not a git repository (or any of the parent directories): .git
/usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/http.rb:586:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
	from /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/http.rb:586:in `connect'
	from /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/http.rb:553:in `do_start'
	from /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/http.rb:542:in `start'
	from /usr/local/rvm/gems/ree-1.8.7-2010.02/gems/ruby-aws-1.3.1/lib/amazon/webservices/util/rest_transport.rb:74:in `method_missing'
	from /usr/local/rvm/gems/ree-1.8.7-2010.02/gems/ruby-aws-1.3.1/lib/amazon/webservices/util/amazon_authentication_relay.rb:41:in `send'
	from /usr/local/rvm/gems/ree-1.8.7-2010.02/gems/ruby-aws-1.3.1/lib/amazon/webservices/util/amazon_authentication_relay.rb:41:in `method_missing'
	from /usr/local/rvm/gems/ree-1.8.7-2010.02/gems/ruby-aws-1.3.1/lib/amazon/webservices/mturk/mechanical_turk_error_handler.rb:44:in `send'
	from /usr/local/rvm/gems/ree-1.8.7-2010.02/gems/ruby-aws-1.3.1/lib/amazon/webservices/mturk/mechanical_turk_error_handler.rb:44:in `dispatch'
	from /usr/local/rvm/gems/ree-1.8.7-2010.02/gems/ruby-aws-1.3.1/lib/amazon/webservices/mechanical_turk.rb:65:in `method_missing'
	from /usr/local/rvm/gems/ree-1.8.7-2010.02/gems/ruby-aws-1.3.1/lib/amazon/webservices/util/convenience_wrapper.rb:22:in `send'
	from /usr/local/rvm/gems/ree-1.8.7-2010.02/gems/ruby-aws-1.3.1/lib/amazon/webservices/util/convenience_wrapper.rb:22:in `callService'
	from /usr/local/rvm/gems/ree-1.8.7-2010.02/gems/ruby-aws-1.3.1/lib/amazon/webservices/util/convenience_wrapper.rb:29:in `method_missing'
	from ./aws.rb:7

As you see, it says “certificate verify failed.”

Does anyone know if there is any way to have it not use SSL, or have the verification go through successfully?

Also, why does it say “not a git repository”? It says that every time I call this script.

Any help would be much appreciated.

Hi!
I do not know much about ruby.
But it seems that it might be because you do not have the root certificate (and possibly intermediate certificates) that this Amazon certificate is signed with, in your trusted keystore.

It appears you problem is related to loading of a Ruby Gem.
Probably the ‘rubygems’ you have referenced in your code.

Can you be more clear? Why would requiring ‘rubygems’ be the problem? That’s a necessary step for including ‘ruby-aws’

The failure is in a call to RVM.
Proper troubleshooting should direct your attention to the originial error message: fatal: Not a git repository (or any of the parent directories): .git
See that it refers to a git repository which, I suspect, is one of the gems RVM is attempting to pull down for you.
I was hoping someone with a bit more experience in RoR would pick up on this thread and offer some input.

[What part of Pennsylvania are you?]