DMARC
DMARC
- DMARC (Domain-based Message Authentication, Reporting, and Conformance) is a mechanism that tells a receiving email server what to do based on the SPF and DKIM authentication checks.
- DMARC checks whether the domain passes the SPF and DKIM authentication checks and that the email's "From" field is aligned with the SPF and DKIM authenticated domains.
- DMARC only checks for alignment if the authentication passes first.
- If an email's "From" domain is aligned with either the SPF or DKIM authenticated domains, then it can be delivered.
- DMARC checks whether the domain passes the SPF and DKIM authentication checks and that the email's "From" field is aligned with the SPF and DKIM authenticated domains.
- DMARC Alignment requirements can be "Relaxed" or "Strict"
- Relaxed means email from a matching root-level (or organization level) domain will align
- e.g.,
marketing.example.comwill align withexample.com
- e.g.,
- Strict means that the domain in the email must exactly match the authenticated domain
- e.g.,
marketing.example.comwould fail to align withexample.com
- e.g.,
- Relaxed means email from a matching root-level (or organization level) domain will align
- Delivery aggregate and failure reports can be sent to designated email addresses for review
- These reports are critical for troubleshooting and setup.
- failure/forensic reports are not generated by many mailbox providers for GDPR/privacy regulation compliance, so you may be stuck with aggregate reports
- DMARC can also be configured in purely an audit mode without SPF and DKIM; no action is taken, but you get reports on who is sending emails on your domain's behalf and whether they succeed for fail authentication.
- Reports can be analyzed using DMARC Report Analyzer, which can ingest and process manually downloaded reports or connect automatically to an email account to download reports.
- If you do not have an easy way to process these reports or create an account to receive them, services like DMARC Report[1] offer free report monitoring for a single domain and up to 10,000 email reports per month.
- Additionally, Cloudflare offers free DMARC report management for domains configured with their service.
- These reports are critical for troubleshooting and setup.
- There will most likely only be one DMARC TXT record on your DNS host.
- Like SPF, it applies to all emails sent from your domain, and not to specific hosts like DKIM
- The
sptag can be used to apply a different policy action on subdomains- However, if you want more granularity (like different aggregate/failure report addresses), you can add another record for that subdomain.
- DMARC verifies authentication by requiring alignment with either SPF or DKIM, specifies a policy instructing receivers how to handle unauthorized senders, and generates XML reports sent to the domain owner for Accounting.
DMARC Implementation
Configuring DMARC is easy, but can cause you the most headaches because it's what authorizes email to be delivered, and a misconfiguration can stop your email in its tracks. Therefore, it's highly recommended that you first configure your DMARC policy to none to take no action on emails for the first couple of weeks, using the reports generated to make sure everything is getting delivered as expected, and then to add a quarantine or reject policy and maybe ramp up implementation through the pct tag.
Below is an example of a DMARC TXT record:
- Name:
_dmarc - Type: TXT
- TTL: 3600
- Value:
v=DMARC1; p=quarantine; sp=reject; pct=100; aspf=r; adkim=r; rua=mailto:dmarc-reports@example.com; ruf=mailto:dmarc-failures@example.com; fo=1; ri=43200
Let's break it down.
- Name:
_dmarc.example.com_dmarc- Signifies this a DMARC TXT entry
- Note that you do not typically need to enter the root domain here; however, if you did a DMARC lookup for
example.com, you would see the entry as_dmarc.example.com- Only one DMARC record needs to exist for the apex domain, but you can add more records for different subdomains to take different actions; for example,
_dmarc.mailer.example.com
- Only one DMARC record needs to exist for the apex domain, but you can add more records for different subdomains to take different actions; for example,
- Type: TXT
- This is a text record (as opposed to A, CNAME, etc.)
- TTL: 3600
- The time to live is 1 hour (3600 seconds)
- This is an expiration date for the DMARC record, and helps DNS servers maintain up-to-date records.
- Value:
v=DMARC1; p=quarantine; sp=reject; pct=100; aspf=r; adkim=r; rua=mailto:dmarc-reports@example.com; ruf=mailto:dmarc-failures@example.com; fo=1;v=DMARC1- DMARC version 1; at present, there is only one version.
;- The separator between tags.
- Spaces and tabs can make entries more readable, but are completely optional.
p=quarantine- The Policy applied to emails which fail their SPF and DKIM authentication checks
- There are three options:
none: No action is taken- Typically used while configuring email security and collecting reports.
quarantine: Emails which fail authentication should be treated with suspicion and sent to the spam/junk folder- This allows the recipient server to still receive and process unauthenticated mail, just treats them with suspicion
reject: Instructs the receiving server to outright reject any mail that fails authentication.- This is the most secure, but can also be the most problematic if a configuration changes or something goes wrong.
sp=reject- The policy for subdomains; if
spis not stated in the record, then the policy described bypis inherited by its subdomains.- Setting
spmay be helpful to set a stricter policy if there are no subdomains, or a looser policy if configuring a subdomain for mail. - Some receiving servers don't check the root domain for a DMARC policy to inherit; playing it safe and adding a DMARC record for your subdomains is not a bad idea.
- Setting
- Creating a distinct DMARC policy for a subdomain (e.g.,
_dmarc.mailer.example.com) takes precedence over thesppolicy designation.- To reiterate,
sponly applies to a subdomain if there isn't a more specific DMARC policy created for it.
- To reiterate,
- The policy for subdomains; if
pct=100- The percent of unauthenticated emails to apply the policy to.
- e.g.,
pct=20would only apply thep=rejectpolicy to 20% of emails which fail authentication
- e.g.,
- This is helpful during a slow rollout to make sure not all email flow stops.
- Default is 100, and does not need to be explicitly written.
- The percent of unauthenticated emails to apply the policy to.
aspf=r- SPF alignment requirements
ris relaxed, and only the root/organizational domain must match- Relaxed is the default value for both
aspfandadkim, and does not need to be explicitly stated
- Relaxed is the default value for both
sis strict, and domains must match exactly
- SPF alignment requirements
adkim=r- DKIM alignment requirements; see
aspffor details.
- DKIM alignment requirements; see
rua=mailto:dmarc-reports@example.com- Identifies the email address to which recipient servers should send delivery aggregate reports
- Each address must begin with
mailto:, and multiple addresses can be specified if separated by a comma.- e.g.,
rua=mailto:address1@example.com,mailto:address2@contoso.com
- e.g.,
- Aggregate reports contain basic information and include successful and failed delivery information
ruf=mailto:dmarc-failures@example.com- Identifies the email address to which recipient servers should send individual delivery forensic failure reports
- Forensic failure reports contain detailed information about failed deliveries to assist with triage and troubleshooting.
- However, most major providers highly redact or suppress ruf records for privacy and GDPR compliance.
fo=1- The failure reporting option specifies what generates a forensic report .
0is default, and only requests forensic reports on DMARC failure.1requests a report for any SPF or DKIM failure, which is helpful for triage and troubleshooting during initial setup.dgenerates a report only when DKIM authentication (not alignment)sgenerates a report when SPF fails.
- You can select multiple options with a colon (e.g.,
fo=0:d) - Reminder: many mailbox providers don't send forensic/failure reports for GDPR compliance.
- The failure reporting option specifies what generates a forensic report .
ri=43200- The "report interval" is the time in seconds you request receivers to generate reports.
- The default is 24 hours (86400 seconds), and 12 hours as configured here.
- Most providers ignore this, and send reports every 24 hours or more based on their own infrastructure.
- "DMARC implementations MUST be able to provide daily reports and SHOULD be able to provide hourly reports when requested. However, anything other than a daily report is understood to be accommodated on a best-effort basis."[4]
- The "report interval" is the time in seconds you request receivers to generate reports.
Sending Reports to a Different Domain
If you are sending DMARC reports to another domain for analysis, you will need to create a TXT record on that domain's name server to identify each sending domain.[5]
For example:
- Type:
TXT - Name:
sendingdomain.com._report._dmarc.receivingdomain.com- For example, if the MSP
AcmeIT.comwas configured to receive and manage DMARC reports forexample.com, the record would beexample.com._report._dmarc.acmeit.com
- For example, if the MSP
- Value:
"v=DMARC1"- Just indicates the version of DMARC
The TXT record name identifies the domain generating the report (sendingdomain.com), followed by ._report._dmarc and the domain receiving the reports (.receivingdomain.com).
The TXT record value just identifies the DMARC version ("v=DMARC1")
While you can use a * wildcard to simplify the record to *._report._dmarc.receivingdomain.com, allowing anyone to send email to your DMARC report inboxes, you probably shouldn't. Spam filters and firewalls don't typically inspect DMARC reports, and an attacker could exploit this to flood the inbox with bogus DMARC reports or inject malicious code into zipped attachments, which might get run automatically by report analyzing software.
dig
Metadata
Sources
RFC 7489 - Domain-based Message Authentication, Reporting, and Conformance (DMARC)
dmarc.org – Domain Message Authentication Reporting & Conformance
DMARC - Wikipedia
Learn and Test DMARC
Use DMARC to validate email, setup steps - Microsoft Defender for Office 365 | Microsoft Learn
The DMARC ‘fo’ tag options and their ideal use cases – DMARC Report
Tools
DMARC Report Analyzer
GitHub - techsneeze/dmarcts-report-parser: A Perl based tool to parse DMARC reports from an IMAP mailbox or from the filesystem, and insert the information into a database. ( Formerly known as imap-dmarcts )