mirror of https://github.com/mikaku/Monitorix.git
Self signed certificates support
Reconfigure LWP to ignore certificate errors.
This commit is contained in:
parent
da62ef9da8
commit
a379718f4b
|
@ -38,6 +38,8 @@ sub emailreports_send {
|
||||||
my $imgs_dir = $config->{imgs_dir};
|
my $imgs_dir = $config->{imgs_dir};
|
||||||
my $images;
|
my $images;
|
||||||
|
|
||||||
|
my $self_signed_certs = $config->{use_self_signed_certificates};
|
||||||
|
|
||||||
logger("$myself: sending $report reports.");
|
logger("$myself: sending $report reports.");
|
||||||
|
|
||||||
my $uri = URI->new($emailreports->{url_prefix});
|
my $uri = URI->new($emailreports->{url_prefix});
|
||||||
|
@ -84,6 +86,9 @@ EOF
|
||||||
# generate the graphs and get the html source
|
# 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 $url = $emailreports->{url_prefix} . $base_cgi . "/monitorix.cgi?mode=localhost&graph=_$g&when=$when&color=white";
|
||||||
my $ua = LWP::UserAgent->new(timeout => 30);
|
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 $response = $ua->request(HTTP::Request->new('GET', $url));
|
||||||
|
|
||||||
my $data = $response->content;
|
my $data = $response->content;
|
||||||
|
|
Loading…
Reference in New Issue