SpamAssassin, rewrite_header and Friends

For the past few months that we've been using one of our new servers, something has been bugging me. You see, SpamAssassin on the server has not been adding the "[SPAM]" snippet to the start of SPAM emails. Oh sure, the "X-Spam-Flag" can be tested with an email filter, but I'm a geek who knows about these kinds of things - our users don't.

Subsequently, I have been fighting with this on and off for a while. Today, however, the proverbial gloves were thrown down and I decided that we'd fight it out. Only one of us would walk from the arena alive. SpamAssassin or I - there can be only one!

After 2 hours of screaming "WHAT THE HELL IS THAT!?!?!" and fighting with the configuration files, I finally resolved it in a most annoying fashion.

You see, every piece of documentation talking about SpamAssassin and subject rewriting always refers to this magical "rewrite_header" configuration line, which supersedes the "subject_tag" directive in the 3.0 release and yada yada yada yada. I lost count the number of times which /etc/mail/spamassassin/ has been modified to some permutation of :

required_hits 3
rewrite_header subject [SPAM]
report_safe 0

After all, every bit of documentation says this should do what I want it to.

Turns out that in the DAG RPMs for Fedora Core 1, the configured defaults completely break the way this works. You see, in this package the default launch arguments for spamass-milter are set to "-m -r 15", all completely without documentation in the /etc/sysconfig/spamass-milter file. Once you actually think to check what these mean, you find out that -m means:

-m: don't modify body, Content-type: or Subject:

And that -r 15 means:

-r nn: reject messages with a score >= nn with an SMTP error.

Now, -r is obviously good (because we don't want to accept mail which is so blatantly spam). -m however? Maybe not the best idea, as this completely breaks the "rewrite_header" command. As soon as we remove the flag and restart the daemon, everything works great and all of that canned ham beverage suddenly gets marked appropriately.

SpamAssassin is now suddenly my friend again. Yay!