Revision 8 as of 2006-08-28 19:32:54

Clear message

IN PROGRESS

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 (optional), 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***'. Postmaster is notified of both for monitoring & updating of rules.

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 the faint of heart. It is required to activate Universe and Multiverse repositories. Just follow this howto: ["AddingRepositoriesHowto"].

Installation

For beginning, install the main components of the mail system:

sudo 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 file arc gzip bzip2 cabextract zip unzip unrar-free cpio tar zoo arj lzop nomarch pax unzoo

Configuration

postfix

Postfix will need a little bit of tweaking before we're done. We'll want to use relay_host to relay outgoing mail through your ISP account (otherwise we'll get a lot of denied outgoing email) and also setup some authentication. The last thing we want is to setup an open mail relay for use by spammers!

Append the follwing to /etc/postfix/main.cf (relayhost definition should match your ISP smtp settings. Contact them for specifics)

# Relay mail thru ISP
relayhost = mail.your-isp.com
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

Create /etc/postfix/sasl_passwd and add your ISP account information. Example: (this should be the same login information you use to check your ISP email)

mail.your-isp.com username:password

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 use clamav for mail filtering, check the configuration files in /etc/clamav.

Add clamav user in amavis in order clamav can access files:

sudo useradd clamav --gid amavis

spamassassin

Spamasssassin will automagically scan for optional components and use them if available. A few of these, which we will use, are the dcc-client, pyzor and razor. These will not need to be configured.

Edit /etc/default/spamassassin to activate the daemon: Edit the following line from ENABLED=0 TO ENABLED=1.

# Change to one to enable spamd
ENABLED=1

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.

Test


CategoryDocumentation