email:sender_policy_framework_spf
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
email:sender_policy_framework_spf [2016/11/22 15:26] – [Example Records] peter | email:sender_policy_framework_spf [2019/11/27 22:10] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Email - Sender Policy Framework (SPF) ====== | ||
- | |||
- | Sender Policy Framework (SPF), is an email-validation system which is designed to allow spoofed mails to be identified. | ||
- | |||
- | In brief SPF allows you to specify, via a DNS-record, which hosts are allowed to send email on behalf of a particular domain. | ||
- | |||
- | Because SPF involves the use of DNS there is not anything to actually configure on your mail-server, | ||
- | |||
- | The SPF record is a simple text string, in a TXT, record which contains a **v=spf1** prefix, and a number of additional components. For example: | ||
- | |||
- | ^Component^Meaning^ | ||
- | |A|If the domain name has an address record (A or AAAA) that can be resolved to the sender' | ||
- | |MX|If the domain name has an MX record resolving to the sender' | ||
- | |IP4|If the sender is in the given IPv4 address range, match.| | ||
- | |IP6|If the sender is in the given IPv6 address range, match.| | ||
- | |||
- | |||
- | ===== Types of rejection levels ===== | ||
- | |||
- | The domain-administrator may also decide whether violations should be regarded as hard-failure " | ||
- | |||
- | ^Rejection Type^Detail^ | ||
- | |-all|Reject or fail them - don't deliver the email if anything does not match.| | ||
- | |~all|Soft-fail them - accept them, but mark it as ' | ||
- | |+all|Pass regardless of match - accept anything from the domain.| | ||
- | |? | ||
- | |||
- | Most records will have a **" | ||
- | |||
- | Very large domains such as gmail.com have **"? | ||
- | |||
- | ===== Example Records ===== | ||
- | |||
- | If we pretend that mail from the host example.com can only come from the IPv4 address 1.2.3.4 we would create this record: | ||
- | |||
- | < | ||
- | v=spf1 ip4:1.2.3.4 -all | ||
- | </ | ||
- | |||
- | This record lists a single IP-address, but CIDR-formatted ranges are also supported. | ||
- | |||
- | A more complex record looks like this: | ||
- | |||
- | < | ||
- | v=spf1 a mx p4: | ||
- | </ | ||
- | |||
- | That record shows that mail may come from a small IPv4 range, a pair of IPv6 ranges, and mail should also be accepted if it comes from the MX-host of the domain, along with the host having the IP address which matches the hostname (i.e. sharewiz.net). | ||
- | |||
- | Finally this record shows that mail can only be sent from hosts listed as the MX-machine(s) for the domain, but it is configured with a soft-fail, because the domain-owner isn't 100% sure that that is sufficient: | ||
- | |||
- | < | ||
- | v=spf1 mx ~all | ||
- | </ | ||
- | |||
- | |||
- | ===== Checking SPF ===== | ||
- | |||
- | To publish a policy you must merely define a TXT-record, in DNS, for the domain you're sending from. To test that the policy is visible you can query that record, like so: | ||
- | |||
- | <code bash> | ||
- | dig -t txt +short sharewiz.net | ||
- | </ | ||
- | |||
- | <WRAP info> | ||
- | From a Windows machine use: | ||
- | |||
- | <code bash> | ||
- | nslookup -type=txt sharewiz.net | ||
- | </ | ||
- | |||
- | Returns | ||
- | |||
- | < | ||
- | Non-authoritative answer: | ||
- | sharewiz.net | ||
- | |||
- | " | ||
- | </ | ||
- | </ | ||
- | |||
- | Result | ||
- | |||
- | < | ||
- | v=spf1 mx a ptr ip4: | ||
- | </ | ||
- | |||
- | |||
- | An SPF record may also include a **" | ||
- | |||
- | < | ||
- | v=spf1 redirect=_spf.google.com | ||
- | </ | ||
- | |||
- | This tells the receiving server to check the SPF record of google.com instead of gmail.com. | ||
- | |||
- | < | ||
- | v=spf1 ip4: | ||
- | </ | ||
- | |||
- | ===== Drawbacks of SPF ===== | ||
- | |||
- | The single biggest problem with SPF is that testing records at SMTP-time can fail if your mail is handled via a forward. | ||
- | |||
- | There are several online sites which allow mail to be received at a vanity-domain, | ||
- | |||
- | |||
- | ===== References ===== | ||
- | |||
- | |||
- | https:// | ||
email/sender_policy_framework_spf.1479828361.txt.gz · Last modified: 2020/07/15 09:30 (external edit)