The Sender Policy Framework (SPF) is a community-based effort that requires senders to publish their mail server in an SPF record. This record is used to detect forged senders.
How does SPF work?
The basic idea behind Sender Policy Framework (SPF) is simple: whenever an email is received a check is made to see if the server which sent it is allowed to send emails on behalf of the senders’ domain.
For example: you receive a message from ‘firstname.lastname@example.org’ from a machine with IP ‘18.104.22.168’. SPF works by asking ‘somedomain.com’ if ‘22.214.171.124’ is allowed to send email on its behalf.
For SPF to work, the sender’s domain (‘somedomain.com’ in this example) must publish, via DNS TXT records, the hosts which are allowed to send email on its behalf. Thus SPF requires both sender and recipient collaboration. If this information is not published, then SPF will return ‘unknown’, or ‘none’.
SPF checks the last external IP. If GFI MailEssentials is installed on a machine in the perimeter then the last external IP is easily obtainable by checking the IP of the mail server that connected to Internet Information Services (IIS).
If GFI MailEssentials is not installed on the perimeter server, you need to configure the perimeter SMTP servers that are receiving emails from the internet. GFI MailEssentials will parse the message headers for the ‘Received lines’ which will contain the IP addresses of the servers from where the message has passed. To get the IP address of the sender’s mail server, GFI MailEssentials checks all the IP’s in the header until an IP is:
- Found in the perimeter SMTP servers list.
- Followed by an IP address which is not in the perimeter SMTP servers list. The latter IP is the external IP.
The following example assumes that 126.96.36.199 is in the perimeter list. GFI MailEssentials is installed on ‘hostb’ and is being forwarded email from ‘hosta’ (188.8.131.52).
Received: from hosta ([184.108.40.206]) by hostb with Microsoft SMTPSVC;
Tue, 11 Jan 2005 18:53:30 +0100
Received: from external.com ([220.127.116.11]) by hosta with Microsoft SMTPSVC;
Tue, 11 Jan 2005 18:53:19 +0100
Using the logic detailed above, GFI MailEssentials will find the perimeter IP which is followed by a non-perimeter IP, in this case 18.104.22.168. If somedomain.com confirms that 22.214.171.124 is allowed to send email on its behalf, the email will be passed through the rest of the anti-spam plug-in, otherwise the email is marked as spam.
Points to note:
- It is important to note that all public perimeter IP’s should be included in the GFI MailEssentials configuration as GFI MailEssentials will search for them when parsing message headers.
- Confirm which DNS-server GFI MailEssentials uses. In most cases this will be an internal DNS server. If you have an external zone in your internal DNS server, then you need to setup the SPF-record for your domain in the DNS-record of your internal DNS server as well as the external one.
- More information regarding the Sender Policy Framework (SPF) can be found at: http://openspf.org/
- Further information on how to create an SPF record for your domain can be found in the following Microsoft Knowledgebase article: http://www.microsoft.com/mscorp/safety/content/technologies/senderid/wizard/
In Part 2 of this article we will be reviewing how to create SPF records for your domain and determine domain names.