SHARE
Facebook X Pinterest WhatsApp

Tip of the Trade: Fine-Tuning SpamAssassin

Written By
thumbnail Carla Schroder
Carla Schroder
Jul 20, 2010
ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More



The war on spam is pretty much about building bigger umbrellas and higher waders. For various reasons, little is done to cut spam off at the source. A powerful tool in the battle to divert the tides of spam from swamping networks is SpamAssassin. A stock SpamAssassin installation is only about 80 percent effective, however, and its effectiveness decreases over time as spammers craft their messages to elude SpamAssassin’s rules.

SpamAssassin is a vital tool for keeping spam at bay. Its effectiveness decreases over time, however, as spammers figure out ways to elude its rules. The solution? sa-update, which lets you download (and tweak) updated rules without waiting for a SpamAssassin upgrade.

Discuss this article in the ServerWatch discussion forum

Unsure About an Acronym or Term?
Search the ServerWatch Glossary

 

The cure for this is to either run sa-update regularly to download new rulesets or customize SpamAssassin’s rules to meet your needs.

sa-update lets you download updated rules without waiting for a SpamAssassin upgrade. You can stick with the defaults or add “channels,” which are third-party rulesets. SpamAssassin can then run globally in conjunction with a mail server, with the rules in /etc/mail/spamassassin/local.cf, or you can run it as an ordinary unprivileged user with your rules in ~/.spamassassin/user_pref. Some e-mail clients, such as KMail, include SpamAssassin integration, so a mail server is unnecessary when using SpamAssassin.

Using the SpamAssassin rules and channels should be enough for most admins, but if you want to customize your rules yourself it’s not very hard. The trick is to monitor the results and tune the rules accordingly. This is an example of a real rule:

rawbody       viagra  /viagra/i
score         viagra  5.0
description   messages that contain the word viagra

i means case-insensitive, the score determines how much weight the rule gets, and the description is optional, to help you remember what the rule does. Every time you change a rule, run spamassassin –lint to check your rule syntax and catch errors. Rules can contain specific words and regular expressions, and you can blocklist domains. After making changes to rules you must restart spamd. Visit SpamAssassin for a lot of good documentation and links to third-party channels.

thumbnail Carla Schroder

Carla Schroder is a ServerWatch contributor.

Recommended for you...

What Is a Container? Understanding Containerization
What Is a Print Server? | How It Works and What It Does
Nisar Ahmad
Dec 8, 2023
What Is a Network Policy Server (NPS)? | Essential Guide
Virtual Servers vs. Physical Servers: Comparison and Use Cases
Ray Fernandez
Nov 14, 2023
ServerWatch Logo

ServerWatch is a top resource on servers. Explore the latest news, reviews and guides for server administrators now.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.