ContentsBRTableOfContents(2) |
Introduction
This will detail setting up a complete mail server using the following: Ubuntu 5.10, Postfix, Courier, Amavis-new, ClamAV and SpamAssassin. The end result will send & recieve email using sasl authentication, check incoming email vs the spamhaus.org known spammer list, filter all incoming email through amavis-new which will then run virus scanning & also check for spam. If viruses are found the email is dumped, if spam is found the subject is relabeled '***SPAM***'.
It is required to activate Universe and Multiverse repositories. Just follow this howto: ["AddingRepositoriesHowto"].
Prerequisite
You must be comfortable on the command line & have a reasonable knowledge of the OS in order to accomplish this. This is not for anyone who considers themselves 'new'.
Installation
For beginning, install the main components of the mail system:
apt-get install postfix postfix-tls libsasl2 sasl2-bin libsasl2-modules libdb3-util procmail courier-authdaemon courier-imap courier-imap-ssl courier-pop courier-pop-ssl
Next install the filtering packages:
sudo apt-get install amavisd-new spamassassin clamav-daemon clamav-freshclam
Install the optional packages for increased spam protection:
sudo apt-get install libnet-dns-perl libmail-spf-query pyzor razor
Install some compress/uncompress utils (this allows the filters to scan compressed archives)
sudo apt-get install arj bzip2 cabextract cpio file gzip lha nomarch pax unzip unzoo zip zoo
Configuration
clamav
The default behaviour of clamav will fit our needs. A daemon is launched (clamd) and signatures are fetch every day. If you want to tun clamav functionnement, check configuration files in /etc/clamav.
Add clamav user in amavis in order clamav can access files:
sudo useradd clamav amavis
spamassassin
spamasssassin has a cool feature: it autodetects optionnal components and in case they are presents; it use it. It results there is no need to configure dcc-client, pyzor and razor.
We will not talk about fine tuning of spamassassin rules here. Please refer to the ["Spamassassin"] page.
Edit /etc/default/spamassassin to activate daemon file:
8<----------------------------------------- # Change to one to enable spamd ENABLED=1 8<-----------------------------------------
amavis
Postfix integration
For postfix integration, you only need to add in /etc/postfix/main.cf the following line:
content_filter=smtp-amavis:[127.0.0.1]:10024
Reload postfix, and now, content filtering with spam and virus detection is enabled.