The Perfect SpamSnake - Ubuntu Jeos 9.10
Postfix w/Bayesian Filtering and Anti-Backscatter (Relay Recipients), Apache, Mysql, Dnsmasq, MailScanner (Spamassassin, ClamAV, Pyzor, Razor, DCC-Client), MailWatch, SPF Checks, FuzzyOcr, Sanesecurity Signatures, SQLGrey, KAM, Scamnailer, FireHOL (Iptables Firewall), Relay Recipients, Webmin (Optional), Outgoing Disclaimer with alterMIME (Optional)
This tutorial shows how to set up an Ubuntu Jeos 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 with PHP 5
• Database Server: MySQL 5.1.37
• Mail Server: Postfix v2.6.5
• Caching DNS Server: Dnsmasq v2.50
• MailScanner: MailScanner v4.78
• MailWatch: MailWatch v1.0.4
Credit goes to the guys at HowToForge and the developers of MailScanner, MailWatch, Clamav, Apache, Mysql and Postfix.
1. Install minimum vm option
Set hostname to server1
2. Default guided partition method
3. Setup user:
4. No auto-updates
5. Install OpenSSH
1. Get root Privileges
Enable the root login by running the following and giving root a password. You can then directly log in as root:
sudo passwd root
Then run the following to update the apt package database:
Run the following to install the latest updates:
If you see that a new kernel gets installed as part of the updates, you should reboot the system afterwards.
2. Configure The Network
Because the Ubuntu installer has configured our system to get its network settings via DHCP, we have to change that now because a server should have a static IP address. Edit /etc/network/interfaces and adjust it to your needs (in this example setup I will use the IP address 192.168.0.100):
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 192.168.0.100 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1
Then restart your network:
Then edit /etc/hosts. Make it look like this:
127.0.0.1 localhost.localdomain localhost 192.168.0.100 server1.example.com server1 # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts
echo server1.example.com > /etc/hostname
Both should show server1.example.com now.
3. Change The Default Shell
/bin/sh is a symlink to /bin/dash, however we need /bin/bash, not /bin/dash. Therefore we do this:
Install dash as /bin/sh? <-- NoInstall a few packages and requirements that are needed later on:
aptitude install binutils cpp fetchmail flex gcc libarchive-zip-perl libc6-dev libcompress-zlib-perl libdb4.6-dev libpcre3 libpopt-dev lynx m4 make ncftp nmap openssl perl perl-modules unzip zip zlib1g-dev autoconf automake1.9 libtool bison autotools-dev g++ build-essential telnet wget gawk