During installation I often had a look in this documentaion. First we have to install all the needed packages

apt-get install amavisd-new spamassassin

Sadly clamav (the virus scanner) is not working in debian stable (lenny). Therefore we add the volatile repositories by adding the following to lines to /etc/apt/sorces.list.

deb http://ftp2.de.debian.org/debian-volatile stable/volatile main
deb-src http://ftp2.de.debian.org/debian-volatile stable/volatile main

Now we can install the clamav-daemon

apt-get update  
apt-get install clamav-daemon
apt-get install pax bzip2 p7zip-full arj

Because amavis is running as the same named user (and group) we should add the clamav user to the amavis group to give the needed permissions.

adduser clamav amavis

Configure amavis

To enable the virus scann or/and the spam scan we have to uncomment the following lines in /etc/amavis/conf.d/15-content_filter_mode

@bypass_virus_checks_maps = ( ...
@bypass_spam_checks_maps = ( ...

Debian should come with a working default config which detects the installed spam and virus scanners. You can watch amavis on /var/log/mail.log to see what has been enabled.

For my config I've overwritten a few default values in /etc/amavis/conf.d/50-user

$final_spam_destiny       = D_PASS;
$spam_quarantine_to       = undef;

$sa_tag_level_deflt       = 0.00;
$sa_tag2_level_deflt      = 5.00;
$sa_kill_level_deflt      = 5.00;
$X_HEADER_LINE = "";

TODO: amavis should read accepted domains from ldap

Configure postfix to use amavis

In /etc/postfix/main.cf

content_filter = amavis:[127.0.0.1]:10024
receive_override_options = no_address_mappings

Finally in /etc/postfix/master.cf we have to create the service

amavis unix - - - - 2 smtp
   -o smtp_data_done_timeout=1200
   -o smtp_send_xforward_command=yes

127.0.0.1:10025 inet 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
   -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks

After starting of amavis you should see that it handles the mail.