![spamassassin 不尊重 local.cf](https://rvso.com/image/112009/spamassassin%20%E4%B8%8D%E5%B0%8A%E9%87%8D%20local.cf.png)
我更新了我的/etc/spamassassin/local.cf
spamassassin 檔案來更新一些評分規則。但是,即使重新啟動 spamassassin(通過服務)後,新分數也不會顯示在垃圾郵件中。事實上,該文件中的任何內容似乎都不會影響 spamassassin 的工作方式。
我使用 exim 作為我的 MTA,但這應該不重要。所有軟體包均透過 apt-get 安裝,最新版本為 14.04。
例如,我有這個:
score HTML_MESSAGE 2.0
定義在/etc/spamassassin/local.cf
.我重新啟動了 exim 和 spamassassin。 spamassassing --lint
顯示帽子檔案中沒有錯誤。然後又收到了另一封垃圾郵件:
0.0 HTML_MESSAGE BODY: HTML included in message
在 X-Spam-Report 欄位中。
我運行了一下spamassassin -D < spam
,cfg檔案的載入順序似乎是錯誤的:
Jun 8 13:34:07.300 [21668] dbg: config: read file /etc/spamassassin/local.cf
...
Jun 8 13:34:07.600 [21668] dbg: config: read file /var/lib/spamassassin/3.004000/updates_spamassassin_org/50_scores.cf
...
Jun 8 13:34:07.787 [21668] dbg: config: read file /var/lib/spamassassin/3.004000/updates_spamassassin_org/73_sandbox_manual_scores.cf
Jun 8 13:34:07.788 [21668] dbg: config: fixed relative path: /var/lib/spamassas
sin/3.004000/updates_spamassassin_org/local.cf
...
到底是怎麼回事?
基於評論森提曼:我嘗試了strace -f -e trace=file spamassassin -D < spam
相同的結果:Spamassassin 在 local.cf 檔案之後讀取系統檔案。因此,丟棄任何分數變化。
根據評論,這是該local.cf
文件,或多或少是普通文件。
# This is the right place to customize your installation of SpamAssassin.
#
# See 'perldoc Mail::SpamAssassin::Conf' for details of what can be
# tweaked.
#
# Only a small subset of options are listed below
#
###########################################################################
# Add *****SPAM***** to the Subject header of spam e-mails
#
rewrite_header Subject *****SPAM*****
add_header spam Flag _YESNOCAPS_
add_header all Checker-Version SpamAssassin _VERSION_ (_SUBVERSION_) on _HOSTNAME_
add_header all Status _YESNO_, score=_SCORE_ required=_REQD_ tests=_TESTS_ autolearn=_AUTOLEARN_ bayes=_BAYES_
add_header all Report _SUMMARY_
# Save spam messages as a message/rfc822 MIME attachment instead of
# modifying the original message (0: off, 2: use text/plain instead)
#
# report_safe 1
# Set which networks or hosts are considered 'trusted' by your mail
# server (i.e. not spammers)
#
# trusted_networks 212.17.35.
# Set file-locking method (flock is not safe over NFS, but is faster)
#
# lock_method flock
# Set the threshold at which a message is considered spam (default: 5.0)
#
required_score 5.0
# Use Bayesian classifier (default: 1)
#
use_bayes 1
bayes_path /var/lib/spamassassin/bayes/bayes
bayes_file_mode 0777
# Bayesian classifier auto-learning (default: 1)
#
bayes_auto_learn 1
# Set headers which may provide inappropriate cues to the Bayesian
# classifier
#
bayes_ignore_header X-Bogosity
bayes_ignore_header X-Spam-Flag
bayes_ignore_header X-Spam-Status
# Some shortcircuiting, if the plugin is enabled
#
ifplugin Mail::SpamAssassin::Plugin::Shortcircuit
#
# default: strongly-whitelisted mails are *really* whitelisted now, if the
# shortcircuiting plugin is active, causing early exit to save CPU load.
# Uncomment to turn this on
#
shortcircuit USER_IN_WHITELIST on
shortcircuit USER_IN_DEF_WHITELIST on
shortcircuit USER_IN_ALL_SPAM_TO on
shortcircuit SUBJECT_IN_WHITELIST on
# the opposite; blacklisted mails can also save CPU
#
shortcircuit USER_IN_BLACKLIST on
shortcircuit USER_IN_BLACKLIST_TO on
shortcircuit SUBJECT_IN_BLACKLIST on
# if you have taken the time to correctly specify your "trusted_networks",
# this is another good way to save CPU
#
# shortcircuit ALL_TRUSTED on
# and a well-trained bayes DB can save running rules, too
#
shortcircuit BAYES_99 spam
shortcircuit BAYES_00 ham
blacklist_from wokfrance.com
blacklist_from brother-mailer.com
blacklist_from *.sd-soft.net
blacklist_from woifrance.com
blacklist_from adimacocl.net
blacklist_from bletspuranawyat.net
blacklist_from sd-soft.net
blacklist_from m1web-track.com
blacklist_from winntoniecline.net
blacklist_from kafod.org
blacklist_from *.kafod.org
blacklist_from [email protected]
blacklist_from *.bhlive.co.uk
blacklist_from *.regionasm.net
blacklist_from regionasm.net
## Tweaks.
score AC_BR_BONANZA 1.0
score ADMITS_SPAM 10.0
score A_HREF_TO_REMOVE 2.0
score DEAR_FRIEND 4.0
score FREEMAIL_FORGED_FROMDOMAIN 4.0
score FREEMAIL_FROM 1.0
score FROM_LOCAL_HEX 9.0
score HTML_MESSAGE 2.0
score RCVD_IN_MSPIKE_BL 2.0
score RCVD_IN_SORBS_WEB 2.0
score RCVD_IN_XBL 3.0
score RDNS_NONE 2.0
score SCVD_IN_DNSWL_BLOCKED 3.0
score T_DKIM_INVALID 1.0
score T_FREEMAIL_DOC_PDF 3.0
score T_REMOTE_IMAGE 3.0
score URIBL_BLOCKED 3.0
score URIBL_DBL_SPAM 3.0
score URIBL_JP_SURBL 3.0
score URIBL_WS_SURBL 3.0
endif # Mail::SpamAssassin::Plugin::Shortcircuit
整個輸出spamassassin -D
對於這個來說太大了。然而,相關行在上面。如果您想了解更多信息,請告訴我要查找什麼,我會添加它。
答案1
問題是你正在設定HTML_MESSAGE得分內短路插入。但該插件預設情況下處於停用狀態。嘗試將分數設定在文件的最後一行,在短路 endif
操作說明:
# Some shortcircuiting, if the plugin is enabled
#
ifplugin Mail::SpamAssassin::Plugin::Shortcircuit
# [...]
endif # Mail::SpamAssassin::Plugin::Shortcircuit
score HTML_MESSAGE 2.0
如果您希望啟用快速方式插件,您需要從/etc/spamassassin/v320.pre文件:
# Shortcircuit - stop evaluation early if high-accuracy rules fire
#
loadplugin Mail::SpamAssassin::Plugin::Shortcircuit
答案2
SpamAssassin 的自述文件討論了 SpamAssassin 讀取其自身資料檔案的複雜方式。
從第 95 行開始閱讀: http://svn.apache.org/viewvc/spamassassin/branches/3.4/README?view=markup#l95
從閱讀內容來看,SpamAssassin(至少在原始的官方來源中)似乎沒有從
/etc/spamassassin/
根本不是,而是來自
/etc/mail/spamassassin/
嘗試將文件移到那裡! :D
答案3
在我的預設設定中,local.cf
我讀到:
# These values can be overridden by editing ~/.spamassassin/user_prefs.cf
# (see spamassassin(1) for details)
您有使用者 spamassassin 設定檔 (~/.spamassassin/user_prefs.cf) 嗎?
也看看這個 perldoc:
perldoc Mail::SpamAssassin::Conf
在裡面使用者偏好我讀到的部分:
使用者首選項 以下選項可用於網站範圍(“local.cf”)和使用者特定(“user_prefs”)設定文件,以自訂 SpamAssassin 處理傳入電子郵件的方式。