SPF to fight spam and viruses

Though my domains have been publishing SPF records for a while now, I hadn’t implemented it yet on my mail server. Just upgraded my MTA (based on Exim) and added quite a few new things, including SPF, or Sender Policy Framework support.

In case you don’t know about SPF, it is a very simple method to prevent abuse of email through faked “From:” addresses. You simply add an extra record in your domain’s DNS that specifies which IPs or networks email from your domain may originate from.

Implementing SPF was much simpler than I thought. Exim has built-in SPF support and only requires the libspf2 library to make use of it. Right now, I’m not blocking any email based on SPF alone, though I’ve heard Hotmail has started marking emails as “Junk” if the SPF doesn’t match. What I do instead is add a header to the email indicating the SPF result. I’ll let Bogofilter decide whether it should be classified as “Ham” or “Spam”.

This is however only until I know how widespread SPF is and looking at the emails I have received today, it seems to be quite widely used. I will start blocking non-matching emails soon so be prepared.

I also added ClamAV support to scan all emails for viruses. Though I don’t receive many these days, it’s good to be free of the few that I do. Again, I’m impressed by how simple it is to do these things using Exim.