Christopher
All in time.
| Reputation: | 607 |
| Rep Power: | 15 |
Officer I
Los Santos Police Department
Very Active
- Feb 3, 2007
- 2,021
SPF / DKIM / DMARC – Quick Refresher
Think of these as three different questions email providers ask when a message arrives.
SPF (Sender Policy Framework)
Question it answers:
“Is this server allowed to send email for this domain?”
• Implemented as a DNS TXT record on the root domain
• Lists IPs and/or services authorized to send mail
• Checked against the sending server’s IP
What it’s good at:
✔ Preventing unauthorized servers from sending mail as your domain
Limitations:
✖ Breaks easily with forwarding
✖ Does NOT verify message integrity
✖ Does NOT protect the visible “From:” on its own
Typical ending:
(soft fail) or
(hard fail)
DKIM (DomainKeys Identified Mail)
Question it answers:
“Was this message altered, and was it signed by the domain?”
• Uses public/private key cryptography
• Outbound mail is cryptographically signed
• Public key is published in DNS under:
Example selector:
What it’s good at:
✔ Verifying message integrity
✔ Survives forwarding better than SPF
✔ Confirms the sending domain cryptographically
Notes:
• A selector existing in DNS usually means DKIM is configured
• You still need to confirm messages are actually being signed (via headers)
DMARC (Domain-based Message Authentication, Reporting & Conformance)
Question it answers:
“If SPF/DKIM fail, what should the receiver do?”
• Implemented as a TXT record at:
• Requires alignment with the visible “From:” domain
• Builds on SPF and DKIM (does not replace them)
Policy options:
•
– monitor only
•
– send failures to spam
•
– outright reject failures
Important:
DMARC passes if either:
• SPF passes and aligns
OR
• DKIM passes and aligns
(Only one aligned pass is required.)
How They Work Together
• SPF = who is allowed to send
• DKIM = message integrity + domain signature
• DMARC = enforcement + reporting
SPF + DKIM without DMARC = checks exist, but no enforcement
DMARC without SPF/DKIM = ineffective
Common Gotchas
• Multiple SPF records (only one is allowed)
• SPF lookup limit exceeded (10 DNS lookups max)
• DKIM key exists, but messages aren’t signed
• DMARC exists but policy is still
forever
• SPF/DKIM pass but fail DMARC due to alignment issues
TL;DR
• SPF: “Can this server send?”
• DKIM: “Was this message signed and untouched?”
• DMARC: “What happens if authentication fails?”
You want all three configured correctly for real spoof protection.
Think of these as three different questions email providers ask when a message arrives.
SPF (Sender Policy Framework)
Question it answers:
“Is this server allowed to send email for this domain?”
• Implemented as a DNS TXT record on the root domain
• Lists IPs and/or services authorized to send mail
• Checked against the sending server’s IP
What it’s good at:
✔ Preventing unauthorized servers from sending mail as your domain
Limitations:
✖ Breaks easily with forwarding
✖ Does NOT verify message integrity
✖ Does NOT protect the visible “From:” on its own
Typical ending:
Code:
~all
Code:
-all
DKIM (DomainKeys Identified Mail)
Question it answers:
“Was this message altered, and was it signed by the domain?”
• Uses public/private key cryptography
• Outbound mail is cryptographically signed
• Public key is published in DNS under:
Code:
<selector>._domainkey.example
Example selector:
Code:
202401._domainkey
What it’s good at:
✔ Verifying message integrity
✔ Survives forwarding better than SPF
✔ Confirms the sending domain cryptographically
Notes:
• A selector existing in DNS usually means DKIM is configured
• You still need to confirm messages are actually being signed (via headers)
DMARC (Domain-based Message Authentication, Reporting & Conformance)
Question it answers:
“If SPF/DKIM fail, what should the receiver do?”
• Implemented as a TXT record at:
Code:
_dmarc.example
• Requires alignment with the visible “From:” domain
• Builds on SPF and DKIM (does not replace them)
Policy options:
•
Code:
p=none
•
Code:
p=quarantine
•
Code:
p=reject
Important:
DMARC passes if either:
• SPF passes and aligns
OR
• DKIM passes and aligns
(Only one aligned pass is required.)
How They Work Together
• SPF = who is allowed to send
• DKIM = message integrity + domain signature
• DMARC = enforcement + reporting
SPF + DKIM without DMARC = checks exist, but no enforcement
DMARC without SPF/DKIM = ineffective
Common Gotchas
• Multiple SPF records (only one is allowed)
• SPF lookup limit exceeded (10 DNS lookups max)
• DKIM key exists, but messages aren’t signed
• DMARC exists but policy is still
Code:
p=none
• SPF/DKIM pass but fail DMARC due to alignment issues
TL;DR
• SPF: “Can this server send?”
• DKIM: “Was this message signed and untouched?”
• DMARC: “What happens if authentication fails?”
You want all three configured correctly for real spoof protection.