Panix - Public Access
Networks Corporation

Using Spamassassin with Procmail


This page assumes that you are familiar with running commands and editing files in the UNIX shell, and that you have already run install-procmail.

Alternately, you may invoke Spamassassin from the webmail interface.

Contents


What Spamassassin is and how it works

Panix makes SpamAssassin available and supports it for filtering spam as it is delivered to your account.

Rather than using specific addresses, SpamAssassin uses a series of tests to look for "key phrases" and other indicators of spam in an email message. Each of these tests has a point value, and the message gets a score that is the total of the points for all the tests it matches. If the score is above a given threshold, the message is treated as spam. You can adjust the point value for any of the tests, and/or you can change the threshold setting. What happens to the mail marked as spam is determined by the settings in your .procmailrc file.

For full details, please see the SpamAssassin web page at http://www.spamassassin.org/.

Because SpamAssassin is third-party software, upgrades may result in changes in the point value of any of the rules. (We make occasional local changes, but they are rare.) We advise users to whitelist addresses they wish to protect.


Setting up Spamassassin - The Basics

First, add the following line to your .procmailrc file, if it isn't there already:

INCLUDERC=/usr/local/filters/rc.spamassassin

This tells procmail to use the Spamassassin filter. Next, you'll create the Spamassassin preferences file.

Create a directory called .spamassassin and copy the file /usr/local/share/spamassassin/user_prefs.template into it as user_prefs.

Now you'll be able to start

Modifying Spamassassin Preferences

user_prefs is actually very well commented, so most of this section may actually be superfluous.

The main attribute in the user_prefs files is the required_score line. This is the threshold above which messages will be marked as spam. The lower this is set, the more likely it will be that a given message will be marked.

You'll see that required_score is set to "5" by default. This is rather permissive, and we recommend lowering it to at least "4".

• Whitelisting and Blacklisting

In order to whitelist an address (to ensure that messages sent from it are never marked as spam) or blacklist an address (to ensure that messages sent from it are always marked as spam), add a line to user_prefs, as follows:

WHITELIST_FROM someone@somewhere
BLACKLIST_FROM someone@somewhere

where "someone@somewhere" is the address to be whitelisted or blacklisted. Wildcarded addresses can be used.

Although it might make sense to use the Blacklist against spam addresses, and although this may even work against some, this is sadly not a practical strategy. More often than not, spam originates from forged or disposable addresses, and blacklisting will either not work against them at all, or will only do so temporarily. The Blacklist is more effectively deployed against specific sources of (for example) harrassment.

• Customizing Spam Rules

You can set new scores for specific tests run by Spamassassin, should you find that their default scoring is too aggressive or not aggressive enough. You will most likely do this in response to obvious spam which is consistently delivered to your Inbox after triggering certain tests (the tests triggered will be visible in the messages "X-Spam-Status:" header).

A list of the tests run by Spamassassin, with brief descriptions, is at http://spamassassin.apache.org/tests.html (use the link marked "Current"). We cannot guarantee that this list is up-to-date with all of the tests you might encounter.

To set a new score for a test, add a line to user_prefs, as follows:

score SYMBOLIC_TEST_NAME n.nn

where SYMBOLIC_TEST_NAME is the name of the test, and n.nn is the new score.

• Filtering Languages

Spamassassin can be configured to only allow mail in languages you want to read, and exclude email composed in non-western character sets, such as Cyrillic or Chinese. This feature depends on the rules CHARSET_FARAWAY, CHARSET_FARAWAY_BODY, and CHARSET_FARAWAY_HEADER. These rules have a default score of 3.2, which is reasonably strong even if your required_score is at the default of 5; most unwanted mail in languages you don't want to read will likely trigger enough other rules to make up the difference. If you want to make certain that they are rejected, you can increase the value of the rules to be equal or greater than your required_score.

To filter by language, add an ok_locales line to user_prefs, with the locale codes of only the languages you want to receive.

For example:

ok_locales en es fr ja

would allow mail sent in English, Spanish, French, and Japanese to be delivered. Mail in all other character sets would be rejected.


List of Language Locales

Locale Code Language Locale Code Language
af Afrikaans ar Arabic
be Belarussian bg Bulgarian
ca Catalan cs Czech
da Danish de German
el Greek en English
eo Esperanto es Spanish
et Estonian eu Basque
fi Finnish fr French
gl Galician he Hebrew
hr Croatian hu Hungarian
hy Armenian id Indonesian
is Icelandic it Italian
ja Japanese kk Kazakh
ko Korean lt Lithuanian
mn Mongolian nb Norwegian (Bokmål)
pl Polish pt Portugese
ro Romanian ru Russian
sk Slovak sl Slovene
sr Serbian tr Turkish
uk Ukranian zh Chinese

webmaster@panix.com
© Copyright 2011, Public Access Networks Corporation
Last modified: Thursday, 25-Aug-2011 13:36:12 EDT
[ Panix Home ] [ Panix Help System Index ] [ Top of This Page ]