[Ruby] Problems with OpenSSL

ben wiseley wiseleyb at gmail.com
Sat Sep 9 11:49:31 PDT 2006


Since I know you've all been up for days working on the problem (because
it's SO interesting) I thought it'd be nice to just give you all the answer
so you could finally get some sleep.  :)

If you have a box on RimuHosting aparently they set permissions on the /dev
directory to 606, not 666, which causes opensll to die with permission
problems becuase it needs access to random.

Big thanks to James (yimmy on the cc) for figuring this out!

-ben


On 9/6/06, ben wiseley <wiseleyb at gmail.com> wrote:
>
> Sorry to bug the list but I'm really stumped on this one.
>
> I'm using ActiveMerchant to do Authorize.net processing (currently
> auth.net is in test mode... if that makes a difference).  Everything works
> fine on my windoz box (exact same code) but, on our staging box (which is
> running the same version of Ruby 1.8.4 on a dedicated Debian:Sarge box)
> I'm getting strange errors from the bowels of /lib/ruby/1.8/net/http.rb
>
> I get two different errors... when doing this:
>       uri   = URI.parse(url)
>       http = Net:: HTTP.new(uri.host, uri.port)
>       http.verify_mode    = OpenSSL::SSL::VERIFY_NONE
>       http.use_ssl        = true
>       http.post(uri.path, data).body
> I get this
> OpenSSL::SSL::SSLError in CheckoutController#am_test
>
> RAILS_ROOT: /var/www/webapps/staging/russell/current/config/..
>  Application Trace <http://rubyonrain.com/checkout/am_test#> | Framework
> Trace <http://rubyonrain.com/checkout/am_test#> | Full Trace<http://rubyonrain.com/checkout/am_test#>
>
> /usr/local/lib/ruby/1.8/net/http.rb:588:in `connect'
> /usr/local/lib/ruby/1.8/net/http.rb:588:in `connect'
> /usr/local/lib/ruby/1.8/net/http.rb:555:in `do_start'
> /usr/local/lib/ruby/1.8/net/http.rb:544:in `start'
>
> /usr/local/lib/ruby/1.8/net/http.rb:1031:in `request'
> /usr/local/lib/ruby/1.8/net/http.rb:840:in `post'
> #{RAILS_ROOT}/lib/active_merchant/lib/posts_data.rb:18:in `ssl_post'
> #{RAILS_ROOT}/lib/active_merchant/billing/gateways/authorized_net.rb:108:in `commit'
>
> #{RAILS_ROOT}/lib/active_merchant/billing/gateways/authorized_net.rb:67:in `purchase'
> #{RAILS_ROOT}/app/controllers/checkout_controller.rb:268:in `am_test'
> /usr/local/bin/mongrel_rails:18
>
> When using their code, unmodifed - (i.e. with the @ssl_strict test)
>       uri   = URI.parse(url)
>       http = Net::HTTP.new(uri.host, uri.port)
>       http.verify_mode    = OpenSSL::SSL::VERIFY_NONE unless @ssl_strict
>       http.use_ssl        = true
>       http.post(uri.path, data).body
> I get this
> Errno::ENOENT in CheckoutController#am_test
>
> No such file or directory
>
> RAILS_ROOT: /var/www/webapps/staging/russell/current/config/..
>  Application Trace <http://rubyonrain.com/checkout/am_test#> | Framework
> Trace <http://rubyonrain.com/checkout/am_test#> | Full Trace<http://rubyonrain.com/checkout/am_test#>
>
> /usr/local/lib/ruby/1.8/net/http.rb:588:in `connect'
> /usr/local/lib/ruby/1.8/net/http.rb:588:in `connect'
> /usr/local/lib/ruby/1.8/net/http.rb:555:in `do_start'
> /usr/local/lib/ruby/1.8/net/http.rb:544:in `start'
>
> /usr/local/lib/ruby/1.8/net/http.rb:1031:in `request'
> /usr/local/lib/ruby/1.8/net/http.rb:840:in `post'
> #{RAILS_ROOT}/lib/active_merchant/lib/posts_data.rb:18:in `ssl_post'
> #{RAILS_ROOT}/lib/active_merchant/billing/gateways/authorized_net.rb:108:in `commit'
>
> #{RAILS_ROOT}/lib/active_merchant/billing/gateways/authorized_net.rb:67:in `purchase'
> #{RAILS_ROOT}/app/controllers/checkout_controller.rb:268:in `am_test'
> /usr/local/bin/mongrel_rails:18
>
>
> I tried replacing the uri.path with a static url ( http.post("
> https://secure.authorize.net/gateway/transact.dll",data).body ) in case
> that was the trouble but no luck.
>
> Any ideas on this?
>
> -ben
>
>


More information about the Ruby mailing list