Difference between revisions of "SpamAssassin Configuration"

 
(One intermediate revision by the same user not shown)
Line 64: Line 64:
  
  
[[Category:Spam Filtering]]
+
[[Category:Spam Filtering At CS]]

Latest revision as of 14:53, 30 November 2018

Introduction

For an overview of how we use SpamAssassin in our department, please first read our SpamAssassin article.

SpamAssassin uses a set of rules that control how it scores each message. It considers each rule in turn and if it determines that a rule applies to or matches the message, then that rule's score is added to the message's overall score. Some rules have negative scores, indicating that messages with those features are probably not spam. SpamAssassin's default rule scores have been chosen based on experience with large quantities of both spam and non-spam messages.

By default, the CS Department uses a threshold of 7 for its spam classification. Any message whose overall score is equal to or greater than 7 is flagged as spam. The SpamAssassin page describes what is done by default to spam-flagged messages. The Filtering Spam with Procmail page describes how to automatically filter messages that have been flagged as spam.

Create a user_prefs File

SpamAssassin uses a configuration file in your home directory (on our Linux clients) to supplement its Department-wide configuration. You can use that file to customize SpamAssassin's behavior for your messages.

To create an empty config file, from a command prompt on one of our Linux clients, run the following commands:

mkdir ~/.spamassassin
touch ~/.spamassassin/user_prefs

Change Your Spam Score Threshold

The most common thing to customize is your spam score threshold. The default value for the CS mailserver is 7, which is a very conservative setting--it's pretty unlikely to flag something as spam when it's not, but it also lets a fair amount of spam in untagged.

The most common threshold for SpamAssassin is 5. Some people have good results with thresholds as low as 2. Thresholds can be decimal numbers, so you can use, say, 5.3 if you want.

To set your threshold to 5.3, put the following in your ~/.spamassassin/user_prefs file:

required_score 5.3

Prevent Certain Email Addresses from Being Considered Spam

Sometimes SpamAssassin will flag a message as spam even if it's not. If that happens frequently to the same sender, you can whitelist that sender's email address to tell SpamAssassin that email from that person or organization should never be considered spam. You do this with the whitelist_from configuration directive.

If sally@example.com often gets flagged as spam, you can whitelist her with the following line in your ~/.spamassassin/user_prefs file:

whitelist_from sally@example.com

You can whitelist entire domains, if you want. Let's say that you receive several newsletters from a company whose email addresses all end with "@company.com". You can whitelist all of those at once with the following directive:

whitelist_from *@company.com

Our Default Settings

For reference, here are the default settings we use for the Department:

required_score 7

rewrite_header Subject **SPAM**
clear_headers
add_header spam Flag _YESNOCAPS_
add_header all Status _YESNO_, score=_SCORE_ required=_REQD_ tests=_TESTS_ autolearn=_AUTOLEARN_ version=_VERSION_

fold_headers 0

More Information

Other user_prefs file options can be found in the Mail::SpamAssassin::Conf man page or at Mail::SpamAssassin::Conf on the SpamAssassin website.