Self signed certificates support

Reconfigure LWP to ignore certificate errors.
This commit is contained in:
Skibbi 2014-01-29 12:51:49 +01:00
parent da62ef9da8
commit a379718f4b
1 changed files with 5 additions and 0 deletions

View File

@ -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;