Mac OS X,  Mac OS X Server,  Mac Security,  Ubuntu,  Unix

Configuring Spam Assassin In Mac OS X Lion Server

The built-in message hygiene in Lion Server is provided by Spam Assassin and clamav (amavis). Lion Server’s Server Admin application has an easy-to-use way of configuring some of the more basic settings for Spam Assassin. Spam Assassin’s rules are configured in /etc/mail/spamassassin/local.cf. If you open this into a standard text editor then you can insert blocks that are rules. Each rule has the ability to either locate text within a header (such as an email address), a subject or in the text of an email. To use Spam Assassin to block messages that have the word viagra in them, for example, you would insert the following block:

body NO_MORE_VIAGRA /viagra/i
score NO_MORE_VIAGRA 10
description NO_MORE_VIAGRA messages that contain the word Viagra

The first line looks for any email with the word viagra. The second line assigns it a score of 10 and the third gives us an easy to read description. You can also effectively whitelist email addresses or words. For example, the following would subtract 100 from the score of any email sent from my iCloud account:

header FROM_KRYPTED ALL =~ /krypted@me.com/i
score FROM_KRYPTED -100
description FROM_KRYPTED messages from krypted

The above block is similar to the previous one, but instead of adding to the likelihood that the message is spam we’re subtracting so much that even if I’m talking about viagra, the message still wouldn’t be flagged as spam.

Once you’ve entered the rules that you feel are needed for your environment, run the spam assassin command followed by the –lint option:

spamassassin --lint