The Perfect SpamSnake - Ubuntu 8.04 LTS

Postfix w/Bayesian Filtering and Anti-Backscatter (Relay Recipients), Apache, Mysql, Bind, MailScanner (Spamassassin, ClamAV, Pyzor, Razor, DCC-Client), MailWatch, SPF Checks, FuzzyOcr, PDF/XLS/Phishing Sanesecurity Signatures, Postfix-GLD (Greylisting Optional), Logwatch Statistical Reporting (Optional), Outgoing Disclaimer with alterMIME (Optional)

Version 2.0
Author: Mohammed Alli

This tutorial shows how to set up an Ubuntu Hardy Heron (8.04 LTS) based server as a spamfilter in Gateway mode. In the end, you will have a SpamSnake Gateway which will relay clean emails to your MTA. You will also be able to view your incoming queue, train your SpamSnake and carry out a few more advanced operations via MailWatch.

I cannot offer any guarantees that this will work for you, the same way it’s working for me.

I will use the following software:

  • Web Server: Apache 2.2 with PHP 5.2.4 and Ruby
  • Database Server: MySQL 5.0
  • Mail Server: Postfix
  • DNS Server: BIND9
  • PHP: PHP5
  • MailScanner: MailScanner v4.68.8
  • MailWatch: MailWatch v1.0.4

Credit goes to the guys at HowToForge and the developers of MailScanner and MailWatch.

1 Requirements

To install such a system you will need the following:

1.1 Preliminary Note

In this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100 and the gateway 192.168.0.1. These settings might differ for you, so you have to replace them where appropriate.

1.2 The Base System

1. Insert your Ubuntu install CD into your system and boot from it. Select your language:


2. Select Install to the hard disk:

3. The installation starts, choose your language again:

4. Then select your location:

Choose a keyboard layout (you will be asked to press a few keys, and the installer will try to detect your keyboard layout based on the keys you pressed):

5. The installer checks the installation CD, your hardware, and configures the network with DHCP if there is a DHCP server in the network:



Enter the hostname. In this example, my system is called server1.example.com, so I enter server1:

6. Now you have to partition your hard disk. For simplicity's sake I will create one big partition (with the mount point /) and a little swap partition so I select Guided - use entire disk (of course, the partitioning is totally up to you - if you like, you can create more than just one big partition, and you can also use LVM):

Select the disk that you want to partition:

When you're finished, hit Yes when you're asked Write the changes to disks?:


Afterwards, your new partitions are being created and formatted.

7. Create a user, for example the user Administrator with the user name administrator (don't use the user name admin as it is a reserved name on Ubuntu 8.04):



8. The only item I select here is OpenSSH server so that I can immediately connect to the system with an SSH client such as PuTTY after the installation has finished:

9. The GRUB boot loader gets installed:

10. The base system installation is now finished. Remove the installation CD from the CD drive and hit Continue to reboot the system:



The Perfect SpamSnake - Ubuntu 8.04 LTS - Page 02
The Perfect SpamSnake - Ubuntu 8.04 LTS - Page 03

The Perfect SpamSnake - Ubuntu 8.04 LTS - Page 06
The Perfect SpamSnake - Ubuntu 8.04 LTS - Page 07