public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api 1/2] user-bl: use custom description of USER_IN_BLACKLIST consistently
Date: Mon, 28 Nov 2022 19:17:28 +0100	[thread overview]
Message-ID: <20221128181729.63076-2-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20221128181729.63076-1-s.ivanov@proxmox.com>

The USER_IN_BLACKLIST spamassassin hit is created by the Spam What
object, if the sending e-mail is in the receivers blacklist.
This 'hit' is kept on the PMG only - it is not written to the SPAMINFO
macro - and only visible in the quarantine interface afaict.

The description shown in the quarantine interface, however is read
from SpamAssassin sources.

They have recently changed to include a 'DEPRECATED' prefix, since the
rules containing 'blacklist' and 'whitelist' have been renamed to
'blocklist' and 'welcomelist' for the upcoming 4.0 series of
spamassassin.

In any case we should keep our description consistent, thus the move
to a sub of its own for reusing in both locations.

The mechanism for welcomlisted/whitelisted mails does not create an
'internal' sa-rule (but simply drops the SA hits for analysis) - so no
symmetric change is needed.

Reported-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/PMG/RuleDB/Spam.pm | 2 +-
 src/PMG/Utils.pm       | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/PMG/RuleDB/Spam.pm b/src/PMG/RuleDB/Spam.pm
index bc1d422..d7bfb63 100644
--- a/src/PMG/RuleDB/Spam.pm
+++ b/src/PMG/RuleDB/Spam.pm
@@ -221,7 +221,7 @@ sub what_match_targets {
 		sa_data => [{
 		    rule => 'USER_IN_BLACKLIST',
 		    score => 100,
-		    desc => 'From: address is in the user black-list',
+		    desc => PMG::Utils::user_bl_description(),
 		}],
 		sa_hits => 'USER_IN_BLACKLIST',
 	    };
diff --git a/src/PMG/Utils.pm b/src/PMG/Utils.pm
index e20fc91..b9b1478 100644
--- a/src/PMG/Utils.pm
+++ b/src/PMG/Utils.pm
@@ -1166,6 +1166,10 @@ sub bencode_header {
     return $res;
 }
 
+sub user_bl_description {
+    return 'From: address is in the user black-list';
+}
+
 sub load_sa_descriptions {
     my ($additional_dirs) = @_;
 
@@ -1202,6 +1206,7 @@ sub load_sa_descriptions {
     }
 
     $res->{'ClamAVHeuristics'}->{desc} = "ClamAV heuristic tests";
+    $res->{'USER_IN_BLACKLIST'}->{desc} = user_bl_description();;
 
     return $res;
 }
-- 
2.30.2





  reply	other threads:[~2022-11-28 18:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 18:17 [pmg-devel] [PATCH pmg-api 0/2] fix deprecation warning for user blocklist hits Stoiko Ivanov
2022-11-28 18:17 ` Stoiko Ivanov [this message]
2022-11-28 18:17 ` [pmg-devel] [PATCH pmg-api 2/2] user accesslists: reword logging and hits for SA 4.0 Stoiko Ivanov
2022-11-29 15:07 ` [pmg-devel] applied-series: [PATCH pmg-api 0/2] fix deprecation warning for user blocklist hits Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221128181729.63076-2-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal