Forcing SSL TLSv1

759 views
Skip to first unread message

Sam Lown

unread,
Dec 10, 2012, 5:38:46 AM12/10/12
to activem...@googlegroups.com
Hi all,

I'm currently working on adding support for the payment gateway from hell and would like to see if anyone has any suggestions on how best to deal with the SSL issue I'm having.

New versions of Ruby and OpenSSL from the last 6 months or so default to TLS v1.2 requests, older versions of Ruby do not. Unfortunately, TLSv1.2 causes the remote server to barf with errors like:

    ActiveMerchant::ConnectionError: The connection to the remote server timed out

The gateway in question is Transbank's Oneclick service in Chile. I've managed to get SOAP, WS-Security, and digital signatures working using Nokogiri (no small feat), but it seems they have absolutely no interest or motivation -at all- in improving or fixing their service to make things easier. Perhaps this is due to their total monopoly for all credit card transactions in Chile.

The local solution/hack therefore is to force the Net::HTTP connection to use TLSv1:

    http.ssl_version = :TLSv1

The http object however is abstracted away in active_utils and I've not been able to find a way to access it to set the ssl version.

Does anyone have any recommendations on how best to force TLSv1?

Many thanks,
Sam

Nathaniel Talbott

unread,
Dec 10, 2012, 9:04:02 AM12/10/12
to activem...@googlegroups.com
The PostsData module uses a `new_connection` method for exactly this situation; something like this should work:

  class GatewayFromHell < ActiveMerchant::Billing::Gateway
    class CrippledSslConnection < ActiveMerchant::Connection
      def configure_ssl(http)
        super(http)
        http.ssl_version = :TLSv1
      end
    end

    def new_connection(endpoint)
      CrippledSslConnection.new(endpoint)
    end
  end


--
Nathaniel



--
You received this message because you are subscribed to the Google Groups "Active Merchant" group.
To view this discussion on the web visit https://groups.google.com/d/msg/activemerchant/-/Dg9GG80fsdIJ.
To post to this group, send email to activem...@googlegroups.com.
To unsubscribe from this group, send email to activemerchan...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/activemerchant?hl=en.

Sam Lown

unread,
Dec 12, 2012, 10:57:55 AM12/12/12
to activem...@googlegroups.com
Thanks Nathaniel! That worked great!

The gateway has SSL troubles, but at least I can get it to work more often than not now!

Cheers, sam
Reply all
Reply to author
Forward
0 new messages