# Setup postfix with clamav and spamassassin WITHOUT amavis



I've battled with `amavis` too often and I started to dislike it a little.
So when I wanted to configured my `postfix` setup to scan for viruses
and spam and needed a solution which would work without `amavis`. 

This is what I came up with.

[debian administration](http://www.debian-administration.org/articles/259) 
was kind enough to do the hard work, but this is only the setup for `clamav`
and I also want to spam scan.

# packages
First install the packages you will need

    apt-get install spamassassin spamc clamav clamsmtp

 configuration

This is where I followed the 'Debian administration' article, in
`/etc/clamsmtpd.conf` you must have

    Listen: 127.0.0.1:10025
    OutAddress: 10026

You could also change:

    # A header to add to all scanned email
    Header: X-AV-Checked: ClamAV using ClamSMTP (elektron.atoom.net)

to add your own header to see if the scanning is working.

For `postfix` you must have a few lines in `/etc/postfix/main.cf` that read

    # virus scanning
    content_filter = scan:127.0.0.1:10025
    receive_override_options = no_address_mappings

This is only for virus scanning, for spam scanning you will need to
tweak `/etc/postfix/master.cf` also

    # interface to spamassassin. 
    spamassassin unix -	n	n 	-	-	pipe
	    user=nobody argv=/usr/bin/spamc -f -e
	    /usr/sbin/sendmail -oi -f ${sender} ${recipient}

This will feed the mail directly to `spamc`.

 test it

    /etc/init.d/clamsmtp restart
    /etc/init.d/spamassassin restart
    /etc/init.d/postfix restart

That's it!

