How does 'Sender Policy Framework' work?

Daily Newsletters

Sign up to ZDNet UK's daily newsletter.

Topics

SPF, MX Record, Email, Spam, DNS

The 'include' mechanism tells the receiver that a different domain is allowed to send mail on behalf of the one in question, and the other domain's SPF record should be checked to see if the message is coming from a valid address. For instance, zdnet.co.uk may issue an include directive for cnet.com (the domain of our parent company) which would then point someone checking our domain to our parent, which may be sending mail on our behalf. They can then check that the sender is permitted for cnet.com by retrieving their SPF record.

There are other mechanisms whereby you can specify the IPv4 or IPv6 address range that's permitted to send mail on behalf of a domain. These are less flexible but marginally faster than the previous mechanisms, since they don't require another DNS lookup. There's also a rather sophisticated DNS-based method called exists, that allows you to check for the existence of a particular host by manipulating the sending email address using macros.

SPF also allows further mechanisms to be used without having to add them to the specification itself. This could include mechanisms that state that, for instance, all valid mail from a given domain will be digitally signed. The danger here is that these more esoteric mechanisms won't be supported by many MTAs, making them far less useful than the address-based mechanisms defined in the standard.

SPF also allows you to designate mechanisms to soft fail, meaning that if a message doesn't pass scrutiny, it's still accepted, but flagged as dubious. This can be used while you're in the process of evaluating SPF, and aren't sure you've got your record composed properly. Longer term, it can also be used where you need to specify that messages being sent from certain places isn't standard practice, but isn't unknown.

While this may seem like quite a complicated arrangement, the reality is that the MX and PTR mechanisms will cover the vast majority of cases, and only large, complex networks are likely to need to resort to the other mechanisms involved. You don't even have to work through all this by hand: There is an SPF record composer wisard available at the SPF Web site, which will create the text of your SPF record based on the options you choose. There are also more SPF related tools available, such as a record checker to test your entry once it's live.

The beauty of using DNS to distribute SPF records is that popular records will be cached by ISPs, meaning that there won't be a huge amount of bandwidth taken up by SPF queries. Popular domains will be requested more often, but are more likely to be cached closer to the requester. It also means that the infrastructure required to distribute records already exists, is known to be stable and won't require any more expenditure over and above that needed to operate a domain.

After publishing your own SPF record, the next step is to check all incoming mail. Despite SPF being a relatively new proposal, quite a few MTAs have been SPF-enabled. Unsurprisingly, these are mostly open-source efforts: plug-ins are available for Sendmail, Exim and Postfix. SpamAssassin v2.70 includes support for SPF checking. If your mail server can call external scripts, libraries for Perl and Python are available. A C library for SPF checking has also been created, although this will require more skill to integrate with a mail system.

If your mail system doesn't support SPF -- as will probably be the case if you use a messaging system like Notes or Exchange -- you can still use the system by putting an SPF-enabled MTA in front of your system to act as a filter: Failed messages are refused, messages with good or unknown status can be passed on, but marked with an extra header to alert any later filtering systems of its ambiguous status. The "Received-SPF:" header is used to do this, and the format of the header is defined in the SPF specifications. Messages which pass SPF validation should stiff be marked with a Received-SPF header to show that they're genuine.

While it's technically possible to SPF-enable a user mail client, this is less productive than doing the checking at server level, since the mail will already have been transmitted across the Internet. However, if you don't have your own incoming mail server, but use your ISP's server, this will be your only option until your ISP implements SPF checking themselves. Mail clients should look for headers generated by SPF checkers, and use them when doing automatic spam filtering. An ambiguous SPF status, in conjunction with other spam detection methods, can be used to identify unwanted messages. Similarly, an unambiguous SPF pass can be used in a points scoring system to increase the chances of genuine mail getting through spam filters.

The worry when first implementing SPF checking on incoming mail is that you'll be rejecting genuine mail: This shouldn't happen. Mail will only ever hard-fail SPF checking if the purported sending domain has published an SPF record, and the mail is being forged. While it's possible that the originating domain's SPF record is incorrect, this would quickly become apparent to the mail administrators of that domain when large numbers of messages fail SPF checking. If you're really concerned about rejecting genuine mail, one option you have is to accept messages that fail checking, but rewrite the subject line to show that this message is possibly faked.

Post your comment

In order to post a comment you need to be registered and logged in.

You can also log in with Facebook. Log in or create your ZDNet UK account below

  • Login

Will not be displayed with your comment

By signing up for this service, you indicate that you agree to our Terms and Conditions and have read and understood our Privacy Policy. Questions about membership? Find the answers in the Community FAQ

Get ZDNet UK's daily newsletter

Enter your email address to sign up

ZDNet UK Live

Jack Schofield

@openhgs Windows users have had multiple desktops since Linus started writing Linux. They just haven't shipped as standard because not enough...

8 hours ago by Jack Schofield on Windows 8 could speed multi-monitor uptake
Jack Schofield

@Phil at Cloud4 What, Microsoft gets £1,200 per PC and £1,622 per server? Gosh, I'm amazed....

9 hours ago by Jack Schofield on 6 million wasted licences and £1,200 PCs: welcome to government IT
craigsc

You guys have no idea what is going on at Autonomy. Autonomy could have been a much more profitable organization. The sales operations at Autonomy...

10 hours ago by craigsc on HP cuts 27,000 staff as Autonomy chief Lynch leaves
Moley

How does this impact on dual or multi booting? Seems to me to more or less prohibit this, from Windows 8 anyway. Will Grub 2 recognise Windows 8,...

10 hours ago by Moley on Windows 8 start-up speed forces USB boot workaround
apexwm

I don't understand why there cannot be a slight pause during the boot process so the user can press a key. Many operating systems do this, even if...

11 hours ago by apexwm on Windows 8 start-up speed forces USB boot workaround
Gavin Goodman

You can now buy the Xi3 modular computer in the UK at http://www.ocdistribution.com . This can be bought with the Tand3m software, pricing and...

12 hours ago by Gavin Goodman on CES 2012: Xi3 microSERV3R
Phil at Cloud4

I agree: Mike Lynch can clearly build a business and manage strategy. I suspect the exit of Mike is more likely the end of a planned handover...

15 hours ago by Phil at Cloud4 on HP cuts 27,000 staff as Autonomy chief Lynch leaves
Phil at Cloud4

This is unbeleivable government wastage with only one winner... Microsoft 1 - Tax payer Nil!

15 hours ago by Phil at Cloud4 on 6 million wasted licences and £1,200 PCs: welcome to government IT
Mispam

So what do you do when you can't boot into windows? Why can't I just hold Shift while I power up instead of having to boot into windows and click a...

16 hours ago by Mispam on Windows 8 start-up speed forces USB boot workaround
apexwm

I've also seen that Mac OS X for Intel machines is supposed to run in VirtualBox, which would also be a nice solution. I've never tried it though.

18 hours ago by apexwm on xTreme Triple Booting: Linux, Mac & Windows
dave heasman

What I wonder is why when companies are caught bang to rights in not providing contracted services, people bend over to smear the customers? Surely...

18 hours ago by dave heasman on Virgin throttles broadband for high-speed customers
pjc158

Strange statement from HP regarding Mike Lynch and not capable of scaling a company. Autonomy was a $7bn purchase which started as a small company...

19 hours ago by pjc158 on HP cuts 27,000 staff as Autonomy chief Lynch leaves
lojolondon

Or - possibly, they will destroy business by ensuring people do not invest where there is no return. Another socialist idea, well beyond it's...

22 hours ago by lojolondon on Open Data Institute will act as biz incubator
J.A. Watson

Good stuff Jake, very interesting. Thanks. jw

22 hours ago by J.A. Watson on xTreme Triple Booting: Linux, Mac & Windows
openhgs

"the cost of a second LCD screen is about the same as one day of an office worker's time, so this should soon be recouped in extra productivity."...

24 hours ago by openhgs on Windows 8 could speed multi-monitor uptake
Thomas Gellhaus

I also installed the KDE version; I also will probably try out razorqt since I really haven't had a chance to before. I'm looking forward to the...

1 day ago by Thomas Gellhaus via Facebook on Mageia 2 Released
francisabigail

Acquiring when reinvention/cannibalization is too challenging for a large organization can be an excellent strategy- still, so many mergers stumble...

2 days ago by francisabigail on Ariba buy parks SAP on Oracle's cloud turf
apexwm

All of the feedback regarding using a touch monitor for a desktop PC is right on. Several months ago, we installed a "demo" multitouch all-in-one...

2 days ago by apexwm on Windows 8 could speed multi-monitor uptake
191706

anyone wanting to triple boot *their* own Mac

2 days ago by 191706 on xTreme Triple Booting: Linux, Mac & Windows
SoapyTablet

Cont.. Biggest Bugbear: Win7's stop-animate-go approach to work, you develop a staggered (not in the above alchohol sense of the word) approach to...

2 days ago by SoapyTablet on Windows 8 could speed multi-monitor uptake