What is a DMARC record and how do I create it on DNS server?
03/26/2020 1246 129073
Before creating DMARC records it's a good idea to test DKIM and SPF. Testing can be found here: https://dmarcguide.globalcyberalliance.org/#/
Create the record:
DMARC is designed to give receivers of email better judgment control based on sending domain reputations. It provides a platform where the sending side can publish policies to improve effectiveness against spam and phishing, in effect building domain reputations. This helps to provide guidelines on how to address messages that do not align according to those policies published by the sending domains.
DMARC was aimed at:
- Reducing false negatives
- Providing authentication reports
- Apply sender policies at the receiving end
- Reduce phishing
- Be scalable
In order to get started with DMARC, the sending domain needs to have an SPF and DKIM record published. Once the SPF and DKIM records are in place, you can configure DMARC by adding policies to your domain’s TXT records (the same way in which you published your SPF and DKIM records). Your TXT record name should read something similar to “_dmarc.your_domain.com.” Please replace the “your_domain.com” with your own domain.
As DMARC policies are published as TXT records, it defines what an email receiver should do with non-aligned mail it receives.
A DMARC record's name when creating a TXT record is "_dmarc" which forms a TXT record such as _dmarc.mydomain.com or _dmarc.mydomain.net etc
An external guide/wizard on creating DMARC records: https://dmarcguide.globalcyberalliance.org/#/dmarc/
In this scenario, the sender defines the policy as such that the receiver outright rejects all non-aligned messages and sends a report about the rejections to a specific email address. If the sender were to use the “quarantine" setting in the policy, it would look like:
and would request the action to quarantine on the receiving end of the message. In the next example, if a message claims to be from your domain.com and fails DMARC, no action is taken. Instead, these messages will then show up in your daily aggregate report sent to
"v=DMARC1; p=none; rua=mailto:postmaster@your_domain.com"
Here is a sample where the message fails DMARC, then quarantines it 5% of the time.
"v=DMARC1; p=quarantine; pct=5; rua=mailto:postmaster@your_domain.com"
In this sample, the policy is set to reject the message 100% of the time and send the daily report to the specified address of dmarc@your_domain.com.
"v=DMARC1; p=reject; rua=mailto:postmaster@your_domain.com, mailto:dmarc@your_domain.com"
DMARC records follow the extensible "tag-value" syntax for DNS-based key records defined in DKIM. The following chart illustrates some of the available tags:
Common tags used in DMARC TXT records:
|v ||required||Protocol Version||v=DMARC1|
|p||required||Protocol for Domain||p=quarantine|
|pct||optional||% of message subjected to filtering||pct=20|
|rua||optional||Reporting UTIof aggregate report||rua=mailto:firstname.lastname@example.org|
|sp||optional||Policy for subdomains of the domain||sp=r|
|aspf||optional||Alignment mode for spf||aspf=r |
Only the v (version) and p (policy) tags are required. Three possible policy settings are available:
- none - Take no action. Only log the affected messages in the daily report.
- quarantine - Mark affected messages as spam.
- reject - Cancel the message at the SMTP layer.
Alignment mode refers to the analysis which sender records are compared to SPF and DKIM signatures. There are two possible values being presented, relaxed “r” or strict “s”. Relaxed allows for partial matches such as subdomains while strict requires an exact match.
Be sure to include an email address with the optional rua tag to have the daily reports sent to that address.
The daily reports are sent in XML format. They provide feedback informing you of the sending source IP addresses that have been sending out on your domain’s behalf. This helps in determining which sources are valid or not. As a result, this assists in more effective deployment of your SPF and DKIM records.
Here is an example of a daily aggregate report. The judgement result is shown along with the source IP addresses and the action taken.
Here is an example of how to specify the optional size limit argument and set it to 10 MB: "v=DMARC1; p=none; rua=mailto:postmaster@your_domain.com!10m"
As the DMARC specification takes into consideration that scaling out the deployment may be challenging for some organizations to do at once, there are a number of built-in methods for "throttling" the DMARC processing so full deployment can be done in increments over time.
- First thing to do is monitor your traffic and reports. Assess where your vulnerabilities are (where messages are being delivered without being digitally signed or are coming from invalid source IP addresses) and address them through SPF and DKIM records.
- As you monitor your daily aggregate reports and get to a place where you are comfortable with the results, you can change the action on your policies to start to quarantine. You do this by changing your TXT record using DMARC to use the “quarantine” action. Continue to monitor your daily reports
- Once you have been monitoring your traffic and daily reports for some time and feel comfortable with the sources seen sending traffic on behalf of your domain and they are all being digitally signed, you can move forward with the next step in changing the policy to use the “reject” tag to fully deploy DMARC in its entirety. Monitoring your reports and your spamfeed is an essential part of maintenance for DMARC accuracy.
Also worth noting, the optional pct tag can be used to sample your DMARC deployment in increments as well. Since 100% is the default, passing "pct=20" in your DMARC TXT record results in one-fifth of all messages affected by the policy actually receiving the disposition instead of all of them. This setting is especially useful once you elect to quarantine and reject mail. Start with a lower percent to begin with and increase it every few days.
So a conservative deployment cycle would resemble:
- Monitor all.
- Quarantine 1%.
- Quarantine 5%.
- Quarantine 10%.
- Quarantine 25%.
- Quarantine 50%.
- Quarantine all.
- Reject 1%.
- Reject 5%.
- Reject 10%.
- Reject 25%.
- Reject 50%.
- Reject all.
When you are ready to complete the DMARC deployment, remove the percentages from your policies so that the full action of “quarantine” and “reject” is now functioning at 100%. As always, monitor your daily reports.
Recap DMARC deployment.
- Deploy SPF and DKIM records for your domain.
- Confirm that all sending MTA’s on behalf of the specified domain are aligning the appropriate identifiers appropriately.
- Publish DMARC record using the "monitor" flag and specify rua value to receive daily aggregate reports.
- Assess vulnerabilities from the daily reports and adjust SPF and DKIM accordingly. Make changes to your mailstreams as needed.
- Change DMARC policy flags to "quarantine" and then eventually to "reject" as you see fit.
For further reference, you can go to: