Amavis 在主題中添加垃圾郵件標記,但郵件不是垃圾郵件
我有一個帶有 posfix、amavis 和 spamassassin 的 Debian 10 伺服器。
我管理的另一台伺服器每天都會發送一封郵件,其中不包含任何內容,只有一個 gif 作為附件。我已將 spamassassin 的 local.cf 中的發件人地址列入白名單。
收到的郵件的標頭包含以下內容:
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ~~~.~~~.net X-Spam-Level: X-Spam-Status: No, score=-93.2 required=5.0 tests=ALL_TRUSTED,BAYES_50, DC_GIF_UNO_LARGO,DC_IMAGE_SPAM_TEXT,MISSING_HEADERS,PYZOR_CHECK, SB_GIF_AND_NO_URIS,TVD_SPACE_RATIO,USER_IN_WHITELIST autolearn=no autolearn_force=no version=3.4.2
這表示郵件不被視為垃圾郵件,因為發件人地址在白名單中。
問題是主題欄位包含
[SPAM]
哪個是垃圾郵件標記。這個垃圾郵件標記在我的 spamassassin local.cf 和 amavis 中定義。我還不知道兩者中的哪一個正在添加此垃圾郵件標記。根據amavis的配置,不應該放垃圾標籤,因為我在配置裡有這個
$sa_tag2_level_deflt = 5.0; #add spam tag to subject for score greater than this value $sa_spam_subject_tag = '[SPAM]';
如我們所見,分數較低。amavis 不應添加此垃圾郵件標籤。
那麼如何在主題行中獲取垃圾郵件標籤?
我確定問題出在我的郵件伺服器上,因為當我將該郵件發送到另一個地址時,我沒有收到垃圾郵件標籤。
另一個奇怪的事情是,當我從桌面發送具有相同發件人地址的完全相同的郵件時,它沒有收到垃圾郵件標籤。
編輯:我有另外兩封郵件的 amavis 行為不一致。
通過一封郵件,我有這個:
Received: from localhost by xxx.xxx.net with SpamAssassin (version 3.4.2); Wed, 11 Nov 2020 17:08:01 +0100 From: huixin0010 <huixin0010@126.com> Subject: [*SPAM*] [~SPAM~]Re: Leather bags manufacturer with 14 years experience X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on xxx.xxx.net X-Spam-Flag: YES X-Spam-Level: ****** X-Spam-Status: Yes, score=6.3 required=5.0 tests=BAYES_50,DEAR_SOMETHING, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,HTML_MIME_NO_HTML_TAG,MIME_HTML_ONLY,PYZOR_CHECK, RCVD_IN_MSPIKE_BL,RCVD_IN_MSPIKE_L5,RDNS_NONE,T_SPF_HELO_PERMERROR autolearn=no autolearn_force=no version=3.4.2
[*SPAM*]
spamassassin 添加[~SPAM~]
的垃圾郵件標籤和 amavis 添加的垃圾郵件標籤在哪裡。規則設置為 amavis 在分數高於 5 時添加垃圾郵件標籤。
出乎意料的是下面這封郵件,即使分數高於 5,amavis 也沒有在主題中添加垃圾郵件標籤。
Received: from localhost by xxx.xxx.net with SpamAssassin (version 3.4.2); Wed, 11 Nov 2020 18:08:24 +0100 From: liyulan029 <liyulan029@126.com> To: xxx <xxx@xxx.net> Subject: [*SPAM*] Re: new design eyeglasses frame and sunglasses Date: Thu, 12 Nov 2020 01:10:33 +0800 (CST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on xxx.xxx.net X-Spam-Flag: YES X-Spam-Level: ****** X-Spam-Status: Yes, score=6.2 required=5.0 tests=BAYES_50,DEAR_SOMETHING, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,HTML_MIME_NO_HTML_TAG,MIME_HTML_ONLY,RCVD_IN_RP_RNBL, RDNS_NONE autolearn=no autolearn_force=no version=3.4.2
這兩個郵件之間的伺服器上沒有任何變化。
有兩個主要問題。
第一個是我試圖變得聰明並使用兩組不同的規則配置 amavis。一個用於外部來源的郵件,另一個用於內部來源的郵件(送出到埠 587 或 465 的郵件)。這使得 postfix 和 amavis 的配置更加複雜。它可能有錯誤。
第二個是那個,
final_virus_destiny
並且final_spam_destiny
配置了D_PASS
. 它們現在配置為D_DISCARD
. 可能是在D_PASS
mode下,amavis有問題。我不知道。現在,通過D_DISCARD
, 郵件被隔離,並向郵局主管發送報告。這是儲存在
/etc/amavis/conf.d/99-local
.use strict; # Place your configuration directives here. They will override those in # earlier files. # -- General configuration options $myhostname = 'smtp.xxx.xxx'; @local_domains_acl = (".xxx.xxx",".yyy.yyy"); @mynetworks = qw(127.0.0.0/8 ::1/128); $X_HEADER_LINE = "by Amavis at $mydomain"; # Customize header line (don’t show version) #$log_level = 5; # -- Parameters for anti-virus @bypass_virus_checks_maps = ( \%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re); $final_virus_destiny = D_DISCARD; # Quarantine virus mails for science $virus_admin = "postmaster\@$mydomain"; # Where to send virus notification (the default) # -- Parameters for anti-spam @bypass_spam_checks_maps = ( \%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re); $final_spam_destiny = D_DISCARD; # Quarantine spam mails for recovery if no spam $spam_admin = "postmaster\@$mydomain"; # Where to send spam notification $sa_tag_level_deflt = -999; # Add X-Spam headers when score is above that level $sa_tag2_level_deflt = 5.0; # Add spam subject tag when score above that level $sa_spam_subject_tag = '[SPAM] '; # Spam subject tag $sa_kill_level_deflt = 5.0; # DISCARD mail when score is above that level # -- Parameters for banned mails $final_banned_destiny = D_DISCARD; # Quarantine banned mails for debugging $banned_admin = "postmaster\@$mydomain"; # Where to send notification # -- Parameters for bad header mails $final_bad_header_destiny = D_DISCARD; # Quarantine bad header mails for debugging $bad_header_admin = "postmaster\@$mydomain"; # Where to send notification ... <skip dkim configuration> ... 1; # ensure a defined return