我有一个 Postfix 邮件服务器,使用 Amavis 和 Spamassassin 检查垃圾邮件。我已删除 ClamAV,因为每次有人收到电子邮件时,它基本上都会冻结整个服务器,而且服务器端病毒扫描对我的用例来说似乎并不重要。
Spamassassin 仍由 Amavis 触发,我希望保持这种状态。
基本上,我希望 Amavis 停止尝试触发针对每封电子邮件的病毒扫描。
May 29 07:49:14 robinj amavis[19859]: (19859-01) (!)connect to /tmp/clamd.socket failed, attempt #1: Can't connect to UNIX socket /tmp/clamd.socket: No such file or directory
May 29 07:49:15 robinj amavis[19859]: (19859-01) (!)connect to /tmp/clamd.socket failed, attempt #1: Can't connect to UNIX socket /tmp/clamd.socket: No such file or directory
May 29 07:49:15 robinj amavis[19859]: (19859-01) (!)ClamAV-clamd: All attempts (1) failed connecting to /tmp/clamd.socket, retrying (2)
May 29 07:49:21 robinj amavis[19859]: (19859-01) (!)connect to /tmp/clamd.socket failed, attempt #1: Can't connect to UNIX socket /tmp/clamd.socket: No such file or directory
May 29 07:49:21 robinj amavis[19859]: (19859-01) (!)ClamAV-clamd av-scanner FAILED: run_av error: Too many retries to talk to /tmp/clamd.socket (All attempts (1) failed connecting to /tmp/clamd.socket) at (eval 139) line 603.\n
May 29 07:49:21 robinj amavis[19859]: (19859-01) (!)WARN: all primary virus scanners failed, considering backups
May 29 07:49:21 robinj amavis[19859]: (19859-01) (!!)AV: ALL VIRUS SCANNERS FAILED
我已经尝试注释掉其中的几个选项/etc/amavis/conf.d/15-av_scanners
,但看起来如果我注释掉某些内容,它只会使用与一开始相同的默认配置。
# ['ClamAV-clamd',
# \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.ctl"],
# qr/\bOK$/m, qr/\bFOUND$/m,
# qr/^.*?: (?!Infected Archive)(.*) FOUND$/m ],
如您所见,此内容已被注释掉。因此,它只是查找备份扫描仪,但这些扫描仪均不存在。然而,这仍会向日志中发送上述消息并延迟邮件传递。
注释掉备份扫描仪对此完全没有影响(事实上,当注释掉此内容时,如果存在,它仍会触发以前存在的内容)。
我该如何配置 Amavis 以仍然使用 Spamassassin,但停止尝试扫描每封电子邮件以查找病毒?
答案1
由于您想完全禁用病毒检查,最简单的方法是@bypass_virus_checks_maps
在 Amavis 配置文件中找到该行(amavis.conf
或conf.d/50-user
)并将其更改为以下内容;
bypass_virus_checks_maps => [1];
答案2
在 Ubuntu 上,您可以通过注释掉 /etc/amavis/conf.d/15-content_filter_mode 中的以下两行来禁用防病毒检查:
@bypass_virus_checks_maps = (
\%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);
答案3
对于那些在网上搜索了很长时间后才遇到此问题的人来说:我必须执行另外两个答案中分别提到的两个步骤。
首先,我必须注释掉以下内容(即在行首添加“#”字符):
@bypass_virus_checks_maps = (
\%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);
其次,我还必须取消对此的注释:
#@bypass_virus_checks_maps = (1); # controls running of anti-virus code
许多论坛帖子、网页或答案都提到了每个操作,但单独执行这些操作并不能消除日志文件中的这些消息。同时执行两个操作则可以。注意:这是在 CentOS 6 服务器上,amavisd 配置被合并到单个文件中。