aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2023-08-07 16:58:17 +0900
committerKazuki Yamaguchi <k@rhe.jp>2023-08-07 17:26:50 +0900
commitd220b02137c36a2d1d6e6a28cbfda5492188e303 (patch)
treebbdbb8a749865e12ddd0121b03679cbf7654b629
parent09089a66647050559cc40b6f8c2920091e05b180 (diff)
downloadsmokeping-d220b02137c36a2d1d6e6a28cbfda5492188e303.tar.gz
Use SMTPS and authentication for sending alerts
Not upstreamable. This disables unencrypted sending.
-rw-r--r--cpanfile1
-rw-r--r--lib/Smokeping.pm2
2 files changed, 2 insertions, 1 deletions
diff --git a/cpanfile b/cpanfile
index d10728c..080f286 100644
--- a/cpanfile
+++ b/cpanfile
@@ -22,3 +22,4 @@ requires 'InfluxDB::LineProtocol';
# See: https://github.com/raphaelthomas/InfluxDB-HTTP/issues/10
requires 'JSON::MaybeXS';
requires 'Object::Result';
+requires 'Authen::SASL';
diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm
index 1cd07bf..5b5bb90 100644
--- a/lib/Smokeping.pm
+++ b/lib/Smokeping.pm
@@ -267,7 +267,7 @@ sub sendmail ($$$){
$to = $1 if $to =~ /<(.*?)>/;
my $body = shift;
if ($cfg->{General}{mailhost} and
- my $smtp = Net::SMTP->new([split /\s*,\s*/, $cfg->{General}{mailhost}],Timeout=>5) ){
+ my $smtp = Net::SMTP->new([split /\s*,\s*/, $cfg->{General}{mailhost}],Timeout=>5,SSL=>1) ){
$smtp->auth($cfg->{General}{mailuser}, $cfg->{General}{mailpass})
if ($cfg->{General}{mailuser} and $cfg->{General}{mailpass});
$smtp->mail($from);