[freeside-commits] branch master updated. 820906c790f19828477eabd37218c71c2a724d86

Ivan ivan at 420.am
Sat Apr 2 14:39:34 PDT 2016


The branch, master has been updated
       via  820906c790f19828477eabd37218c71c2a724d86 (commit)
      from  f42c91c8d9c1f31752451f851cdf29c47f096b39 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 820906c790f19828477eabd37218c71c2a724d86
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sat Apr 2 14:39:32 2016 -0700

    really don't verify certificates if asked, deb 8 style

diff --git a/FS/FS/Misc/Geo.pm b/FS/FS/Misc/Geo.pm
index 73122fa..92490bb 100644
--- a/FS/FS/Misc/Geo.pm
+++ b/FS/FS/Misc/Geo.pm
@@ -6,6 +6,7 @@ use vars qw( $DEBUG @EXPORT_OK $conf );
 use LWP::UserAgent;
 use HTTP::Request;
 use HTTP::Request::Common qw( GET POST );
+use IO::Socket::SSL;
 use HTML::TokeParser;
 use Cpanel::JSON::XS;
 use URI::Escape 3.31;
@@ -655,7 +656,12 @@ sub standardize_freeside {
     return $location;
   }
 
-  my $ua = LWP::UserAgent->new( 'ssl_opts' => { 'verify_hostname'=>0 });
+  my $ua = LWP::UserAgent->new(
+             'ssl_opts' => {
+               verify_hostname => 0,
+               SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE,
+             },
+           );
   my $response = $ua->request( POST $url, [
     'support-key' => scalar($conf->config('support-key')),
     %$location,
@@ -666,7 +672,10 @@ sub standardize_freeside {
 
   local $@;
   my $content = eval { decode_json($response->content) };
-  die "Address normalization JSON error : $@\n" if $@;
+  if ( $@ ) {
+    warn $response->content;
+    die "Address normalization JSON error : $@\n";
+  }
 
   die $content->{error}."\n"
     if $content->{error};
diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm
index a82d51d..df1b86d 100644
--- a/FS/FS/Template_Mixin.pm
+++ b/FS/FS/Template_Mixin.pm
@@ -2375,6 +2375,7 @@ service.
 =cut
 
 use CAM::PDF;
+use IO::Socket::SSL;
 use LWP::UserAgent;
 use HTTP::Request::Common qw( POST );
 use Cpanel::JSON::XS;
@@ -2415,7 +2416,12 @@ sub postal_mail_fsinc {
   my $file = $self->print_pdf(%opt, 'no_addresses' => 1);
   my $pages = CAM::PDF->new($file)->numPages;
 
-  my $ua = LWP::UserAgent->new( 'ssl_opts' => { 'verify_hostname'=>0 });
+  my $ua = LWP::UserAgent->new(
+    'ssl_opts' => { 
+      verify_hostname => 0,
+      SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE,
+    }
+  );
   my $response = $ua->request( POST $url, [
     'support-key'      => scalar($conf->config('support-key')),
     'file'             => encode_base64($file),
diff --git a/FS/FS/part_event/Action/http.pm b/FS/FS/part_event/Action/http.pm
index 673cd43..72a345d 100644
--- a/FS/FS/part_event/Action/http.pm
+++ b/FS/FS/part_event/Action/http.pm
@@ -4,6 +4,7 @@ use base qw( FS::part_event::Action );
 use strict;
 use vars qw( $me );
 use Data::Dumper;
+use IO::Socket::SSL;
 use LWP::UserAgent;
 use HTTP::Request::Common;
 use Cpanel::JSON::XS;
@@ -68,10 +69,17 @@ sub do_action {
       ( $field, $value );
     } split(/\n/, $self->option('content') );
 
+  if ( $self->option('debug') ) {
+    warn "[$me] $_: ". $content{$_}. "\n" foreach keys %content;
+  }
+
   my $content = encode_json( \%content );
 
   my @lwp_opts = ();
-  push @lwp_opts, 'ssl_opts'=>{ 'verify_hostname'=>0 }
+  push @lwp_opts, 'ssl_opts' => {
+                    verify_hostname => 0,
+                    SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE,
+                  }
     if $self->option('ssl_no_verify');
   my $ua = LWP::UserAgent->new(@lwp_opts);
 
@@ -82,7 +90,7 @@ sub do_action {
   );
 
   if ( $self->option('debug') ) {
-    
+    #XXX dump raw request for debugging
   }
   my $response = $ua->request($req);
 
diff --git a/FS/FS/part_export/http.pm b/FS/FS/part_export/http.pm
index 6cac600..42a35cb 100644
--- a/FS/FS/part_export/http.pm
+++ b/FS/FS/part_export/http.pm
@@ -3,6 +3,9 @@ package FS::part_export::http;
 use base qw( FS::part_export );
 use vars qw( %options %info );
 use Tie::IxHash;
+use LWP::UserAgent;
+use HTTP::Request::Common qw( POST );
+use IO::Socket::SSL;
 
 tie %options, 'Tie::IxHash',
   'method' => { label   =>'Method',
@@ -149,13 +152,12 @@ sub http {
 
   $method = lc($method);
 
-  eval "use LWP::UserAgent;";
-  die "using LWP::UserAgent: $@" if $@;
-  eval "use HTTP::Request::Common;";
-  die "using HTTP::Request::Common: $@" if $@;
-
   my @lwp_opts = ();
-  push @lwp_opts, 'ssl_opts'=>{ 'verify_hostname'=>0 } if $ssl_no_verify;
+  push @lwp_opts, 'ssl_opts' => {
+                    verify_hostname => 0,
+                    SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE,
+                  }
+    if $ssl_no_verify;
   my $ua = LWP::UserAgent->new(@lwp_opts);
 
   #my $response = $ua->$method(
diff --git a/FS/FS/part_export/ispconfig3.pm b/FS/FS/part_export/ispconfig3.pm
index 3345b3f..9d22d19 100644
--- a/FS/FS/part_export/ispconfig3.pm
+++ b/FS/FS/part_export/ispconfig3.pm
@@ -6,6 +6,7 @@ use base qw( FS::part_export );
 
 use Data::Dumper;
 use SOAP::Lite;
+use IO::Socket::SSL;
 
 =pod
 
@@ -299,7 +300,12 @@ sub api_login {
   }
   $self->{'__ispconfig_session'} = undef;
   $self->{'__ispconfig_client'} =
-    SOAP::Lite->proxy($self->option('soap_location'), ssl_opts => [ verify_hostname => 0 ] )
+    SOAP::Lite->proxy( $self->option('soap_location'),
+                         ssl_opts => [
+                           verify_hostname => 0,
+                           SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE,
+                         ]
+                     )
     || undef;
   unless ($self->{'__ispconfig_client'}) {
     $self->{'__ispconfig_error'} = 'Error creating SOAP client';
diff --git a/FS/FS/part_export/sipwise.pm b/FS/FS/part_export/sipwise.pm
index 8fec013..9d4e336 100644
--- a/FS/FS/part_export/sipwise.pm
+++ b/FS/FS/part_export/sipwise.pm
@@ -5,6 +5,7 @@ use strict;
 
 use FS::Record qw(qsearch qsearchs dbh);
 use Tie::IxHash;
+use IO::Socket::SSL;
 use LWP::UserAgent;
 use URI;
 use Cpanel::JSON::XS;
@@ -801,7 +802,10 @@ sub ua {
   $self->{_ua} ||= do {
     my @opt;
     if ( $self->option('ssl_no_verify') ) {
-      push @opt, ssl_opts => { verify_hostname => 0 };
+      push @opt, ssl_opts => {
+                   verify_hostname => 0,
+                   SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE,
+                 };
     }
     my $ua = LWP::UserAgent->new(@opt);
     $ua->credentials(

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Misc/Geo.pm               |   13 +++++++++++--
 FS/FS/Template_Mixin.pm         |    8 +++++++-
 FS/FS/part_event/Action/http.pm |   12 ++++++++++--
 FS/FS/part_export/http.pm       |   14 ++++++++------
 FS/FS/part_export/ispconfig3.pm |    8 +++++++-
 FS/FS/part_export/sipwise.pm    |    6 +++++-
 6 files changed, 48 insertions(+), 13 deletions(-)




More information about the freeside-commits mailing list