Introduction

ClamAV is the antivirus component while Amavis is the interface that connects Postfix with add-ons such as antispam and antivirus tools.

Installation

First, let’s install what we need:

1
apt-get install amavisd-new clamav clamav-daemon zoo unzip unzoo bzip2

At the end of the installation, it will ask you some questions. Here are the answers you should provide:

1
2
3
4
Virus database update method: <-- daemon
Local database mirror site: <-- db.fr.clamav.net (France; select the mirror that is closest to you)
HTTP proxy information (leave blank for none): <-- (blank)
Should clamd be notified after updates? <-- Yes

Configuration

Next we’ll add these lines to /etc/postfix/main.cf:

1
2
3
# Use Amavis
content_filter = amavis:[127.0.0.1]:10024
receive_override_options = no_address_mappings

Now let’s edit /etc/postfix/master.cf and add:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
amavis unix - - n - 2 smtp
        -o smtp_data_done_timeout=1200
        -o disable_dns_lookups=yes

127.0.0.1:10025 inet n - n - - smtpd
        -o content_filter=
        -o local_recipient_maps=
        -o relay_recipient_maps=
        -o smtpd_restriction_classes=
        -o smtpd_client_restrictions=
        -o smtpd_helo_restrictions=
        -o smtpd_sender_restrictions=
        -o smtpd_recipient_restrictions=permit_mynetworks,reject
        -o mynetworks=127.0.0.0/8
        -o strict_rfc821_envelopes=yes

We restart Postfix and it’s working :-)

1
/etc/init.d/postfix restart

You can test it using the Eicar website.

FAQ

warning: connect to transport amavis: No such file or directory

Here’s the command to reallocate emails:

1
postsuper -r ALL

Then check with:

1
postqueue -p

or

1
mailq

Resources

Last updated 24 Sep 2008, 11:46 CEST. history