Cooking with UNIX/Linux
Cooking with UNIX/Linux > Courier-ClamAV-Amavis combo

Courier-ClamAV-Amavis combo

COURIER-CLAMAV-AMAVIS RECIPE by Frederik Dannemare

  # It is assumed that Courier has already been installed and configured.

1) Install clamav

apt-get install clamav clamav-base clamav-daemon clamav-freshclam clamav-testfiles lha arj unrar zoo unzoo nomarch lzop

  # Test that clamav works:

clamscan -r /usr/share/clamav-testfiles


2) Install stuff that amavis depends on

  # You'll need different tools like lha, unarj, uncompress, unrar,
  # unzip and zoo (just 'apt-get' them) in order to compile amavis.

  # You'll also need arc (couldn't find a deb, so using an rpm instead):

wget ftp://rpmfind.net/linux/contrib/libc6/i386/arc-5.21e-6.i386.rpm
alien arc-5.21e-6.i386.rpm
dpkg -i arc_5.21e-7_i386.deb

  # When compiling amavis 'make' will complain about undefined macros
  # unless you have acx_pthread in the directory printed by
  # 'aclocal --print-ac-dir' (probably /usr/share/aclocal).

wget http://www.gnu.org/software/ac-archive/m4source/acx_pthread.m4
cp acx_pthread.m4 /usr/share/aclocal/


3) Build and install amavis

Grab the source (and a patch - credits go to Jim Gifford) for amavis here:
http://www.amavis.org/dist/perl/amavis-0.3.12.tar.gz
http://www.amavis.org/contrib/amavis-courier.patch.2

tar zxvf amavis-0.3.12.tar.gz
cd amavis-0.3.12
cat ../amavis-courier.patch.2 | patch -p1
./configure --prefix=/usr/local/amavis --enable-courier \
--with-runtime-dir=/usr/local/amavis/var \
--with-logdir=/usr/local/amavis/var \
--with-amavisuser=amavis \
--with-virusdir=/usr/local/amavis/virusmails \
--with-mailfrom=postmaster \
--with-mailto=postmaster \
--enable-credits
make
make install


4) amavis <-> courier integration

  # Define the DEFAULTDELIVERY in /etc/courier/courierd to be:

DEFAULTDELIVERY="| /usr/local/amavis/sbin/amavis | /usr/bin/maildrop"