]> git.proxmox.com Git - pmg-api.git/commitdiff
rename safe_browsing_score to clamav_heuristic_score
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 11 Dec 2017 11:26:46 +0000 (12:26 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 11 Dec 2017 11:26:46 +0000 (12:26 +0100)
And match any heuristics clamav results.

PMG/Config.pm
PMG/RuleDB/Spam.pm
PMG/Utils.pm
bin/pmg-smtp-filter

index e914c305d75bae0d4b6f015633e081e075b00fc6..402d1563e18f10cba7931f704070b9bafff79051 100755 (executable)
@@ -144,8 +144,8 @@ sub properties {
            description => "Whitelist legitimate bounce relays.",
            type => 'string',
        },
-       safe_browsing_score => {
-           description => "Score for mails listed in Google Safe Browsing database.",
+       clamav_heuristic_score => {
+           description => "Score for ClamaAV heuristics (Google Safe Browsing database, PhishingScanURLs, ...).",
            type => 'integer',
            minimum => 0,
            maximum => 1000,
@@ -179,7 +179,7 @@ sub options {
        wl_bounce_relays => { optional => 1 },
        languages => { optional => 1 },
        use_bayes => { optional => 1 },
-       safe_browsing_score => { optional => 1 },
+       clamav_heuristic_score => { optional => 1 },
        bounce_score => { optional => 1 },
        rbl_checks => { optional => 1 },
        maxspamsize => { optional => 1 },
index aa43f6795591824684b9cb273f490214e517fe5a..53f2e636c78b0a8f74d598efca22a14f8baf0db4 100644 (file)
@@ -348,10 +348,10 @@ sub analyze_spam {
     }
     $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';
+    if (my $hit = $queue->{clamav_heuristic}) {
+       my $score = $queue->{clamav_heuristic_score};
+       my $descr = "ClamAV heuristic test: $hit";
+       my $rule = 'ClamAVHeuristics';
        $sa_score += $score;
        $list .= $list ? ",$rule" : $rule;
        push @$sa_scores, { score => $score, rule => $rule, desc => $descr };
@@ -361,7 +361,7 @@ sub analyze_spam {
 
     my $spamtest = $queue->{sa};
 
-    # only run SA in testmode or when safe_browsing did not confirm spam (score < 5)
+    # only run SA in testmode or when clamav_heuristic did not confirm spam (score < 5)
     # do not run SA if mail is too large
     if (($queue->{bytes} <= $maxspamsize) && 
        ($msginfo->{testmode} || ($sa_score < 5))) {
index 1f773190ff58c4923fdff5b0a1b6f01b4d3bc860..a3520cf757362bf6bfa53e16d752cb4255fe5e75 100644 (file)
@@ -1000,7 +1000,7 @@ sub load_sa_descriptions {
        }
     }
 
-    $res->{'Safebrowsing'}->{desc} = "Found in Google Safe Browsing database.";
+    $res->{'ClamAVHeuristics'}->{desc} = "ClamAV heuristic tests";
 
     return $res;
 }
index 8ede309bc3f7e74ce7e935c1d2528975dc739097..ac2c384b23da09aee60e42eb72b656da8d0f5cb0 100755 (executable)
@@ -624,8 +624,8 @@ sub handle_smtp {
 
     $queue = $smtp->{queue};
     $queue->{sa} = $self->{sa};
-    $queue->{safe_browsing_score} =
-       $opt_testmode ? 100 : $pmg_cfg->get('spam', 'safe_browsing_score');
+    $queue->{clamav_heuristic_score} =
+       $opt_testmode ? 100 : $pmg_cfg->get('spam', 'clamav_heuristic_score');
 
     $queue->{lic_valid} = 1;
 
@@ -674,10 +674,9 @@ sub handle_smtp {
        my $vinfo = PMG::Utils::analyze_virus(
            $queue, $queue->{dataname}, $pmg_cfg, $opt_testmode);
 
-       if ($vinfo && $vinfo =~ m/^Heuristics\.Safebrowsing\.(.+)$/) {
+       if ($vinfo && $vinfo =~ m/^Heuristics\.(.+)$/) {
            my $hit = $1;
-           $self->log(3, "$queue->{logid}: Google Safe Browsing database hit '%s'", $hit);
-           $queue->{safe_browsing} = $hit;
+           $queue->{clamav_heuristic} = $hit;
            $vinfo = undef;
        }