Disable ClamAV for Amavis

9,256

Solution 1

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];

Solution 2

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

Share:
9,256

Related videos on Youtube

RobinJ
Author by

RobinJ

Updated on September 18, 2022

Comments

  • RobinJ
    RobinJ over 1 year

    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?

  • NickW
    NickW about 10 years
    @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 :) )
  • RobinJ
    RobinJ about 10 years
    Huh? Is Amavis distro-dependent?
  • NickW
    NickW about 10 years
    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 :)
  • Steven Green
    Steven Green almost 6 years
    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.
  • NickW
    NickW almost 6 years
    Well, considering it's 4 years later, they may have updated the syntax :D