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 clamav clamav-daemon arj
zoo nomarch cpio lzop cabextract apt-listchanges libnet-ldap-perl
libauthen-sasl-perl libdbi-perl libmail-dkim-perl p7zip rpm
unrar-free libsnmp-perl

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_spam_subject_tag      = undef;
$sa_tag2_level_deflt      = 4.00;
$sa_kill_level_deflt      = 4.00;

Now restart amavis with /etc/init.d/amavis restart and check if it is running with

netstat -nap | grep 10024

Configure postfix to use amavis

In /etc/postfix/main.cf

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

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

smtp-amavis unix -      -       n     -       2  smtp
    -o smtp_data_done_timeout=1200
    -o smtp_send_xforward_command=yes
    -o disable_dns_lookups=yes
    -o max_use=20

127.0.0.1:10025 inet n    -       n       -       -     smtpd
    -o content_filter=
    -o smtpd_delay_reject=no
    -o smtpd_client_restrictions=permit_mynetworks,reject
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -o smtpd_data_restrictions=reject_unauth_pipelining
    -o smtpd_end_of_data_restrictions=
    -o smtpd_restriction_classes=
    -o mynetworks=127.0.0.0/8
    -o smtpd_error_sleep_time=0
    -o smtpd_soft_error_limit=1001
    -o smtpd_hard_error_limit=1000
    -o smtpd_client_connection_count_limit=0
    -o smtpd_client_connection_rate_limit=0
    -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_milters
    -o local_header_rewrite_clients=

After reloading postfix you should see that amavis handles the mail in /var/log/mail.log. You might test it with

sendmail john@example.net < /usr/share/doc/spamassassin/examples/sample-spam.txt

<- Previous | Home | Next ->