Ubuntu

為 Amavis 禁用 ClamAV

  • April 17, 2017

我有一個 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,但停止嘗試掃描每封電子郵件以查找病毒?

由於您想完全禁用病毒檢查,因此最簡單的方法是@bypass_virus_checks_maps在 Amavis 配置文件 (amavis.confconf.d/50-user) 中找到該行並將其更改為該行;

bypass_virus_checks_maps => [1];

在 Ubuntu 上,您可以通過在 /etc/amavis/conf.d/15-content_filter_mode 中註釋掉以下兩行來禁用防病毒檢查:

@bypass_virus_checks_maps = (
   \%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);

請參閱:https ://help.ubuntu.com/community/PostfixAmavisNew

引用自:https://serverfault.com/questions/599405