我在virus_name_to_spam_score方面遇到了奇怪的行为。我使用了2个自定义Clamav DB。以下是使用SaneSecurity时的日志,我们可以看到一切正常:
Jun 12 10:57:53 prd-mail-1 amavis[4428]: (04428-01) run_av (ClamAV-clamd) result: /var/lib/amavis/tmp/amavis-20170612T105753-04428-qozS1fmk/parts/p004: Sanesecurity.TestSig_Type4_Hdr.2.UNOFFICIAL FOUND\n
Jun 12 10:57:53 prd-mail-1 amavis[4428]: (04428-01) run_av (ClamAV-clamd): /var/lib/amavis/tmp/amavis-20170612T105753-04428-qozS1fmk/parts INFECTED: Sanesecurity.TestSig_Type4_Hdr.2.UNOFFICIAL
Jun 12 10:57:53 prd-mail-1 amavis[4428]: (04428-01) lookup_re("Sanesecurity.TestSig_Type4_Hdr.2.UNOFFICIAL") matches key "(?^:^Sanesecurity\\.TestSig_)", result=undef
Jun 12 10:57:53 prd-mail-1 amavis[4428]: (04428-01) lookup [virus_name_to_spam_score] => undef, "Sanesecurity.TestSig_Type4_Hdr.2.UNOFFICIAL" does not match
Jun 12 10:57:53 prd-mail-1 amavis[4428]: (04428-01) virus_scan: (Sanesecurity.TestSig_Type4_Hdr.2.UNOFFICIAL), detected by 1 scanners: ClamAV-clamd
Jun 12 10:57:53 prd-mail-1 amavis[4428]: (04428-01) lookup_re("Sanesecurity.TestSig_Type4_Hdr.2.UNOFFICIAL") matches key "(?^:.*)", result="1"
Jun 12 10:57:53 prd-mail-1 amavis[4428]: (04428-01) lookup [viruses_that_fake_sender] => true, "Sanesecurity.TestSig_Type4_Hdr.2.UNOFFICIAL" matches, result="1", matching_key="(?^:.*)"
Jun 12 10:57:53 prd-mail-1 amavis[4428]: (04428-01) Virus Sanesecurity.TestSig_Type4_Hdr.2.UNOFFICIAL matches (?^:.*), sender addr ignored
现在,当使用 SecurityInfo.com 时,我可以看到第一次运行时检测到了病毒,但随后 virus_name_to_spam_score 为空。我试图使用 @virus_name_to_spam_score_maps 将来自此列表的电子邮件设置为垃圾邮件,但由于检查为空,因此返回未发送的邮件,并且它们始终被标记为病毒。以下是日志:
Jun 12 09:25:32 prd-mail-1 amavis[18890]: (18890-02) prolong_timer run_av_3: timer 288, was 288, deadline in 479.8 s
Jun 12 09:25:32 prd-mail-1 amavis[18890]: (18890-02) run_av (ClamAV-clamd) result: /var/lib/amavis/tmp/amavis-20170612T092354-18890-TNOnpS50/parts/p013: SecuriteInfo.com.Spam-4703.UNOFFICIAL FOUND\n/var/lib/amavis/tmp/amavis-20170612T092354-18890-TNOnpS50/parts/p009: SecuriteInfo.com.Spam-4703.UNOFFICIAL FOUND\n
Jun 12 09:25:32 prd-mail-1 amavis[18890]: (18890-02) run_av (ClamAV-clamd): /var/lib/amavis/tmp/amavis-20170612T092354-18890-TNOnpS50/parts INFECTED:
Jun 12 09:25:32 prd-mail-1 amavis[18890]: (18890-02) lookup_re(""), no matches
Jun 12 09:25:32 prd-mail-1 amavis[18890]: (18890-02) lookup [virus_name_to_spam_score] => undef, "" does not match
Jun 12 09:25:32 prd-mail-1 amavis[18890]: (18890-02) virus_scan: (), detected by 1 scanners: ClamAV-clamd
Jun 12 09:25:32 prd-mail-1 amavis[18890]: (18890-02) lookup_re("") matches key "(?^:.*)", result="1"
Jun 12 09:25:32 prd-mail-1 amavis[18890]: (18890-02) lookup [viruses_that_fake_sender] => true, "" matches, result="1", matching_key="(?^:.*)"
Jun 12 09:25:32 prd-mail-1 amavis[18890]: (18890-02) Virus matches (?^:.*), sender addr ignored
Jun 12 09:25:32 prd-mail-1 amavis[18890]: (18890-02) lookup_sql_field(virus_lover) rec=0, "[email protected]" result: undef
知道这是什么原因造成的吗?
答案1
我找到了答案。似乎正在使用的 clamav 扫描仪没有返回正确的值,因此我不得不更改@av_scanners在/etc/amavis/conf.d/50 用户更改为以下内容:
@av_scanners = (
#### http://www.clamav.net/
['ClamAV-clamd',
\&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.ctl"],
qr/\bOK$/m, qr/\bFOUND$/m,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/m ],
);
并重启 amavis