After filtering spam with Exim, I wanted to add Spamassassin to do content based filtering. While testing the spam filtering, I ran into a bit of an issue: I encountered a spam score factor in every single e-mail: RDNS_NONE
with the score of 1.3.
Doing a quick Google turns up some less-than-useful documentation pages and a lot of people with the same problem, yet no solution. So letโs go huntingโฆ
Theory
In theory Spamassassin checks all Received
headers and looks for IP addresses and reverse DNS checks added by the mail server. So if you have RDNS_NONE
in all your mail, it means that your mail server doesnโt check the reverse DNS properly. Except my mail server did.
Looking at the code
Since obviously this whole issue is a bit underdocumented, I went to look at the SA code. (For the record: I hate Perl.) After grep
โing around in the code, I became suspicious of /usr/share/perl5/Mail/Spamassassin/Message/Metadata/Received.pm
. This file basically contains a big honk of regular expressions for all kinds of mail servers.
So, if you have a custom Received
header, it wonโt work.
Fixing the issue
If your mail server is set up properly, you shouldnโt accept mail from servers without proper reverse DNS. You may also want to check my previous blogpost on filtering spam with Exim.
In other words you may not even need this rule. So to disable it, enter the following line in /etc/spamassassin/local.cf
:
score RDNS_NONE 0
Only do this if you reject messages form servers without a reverse DNS on your mailserver! This will effectively disable this rule from running.
Do you have a better solution? Do you have something to add? Leave a comment below! โ