description => "Whitelist legitimate bounce relays.",
type => 'string',
},
+ safe_browsing_score => {
+ description => "Score for mails listed in Google Safe Browsing database.",
+ type => 'integer',
+ minimum => 0,
+ maximum => 1000,
+ default => 3,
+ },
bounce_score => {
description => "Additional score for bounce mails.",
type => 'integer',
wl_bounce_relays => { optional => 1 },
languages => { optional => 1 },
use_bayes => { optional => 1 },
+ safe_browsing_score => { optional => 1 },
bounce_score => { optional => 1 },
rbl_checks => { optional => 1 },
maxspamsize => { optional => 1 },
}
$queue->{all_from_addrs} = [ keys %$fromhash ];
+ if (my $hit = $queue->{safe_browsing}) {
+ my $score = $queue->{safe_browsing_score};
+ my $descr = "Found in Google Safe Browsing database.";
+ my $rule = 'Safebrowsing';
+ $sa_score += $score;
+ $list .= $list ? ",$rule" : $rule;
+ push @$sa_scores, { score => $score, rule => $rule, desc => $descr };
+ }
+
my ($csec, $usec) = gettimeofday ();
my $spamtest = $queue->{sa};
- # only run SA in testmode or when commtouch did not confirm spam (score < 5)
+ # only run SA in testmode or when safe_browsing did not confirm spam (score < 5)
# do not run SA if mail is too large
if (($queue->{bytes} <= $maxspamsize) &&
($msginfo->{testmode} || ($sa_score < 5))) {
}
}
+ $res->{'Safebrowsing'}->{desc} = "Found in Google Safe Browsing database.";
+
return $res;
}
$queue = $smtp->{queue};
$queue->{sa} = $self->{sa};
+ $queue->{safe_browsing_score} = $pmg_cfg->get('spam', 'safe_browsing_score');
$queue->{lic_valid} = 1;
# test for virus first
- $queue->{vinfo} = PMG::Utils::analyze_virus(
+ my $vinfo = PMG::Utils::analyze_virus(
$queue, $queue->{dataname}, $pmg_cfg, $opt_testmode);
+ if ($vinfo =~ m/^Safebrowsing\.(.+)$/) {
+ my $hit = $1;
+ $self->log(3, "$queue->{logid}: Google Safe Browsing database hit '%s'", $hit);
+ $queue->{safe_browsing} = $hit;
+ $vinfo = undef;
+ }
+
+ $queue->{vinfo} = $vinfo;
+
# always add this headers to incoming mails
# to enable user to report false negatives
if (!$msginfo->{trusted}) {