ubuntu ssl problem

66 views
Skip to first unread message

vrab...@gmail.com

unread,
Feb 28, 2013, 8:34:36 AM2/28/13
to activem...@googlegroups.com
I'm trying to contribute with Croatian payment gatway, and ssl_post method is giving me a hard time. So, i generate my xml and use following code :
ssl_post( self.test_url, xml, { "Content-Type" => "application/xml" } )
and compiler greets me with following message:
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

Googled the problem, solution lies in path to certificates, or verification_mode( peer/none ). Next thing I do is create my own ssl_post method, to see if google got it right. Long story short, he got it. Short sketch:
def my_ssl( url, xml, headers )
  uri = URI.parse( url )
  https = Net::HTTP.new( uri.host, 443)
  https.use_ssl = true 
  https.verify_mode = OpenSSL::SSL::VERIFY_NONE
  # or this, both works
  # https.verify_mode = OpenSSL::SSL::VERIFY_PEER
  # https.ca_path ="/etc/ssl/certs"

  request = Net::HTTP::Post.new( url )
  request.body = xml
  request.add_field( "Content-Type", "application/xml" )

  return https.request( request )
end

Now that I know whats wrong, I want to use ssl_post even more, so I dig deeper. Figured out crutial variable is in module PostsData::ssl_strict. As much as I understand this portion of code, it's injecting variable accessor when module is included.
 base.superclass_delegating_accessor :ssl_strict
 base.ssl_strict = true

Can I somehow from within my Gateway class on runtime change it's value to false ?

Regards, Vedran

vrab...@gmail.com

unread,
Feb 28, 2013, 9:28:18 AM2/28/13
to activem...@googlegroups.com
Problem solved. Solution self.ssl_strict = false must be placed outside commit method

Jimena Garbarino

unread,
Mar 19, 2013, 5:14:10 PM3/19/13
to activem...@googlegroups.com
Hi!

Where did you assigned ssl_strict?
I'm getting ssl time out and I read that it can be caused by the cipher.
When I send curl --ciphers 3DES to the https url it works. But not using ssl_post.
Thanks,

vrab...@gmail.com

unread,
Jun 7, 2013, 3:24:35 AM6/7/13
to activem...@googlegroups.com
I've put it in ActiveMerchant::Billing::MyNewGateway class outside commit method.
module ActiveMerchant
    module Billing
        class MyNewGateway < Gateway
            ...
            self.ssl_strict = false
            
            def initialize( options = {} )
            end
            ...
        end
    end
end

I'm not sure were should you put it if you're trying to solve problem on some of the existing gateways. 
Reply all
Reply to author
Forward
0 new messages