SPF, DKIM, and DMARC are the three most crucial email authentication protocols to prove to mail servers and ESPs that senders are authorized to send emails on behalf of a specific domain. Implementing these protocols is vital to:
- Prevent hackers from spoofing and sending fraudulent emails using your domain name.
- Protect your clients, business partners, and organization from cybercriminals attempting to exploit your domain or domain name.
- Garner trust among email service providers (ESPs) as a verified sender.
- Prove to customers, government authorities, and other third parties that your organization takes email security seriously.
- Enhance your email deliverability rates and avoid your messages landing in the spam or junk folders.
Understanding SPF, DKIM, and DMARC protocols is vital to ensure that your emails are properly authenticated. In February 2024, Google and Yahoo made it compulsory to have email authentication in place, with DMARC policies also becoming mandatory for bulk senders.
This article will discuss how SPF, DKIM, and DMARC are used in email authentication and why having all three is a good idea. But before we examine this, let’s explore how email works.
How Does Email Work?
Email works in this way – before you can send or read emails from your device, you need a Mail User Agent or MUA, such as Gmail. The MUA interacts with the Mail Transfer Agent or MTA, also known as a mail server. The MTA helps to receive and store your emails remotely. You’ll only receive the mail on your device through the Mail Delivery Agent, or MDA when you open your MUA.
The Simple Mail Transfer Protocol (SMTP) is a communication protocol responsible for sending emails to a mail server. Even though email providers like Gmail have internal protocols, they still use SMTP to send emails outside their systems. For instance, when a Gmail user wants to send a mail to a Yahoo! mail user.
Several protocols, such as POP3 and IMAP, have been designed to help you download emails from the server. Today, both protocols have been replaced by webmail, which allows you to log in and receive mail on any device worldwide. However, you need to be connected to the internet to use it.
Email protocols weren’t built with security in mind. Mail servers are only tasked with taking messages from the sender and delivering them to the recipient. But this has become an issue as the internet continues to expand, with spamming and phishing growing into prevalent problems for all email users.
At first, email users implemented the TLS (Transport Layer Security) encryption protocol to encode messages in transit. One of the loopholes in TLS is that it doesn’t offer protection for data at rest.
TLS protects data traveling from one MTA to another MTA, but each MTA can modify the message. SPF, DKIM, and DMARC were created to address this issue and provide a way for mail servers to validate the source of a message.
What is SPF?
SPF (Sender Policy Framework) is an email security protocol designed to help detect and prevent email spoofing. The authentication protocol allows you to create a DNS TXT record in your DNS settings that lists the sender addresses you’ve authorized to send messages on your domain’s behalf. With this protocol, ISPs or email servers can validate that incoming emails from a particular domain are legitimate.
Here is an example of an SPF Record:
v=SPF1 ip4:192.168.0.0/16 include:_spf.google.com ~all
Your domain administrator can quickly create and publish an SPF record in the DNS record as a TXT entry. Here are some things to include:
- The version of SPF you want to use
- The authorized IP addresses allowed to send messages using the domain
- Any third-party domains authorized to send emails on the domain’s behalf
- An ending “all” tag indicates the policy that applies when a mail server discovers an unauthorized IP
When an email message is sent to a recipient claiming to come from your domain or on your domain’s behalf, the receiving mail server will check for an SPF record. If it detects one, it retrieves the list of authorized IPs for the domain. If the sender’s IP matches one from the SPF record, the authentication check is marked as a “PASS,” and the recipient receives the message.
What is DKIM?
DKIM (DomainKeys Identified Mail) is an email authentication method that adds a digital signature to outgoing email messages. It provides email security with a unique identifier using cryptographic signatures instead of IP addresses.
Like SPF, DKIM requires a TXT record added to your DNS. DKIM uses encryption to create public and private cryptographic keys. The private key remains on your server and is used to digitally sign every email, while the public key is placed in the DNS.
Here is an example of a DKIM Public DNS Record:
The components of these records are as follows:
DNS Record Type | |
TXT | A TXT record in DNS is used to store text information. In this context, it’s used to store the DKIM (DomainKeys Identified Mail) key. |
Name Field | |
“google” | This is the DKIM selector name. The selector identifies the specific DKIM key being used. It allows a domain to have multiple DKIM keys for different purposes. |
“_domainkey” | This is a constant suffix in DKIM records that specifies the namespace for the DKIM key. It ensures the correct lookup for the DKIM public key. |
Content Field | |
“v=DKIM1” | This indicates the version of DKIM being used. It is always v=DKIM1 for DKIM records. |
“k=rsa” | This specifies the cryptographic algorithm. In this case, it’s RSA, the most commonly used algorithm for DKIM. |
“p” | This contains the public key for the DKIM signature. This is a 2048-bit RSA key in the provided record. |
A DKIM signature looks like this:
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=easydmarc.com; s=google;
h=from: content-transfer-encoding: subject: message-id:date:to:mime-version;
bh= 1py3bPKPbePCmMziH13AZqw0Fa +/ wnOTcnp6P-ZLMW2SwMpgo=;
b= 1yc9n5JU-7bTkT9FxgIYFJutPbxbyfsBXlbD4wJ-Mdt8/15vjYvI2-
IlCipp_FFTkyd3s_yA4jX65vRSsaE2hBhTw okQIHsBTfmTFEEo01BtmUZpR5M4Mtz5Q8LE97YRDE /nI1hoPWbzDaL9qh
When you send an email to a receiver, the recipient server retrieves the DKIM record and uses the public key to decode the DKIM signature and hash it. Then, the receiving server compares the private and public hashes to see if they match. If they match, the receiving server knows the message is authentic, and the email content has not been changed and therefore won’t be considered spam. Otherwise, the message is not from a legitimate sender or has been modified in transit, so it fails DKIM authentication and won’t be delivered to the recipient’s inbox.
DKIM helps to validate three things:
- The email content hasn’t been modified or tampered with
- The email headers didn’t change since the sender sent the message
- The domain owner authorizes the email sender.
Creating your DKIM record is simple, as most email servers have native DKIM functionality.
What is DMARC?
DMARC stands for Domain-based Message Authentication, Reporting, and Conformance. This email authentication, policy, and reporting protocol leverages and enhances DKIM and SPF to validate the authenticity of a message using the “from” address. This helps prevent email spoofing and phishing attacks and ensures that only legitimate emails are sent from your domain. This authentication protocol has three primary purposes:
- It validates whether both DKIM and SPF protect an email message. It verifies that the visible “from” address matches the domain in the return-path address (for SPF) and the domain specified in the d= tag of the DKIM signature. (DKIM d= tag)
- It lets the domain owner specify how email receivers should handle unauthenticated messages
- It allows the receiving server to send a report to the sender regarding messages that pass or fail the DMARC authentication checks.
For an email to pass DMARC authentication, it must pass DKIM and/or SPF. So, if DKIM fails and SPF passes, the message will still be delivered. To implement DMARC, you must create a DMARC record and define the policy you want based on your needs. The available policies you can deploy include the following:
- Policy = (P=none) – Also called the monitoring policy. No action is taken here, and the message is delivered to the recipient regardless of whether it passes or fails DMARC authentication.
- Policy = (P=quarantine) – This policy sends messages failing DMARC authentication to the spam or quarantine folder.
- Policy = (P=reject) – The reject policy blocks emails failing DMARC authentication and sends them back. It’s the ultimate policy to strive towards.
Why You Need DMARC vs. SPF vs. DKIM
Deciding which email authentication protocol to implement can be confusing. Though all three measures are authentication protocols that strengthen your email security, none can stand alone. DMARC, SPF, and DKIM all play a vital role in ensuring your email is protected and delivered as intended. You must implement all three protocols to have complete security.
SPF is designed to verify that the sending mail server is authorized to send on behalf of the MailFrom: address (Return-Path), but it does not directly validate the visible From: address that most users see in their email clients. DKIM ensures that the message has not been altered during transit by verifying a cryptographic signature associated with the domain specified in the d= tag, but it does not authenticate the visible From: address. DMARC combines these two protocols by requiring that the domain in the visible From: address aligns with either the SPF-authenticated MailFrom: domain or the DKIM d= domain, helping to ensure that the sender is who they claim to be.
We recommend implementing DKIM, SPF, and DMARC protocols for well-rounded and robust email security protection.
Are All Three Protocols Required?
Implementing these three vital authentication protocols enhances your email security significantly and:
- Signals to the world that your organization is legitimate and takes email security seriously
- Improves email deliverability rates and nurtures brand trust since hackers will find it difficult to spoof your domain for fraudulent activities
- Protects your customers, partners, and other third parties from fraudulent exploits in your domain name.
By verifying the legitimacy of a sender, SPF, DKIM, and DMARC combine forces to prevent email spoofing and phishing attacks.
How to Get Started
When setting up your SPF, DKIM, and DMARC policy, it’s essential you do it in the correct order. Remember that implementation is a multi-stage process that takes time to reach ultimate DMARC compliance with SPF and DKIM. Fortunately, we have an extensive range of free tools and managed solutions to help you achieve that.
- DMARC compliance starts with SPF. Implement this protocol first by creating your SPF record. With EasyDMARC, you can easily:
- Check your SPF records to see whether an SPF record is published for your domain and if it’s deployed correctly.
- Generate your SPF record instantly without worrying about syntax typos and errors.
- Validate your SPF record before publishing it to your DNS to ensure the correct configuration.
- Use our EasySPF tools to solve any other configuration issues like the common “too many DNS lookups” error.
- DKIM is the next step to DMARC compliance. Once SPF is running smoothly, it’s time to implement DKIM. With EasyDMARC, you can:
- Check your DKIM records to see if any exist on your domain and whether they’re valid.
- Generate your DKIM record within seconds for your dedicated mail servers.
- Once you’ve confirmed that DKIM is running correctly, you can focus on DMARC deployment. With EasyDMARC, you can easily:
- Check your domain’s DMARC status with ours. DMARC record checker.
- Generate your DMARC record swiftly and correctly before publishing it in your DNS.
- Set up and analyze your DMARC failure reports in an easy-to-understand format.
- Use our XML aggregate reports analyzer for instant insights into your email infrastructure.
- Use our managed DMARC solution for one-click DMARC enforcement and management across all domains.
If you need help at any stage of your SPF, DKIM, and DMARC journey, feel free to contact us. Our expert team can guide you through the various processes and stages.
Conclusion
SPF, DKIM, and DMARC authentication protocols are vital for organizations looking to protect themselves from malicious emails and ensure excellent email deliverability. DMARC deployment requires technical expertise, and DMARC authentication has never been easier with our managed solution.