我在 SpamAssassin 设置中制定了一系列自定义规则。当我启动服务 ( systemctl start spamassassin
) 时,这些规则会在我的测试垃圾邮件上正确评估:
[antek@mailgate ~]$ cat /tmp/spam.txt | spamc -R -l
23.4/5.0
Spam detection software, running on the system "mailgate.anadoxin.org",
has identified this incoming email as possible spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: jeśli wiadomość nie wyświetliła się poprawnie, kliknij
tutaj by przejść do oferty. astra jesienne ceny opla od 89 900 zł lub
760 zł netto/mies. f gg 9086 sprawdź opel niniejszy materiał ni [...]
Content analysis details: (23.4 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
-5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high
trust
[91.185.184.51 listed in list.dnswl.org]
0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked.
See
http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
for more information.
[URI: xya.pl]
[URI: doubleclick.net]
[URI: dobrebazy.pl]
[URI: brightsender.pl]
[URI: ddtracker.pl]
[URI: lrmailr.pl]
-0.0 SPF_HELO_PASS SPF: HELO matches SPF record
-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's
domain
-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid
-0.5 BAYES_05 BODY: Bayes spam probability is 1 to 5%
[score: 0.0121]
2.5 GENERIC_MAILING mailing@ in From: email address
20 NIP_SPAM_1 BODY: No description available.
0.5 NUMER_NIP BODY: No description available.
1.0 KLIKNIJ_TUTAJ BODY: No description available.
1.0 OFERT BODY: Ofert
0.2 BAD_WORDS_2 BODY: No description available.
0.0 HTML_MESSAGE BODY: HTML included in message
0.0 HTML_IMAGE_RATIO_02 BODY: HTML has a low ratio of text to image area
0.3 CEN_IN_BODY RAW: cen
-0.3 CENTER_IN_BODY RAW: No description available.
0.5 UNSUBSCRIBE RAW: Unsubscribe in body
0.5 NO_TO_NAME No Real Name in To: header
0.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors
in HTML
0.9 RAZOR2_CHECK Listed in Razor2 (http://razor.sf.net/)
1.9 RAZOR2_CF_RANGE_51_100 Razor2 gives confidence level above 50%
[cf: 100]
...但是当我在第一次尝试后再次使用“spamc”评估电子邮件时,我的自定义规则不再存在,并且电子邮件不会被评估为垃圾邮件:
-2.8/5.0
Spam detection software, running on the system "mailgate.anadoxin.org",
has NOT identified this incoming email as spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: jeśli wiadomość nie wyświetliła się poprawnie, kliknij
tutaj by przejść do oferty. astra jesienne ceny opla od 89 900 zł lub
760 zł netto/mies. f gg 9086 sprawdź opel niniejszy materiał ni [...]
Content analysis details: (-2.8 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
-5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high
trust
[91.185.184.51 listed in list.dnswl.org]
0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked.
See
http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
for more information.
[URI: xya.pl]
[URI: doubleclick.net]
[URI: ddtracker.pl]
[URI: brightsender.pl]
[URI: dobrebazy.pl]
[URI: lrmailr.pl]
-0.0 SPF_HELO_PASS SPF: HELO matches SPF record
-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's
domain
-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid
-0.5 BAYES_05 BODY: Bayes spam probability is 1 to 5%
[score: 0.0121]
0.0 HTML_MESSAGE BODY: HTML included in message
0.0 HTML_IMAGE_RATIO_02 BODY: HTML has a low ratio of text to image area
0.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors
in HTML
0.9 RAZOR2_CHECK Listed in Razor2 (http://razor.sf.net/)
1.9 RAZOR2_CF_RANGE_51_100 Razor2 gives confidence level above 50%
[cf: 100]
对于使用“spamc”的任何后续测试,该结果都是相同的。
当我重新启动 spamassassin 服务时,我再次得到“这封电子邮件是垃圾邮件”的结论,因为我的自定义规则已被评估,但同样仅适用于第一次尝试。任何后续调用都会忽略我的自定义规则,并且电子邮件不再是垃圾邮件。
当我spamd
在调试模式下运行时,它会看到我的自定义配置文件,但不会加载它们,因为它们“已加载”;这是 spamassassin 中的错误吗?
Oct 18 07:51:51.935 [1105763] dbg: prefork: ordered 1105768 to accept
Oct 18 07:51:51.938 [1105768] dbg: spamd: select() on fd bit field 00000110, timeout 0.5, not locked
Oct 18 07:51:51.939 [1105763] dbg: prefork: sysread(7) not ready, wait max 300.0 secs
Oct 18 07:51:51.941 [1105768] dbg: spamd: accept() on fd 5
Oct 18 07:51:51.943 [1105763] dbg: prefork: child 1105768: entering state 2
Oct 18 07:51:51.944 [1105763] dbg: prefork: new lowest idle kid: 1105769
Oct 18 07:51:51.951 [1105768] dbg: netset: cached lookup on ::1, 2 networks, result: 1
Oct 18 07:51:51.952 [1105768] info: spamd: connection from ::1 [::1]:44452 to port 783, fd 5
Oct 18 07:51:51.954 [1105768] dbg: util: get_user_groups: uid is 1000
Oct 18 07:51:51.956 [1105768] dbg: util: get_user_groups: added 10 (wheel) to group list which is now: 1000 10
Oct 18 07:51:51.959 [1105768] info: spamd: setuid to antek succeeded
Oct 18 07:51:51.961 [1105768] dbg: config: parsing file /home/antek/.spamassassin/user_prefs
Oct 18 07:51:51.963 [1105768] dbg: config: fixed relative path: /home/antek/.spamassassin/custom.cf
Oct 18 07:51:51.964 [1105768] dbg: config: using "/home/antek/.spamassassin/custom.cf" for included file
Oct 18 07:51:51.966 [1105768] dbg: config: skipping already read file: /home/antek/.spamassassin/custom.cf
Oct 18 07:51:51.967 [1105768] dbg: config: parsing file /home/antek/.spamassassin/user_prefs
Oct 18 07:51:51.968 [1105768] dbg: config: fixed relative path: /home/antek/.spamassassin/playfire.cf
Oct 18 07:51:51.969 [1105768] dbg: config: using "/home/antek/.spamassassin/playfire.cf" for included file
Oct 18 07:51:51.970 [1105768] dbg: config: skipping already read file: /home/antek/.spamassassin/playfire.cf
Oct 18 07:51:51.971 [1105768] dbg: config: parsing file /home/antek/.spamassassin/user_prefs
Oct 18 07:51:51.972 [1105768] dbg: config: fixed relative path: /home/antek/.spamassassin/listonic.cf
Oct 18 07:51:51.973 [1105768] dbg: config: using "/home/antek/.spamassassin/listonic.cf" for included file
Oct 18 07:51:51.974 [1105768] dbg: config: skipping already read file: /home/antek/.spamassassin/listonic.cf
[... snip ...]
这里可能有什么问题?
目前,当我更改源代码时它可以工作:
1887 sub read_cf_file {
1888 my($self, $path) = @_;
1889 my $txt = '';
1890
1891 #if ($self->{cf_files_read}->{$path}++) {
1892 #dbg("config: skipping already read file: $path");
1893 #return $txt;
1894 #}
但我的印象是这应该以更好的方式解决:)