summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2016-04-02 14:39:42 -0700
committerIvan Kohler <ivan@freeside.biz>2016-04-02 14:39:42 -0700
commitf8b487ec9788999ed16e77ff246fa4f34f8d7af1 (patch)
tree5c3e1f500a07e7f51360517511ba9c558f704dec
parent9f913deb1cae1f9d28a531fbd4f0a2363ffe4503 (diff)
really don't verify certificates if asked, deb 8 style
-rw-r--r--FS/FS/Misc/Geo.pm13
-rw-r--r--FS/FS/Template_Mixin.pm8
-rw-r--r--FS/FS/part_event/Action/http.pm10
-rw-r--r--FS/FS/part_export/http.pm14
-rw-r--r--FS/FS/part_export/ispconfig3.pm8
-rw-r--r--FS/FS/part_export/sipwise.pm6
6 files changed, 47 insertions, 12 deletions
diff --git a/FS/FS/Misc/Geo.pm b/FS/FS/Misc/Geo.pm
index 5bba5e0dd..f5edc5693 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 JSON;
use URI::Escape 3.31;
@@ -736,7 +737,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,
@@ -747,7 +753,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 ecf57a66c..8dff768d9 100644
--- a/FS/FS/Template_Mixin.pm
+++ b/FS/FS/Template_Mixin.pm
@@ -2360,6 +2360,7 @@ service.
=cut
use CAM::PDF;
+use IO::Socket::SSL;
use LWP::UserAgent;
use HTTP::Request::Common qw( POST );
use JSON::XS;
@@ -2400,7 +2401,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 b8715a714..b17acb8b5 100644
--- a/FS/FS/part_event/Action/http.pm
+++ b/FS/FS/part_event/Action/http.pm
@@ -2,6 +2,7 @@ package FS::part_event::Action::http;
use strict;
use base qw( FS::part_event::Action );
+use IO::Socket::SSL;
use LWP::UserAgent;
use HTTP::Request::Common;
use JSON::XS;
@@ -60,10 +61,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);
diff --git a/FS/FS/part_export/http.pm b/FS/FS/part_export/http.pm
index 6cac60058..42a35cb07 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 3345b3f06..9d22d1995 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 9559648c6..2585991f8 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 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(