ASSP Anti-Spam Proxy Setup using Postfix
From Debian Wiki
Contents |
Introduction
ASSP is one of the best Anti-Spam proxy's available today. I have personally been using ASSP for a couple of years now and I have never seen better results in fighting Spam than with ASSP. Other comparative tools such as Spamassassin, Razor, Pyzor and Dcc haven't worked nearly half as good as ASSP which is why this HOWTO has been created for the Debian / Postfix mail server.
ASSP learns as you go along so the longer the system is in place the better and more effective it becomes at blocking spam on the server side.
ASSP stands for Anti-Spam SMTP Proxy and the ASSP wiki describes their product as follows:
"The ASSP server project is an Open Source platform-independent transparent SMTP proxy server that leverages numerous methodologies and technologies to both rigidly and adaptively identify spam. This web site's domain name, "ASSPSMTP", is the common name used for the daemon or service running ASSP."
For more info about ASSP visit http://assp.sourceforge.net or http://www.asspsmtp.org
At the time of creating this HOWTO (15/01/2007) I can report the following Runtime Statistics on my Debian Server running ASSP:
| ASSP Proxy Uptime: | 14.152 days |
| Messages Processed: | 4278 (302.3 per day) |
| Non-Local Mail Blocked: | 94.1% |
| CPU Usage: | 0.30% avg |
| Concurrent SMTP Sessions: | 6 max |
Requirements
- A Debian Etch base installation - Installation HOWTO here.
- Postfix and Courier - Installation HOWTO here.
- Root access to your server.
- IMPORTANT: Please read the TODO list at the end of this page before proceeding with installing.
Installing ASSP
ASSP's core is built off of certain required and optional Perl modules. Below is a list of the required and optional Perl modules needed by ASSP:
| Perl Module | Requirement |
|---|---|
| Compress::Zlib | NEEDED - Standard Perl installation |
| Digest::MD5 | NEEDED - Standard Perl installation |
| Email::Valid | OPTIONAL, BUT ADVISED |
| File::ReadBackwards | OPTIONAL, BUT ADVISED |
| Mail::SPF::Query | OPTIONAL |
| Mail::SRS | OPTIONAL |
| Net::DNS | NEEDED TO RUN RBL, SPF and 1.2.X |
| Sys::Syslog | OPTIONAL |
| Net::LDAP | OPTIONAL :: NEEDED IF YOU RUN LDAP |
| Time::HiRes | NEEDED - Standard Perl installation |
In this HOWTO we're going to install all the Perl modules as follows:
perl -MCPAN -e shell
install Compress::Zlib install Digest::MD5 install Email::Valid install File::ReadBackwards install Mail::SPF::Query install Mail::SRS install Net::DNS install Sys::Syslog install Net::LDAP install Time::HiRes
q (to leave the Perl shell)
Now lets install ASSP:
cd /usr/src/ wget -c http://surfnet.dl.sourceforge.net/sourceforge/assp/ASSP_1.2.6-Install.zip unzip ASSP_1.2.6-Install.zip
Make some preparations:
mkdir -p /usr/share/assp/spam mkdir /usr/share/assp/notspam mkdir /usr/share/assp/errors mkdir /usr/share/assp/errors/spam mkdir /usr/share/assp/errors/notspam
And put it in place:
mv -f assp.pl ASSP mv -f ASSP/* /usr/share/assp
Remove the leftovers:
rm -fr ASSP_1.2.6* changelog.txt Install.txt __MACOSX/ README.txt
Set some sane permissions:
chown -R 0.0 /usr/share/assp
Go there and start it up for the first time:
cd /usr/share/assp perl assp.pl
Now go to the following URL:
http://example.com:55555
and log in with any name and the password nospam4me.
Configuring ASSP
There are a myriad of options available to you in the ASSP web interface however we are only going to configure the core settings. A full breakdown of these settings and the meaning of each one is beyond the scope of this HOWTO and you'll need to do some research on the ASSP website for setting up the other options not described below.
Network Setup Options
| Option | Setting | Description |
|---|---|---|
| SMTP Destination | 125 | The internal Postfix |
| As a Daemon | Tick this box | Runs ASSP as a background daemon |
| Listen Port | 25 | The spam proxy |
| Web Admin Port | XXXXX | Change to a new port number |
Relaying Options
| Option | Setting | Description |
|---|---|---|
| Accept All Mail | example.com | Add all your local domains here |
| Local Domains | example.com | Add all your local domains here |
TestModes Options
Tick every single box in the TestModes option. ASSP needs between 500-1000 emails to learn from before it becomes truly effective so leave it in TestMode until you are positive that all mail is being blocked and filtered correctly.
Security Options
| Option | Setting | Description |
|---|---|---|
| Run as UID | nobody | The ASSP username to run under |
| Run as GID | nogroup | The ASSP group to run under |
| Web Admin Password | newpasword | Change this |
Postfix Configuration
Now we need to tell postfix to only accept connections from our proxy.
vim /etc/postfix/master.cf
Change this line:
| smtp | inet | n | - | - | - | - | smtpd |
To this:
| 125 | inet | n | - | - | - | - | smtpd |
Restart postfix:
/etc/init.d/postfix restart
Now lets start things automagicly.
vim /etc/init.d/assp
Add the following:
#!/bin/sh -e
# Start or stop ASSP
#
# Ivo Schaap <ivo@lineau.nl>
PATH=/bin:/usr/bin:/sbin:/usr/sbin
case "$1" in
start)
echo -n "Starting the Anti-Spam SMTP Proxy"
cd /usr/share/assp
perl assp.pl
;;
stop)
echo -n "Stopping the Anti-Spam SMTP Proxy"
kill -9 `ps ax | grep "perl assp.pl" | grep -v grep | awk '{ print $1 }'`
;;
restart)
$0 stop || true
$0 start
;;
*)
echo "Usage: /etc/init.d/assp {start|stop|restart}"
exit 1
;;
esac
exit 0
Set the permissions.
chmod 755 /etc/init.d/assp
and add it to the default runlevel.
update-rc.d assp defaults
Have fun with all the options and after a week rebuild the bayes database. Check the directories /usr/share/assp/spam and notspam for wrong entries, if good mail ends up in the spam directory please move it to the notspam directory and vice versa. After that do:
cd /usr/share/assp |