Installing SpamAssassin

Okay, so I finally got SpamAssassin up and running on my JohnCompanies.com server. I was quite clueless about some of the steps, so it was a learning process for me, but in retrospect is was quite straightfoward to do.

Here's what you need to know. First, don't pay much attention to the instructions on the SpamAssissin page or out on the internet. I was following some psycho's instructions at one point where he wanted to install all the Perl libraries by hand because he didn't trust install tools. I was following his instructions for a while until I realized I had a life and went and got the packages.

Here's the conceptual overview: SpamAssassin is a Perl app that filters your incoming email for spam. If it detects that the message is spam - by analyzing the text for obvious spam text like "click here to unsubscribe" or "GREAT OFFER!" - it just marks the message as ***SPAM*** and then passes it on through to your mailbox. There's no magic - the filter can be run by the command line for testing (spamassassin -t < spam.txt) but in general is used by procmail to process messages as they arrive. Procmail is a process that is installed by RedHat by default that you can enable by putting a special file in your home directory called .procmailrc. The main challenge is making sure the app is installed and working okay and that your procmail settings are correct.

Okay, let's start here: Spam Assassin README. It has lots of info in it. Ignore most of it.

You need these files (or newer versions) which can be found on the Spam Assassin install page and Vipul's Razor's page :

The way to install them is pretty straight forward: for the rpm's just do this: "rpm -ivh *.rpm" (if you get dependency problems, just add a --nodepend or a --force).

For the razor stuff, you need to unpack the tars "tar -xvzf *.tar.gz" and then do a "perl Makefile.PL","make" and then "make install" in each directory. Then run "razor-client" afterwards to create the symlinks, and you should be good to go. You can get more detailed instructions on Vipul's site.

If you got everything working, you should be able to find a sample spam text here: "/usr/share/doc/spamassassin-2.43/sample-spam.txt" which you can test by running "spamassassin -t < sample-spam.txt > spam.out" if it works, you're golden. If not, begin banging your head on your telnet terminal until it works.

Okay, next: Procmail. In your home directory of the account you want mail in, simply create a text file called .procmailrc and include this text:

SHELL=/bin/sh

LOGFILE=$HOME/.procmail.log
#VERBOSE=yes

:0fw
| /usr/bin/spamassassin -P

Then send yourself some spam and try it out, it should mark any spam as such immediately. If you have some problems, uncomment the VERBOSE line and check .procmail.log. If you want to adjust the SpamAsssassin settings, edit the file in the .spamassassin folder in your home page to raise or lower the point limit which is considered Spam.

That's it. Please leave me comments if I screwed something up, forgotten something or if there's better ways to do this. Thanks!

-Russ

Later... Jesus. What an ass I am! I forgot to vociferously thank Erik for his invaluable help getting this working! He helped me understand what procmail was doing and provided me with the scripts to try and more. THANKS ERIK! Sorry I forgot the first time around!

< Previous         Next >