4

I have a Postfix mail server, using Amavis and Spamassassin to check for unwanted e-mails. I have removed ClamAV because it'd basically freeze the whole server every time someone received an e-mail, and server-side virus-scanning does not seem to important for my use case.

Spamassassin is still triggered by Amavis, and I'd like to keep it that way.
Basically what I want is for Amavis to stop trying to trigger a virusscan for each e-mail.

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

I've tried commenting out several options in /etc/amavis/conf.d/15-av_scanners, but it's starting to look like if I comment something out it'll just use the default config for that which is the same as what was there in the first place.

# ['ClamAV-clamd',
#   \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.ctl"],
#   qr/\bOK$/m, qr/\bFOUND$/m,
#   qr/^.*?: (?!Infected Archive)(.*) FOUND$/m ],

This is, as you can see, commented out. As a result it simply looks for backup scanners, none of which are present. This, however, still spams the logs with the above messages and delays mail delivery.
Commenting out backup scanners has absolutely no effect on this (in fact when this is commented out it'll still trigger what used to be there if it exists).

How can I configure Amavis to still use Spamassassin, but stop trying to scan every e-mail for virusses?

3 Answers 3

6

Since you want to disable virus checking entirely, the easiest way to do so is find the @bypass_virus_checks_maps line in the Amavis configuration files (amavis.conf or conf.d/50-user) and change it to this;

bypass_virus_checks_maps => [1];
5
  • @RobinJ glad you changed it to fit your distro, you might want to alter the tags in your question so it's accurate (mine is based on my knowledge of CentOS :) )
    – NickW
    May 30, 2014 at 8:26
  • Huh? Is Amavis distro-dependent?
    – RobinJ
    May 30, 2014 at 9:34
  • No, but the way it is configured in your distro is :) It's not a criticism, it just helps people who are searching how to do something on a particular distribution! Thanks, BTW :)
    – NickW
    May 30, 2014 at 9:46
  • 2
    On debian edit /etc/amavis/conf.d/50-user and add the line: @bypass_virus_checks_maps = (1); The answer above with "=>", square brackets and missing leading "@" did not work for me. Aug 6, 2018 at 11:33
  • Well, considering it's 4 years later, they may have updated the syntax :D
    – NickW
    Aug 30, 2018 at 8:45
1

On Ubuntu you can disable anti-virus checks by commenting out the following two lines in /etc/amavis/conf.d/15-content_filter_mode:

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

See: https://help.ubuntu.com/community/PostfixAmavisNew

0

For people who come across this after searching the Web for a long time: I've had to do both steps mentioned individually in the two other answers.

First, I had to comment out (i.e. add '#' characters at the beginning of the lines) the following:

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

Second, I also had to uncomment this:

#@bypass_virus_checks_maps = (1);  # controls running of anti-virus code

Many forums posts, web pages or answers referred to each action but implementing them separately didn't rid the log file of those messages. Implementing both did. NOTE: this was on a CentOS 6 server, on which the amavisd configuration is consolidated into a single file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .