From a379718f4b44928ac7184d956131b5dedaaa80f4 Mon Sep 17 00:00:00 2001 From: Skibbi Date: Wed, 29 Jan 2014 12:51:49 +0100 Subject: [PATCH] Self signed certificates support Reconfigure LWP to ignore certificate errors. --- lib/emailreports.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/emailreports.pm b/lib/emailreports.pm index 27389c4..45e7826 100644 --- a/lib/emailreports.pm +++ b/lib/emailreports.pm @@ -37,6 +37,8 @@ sub emailreports_send { my $base_cgi = $config->{base_cgi}; my $imgs_dir = $config->{imgs_dir}; my $images; + + my $self_signed_certs = $config->{use_self_signed_certificates}; logger("$myself: sending $report reports."); @@ -84,6 +86,9 @@ EOF # generate the graphs and get the html source my $url = $emailreports->{url_prefix} . $base_cgi . "/monitorix.cgi?mode=localhost&graph=_$g&when=$when&color=white"; my $ua = LWP::UserAgent->new(timeout => 30); + if ($self_signed_certs == 1) { + $ua->ssl_opts(verify_hostname => 0); + } my $response = $ua->request(HTTP::Request->new('GET', $url)); my $data = $response->content;