How to Configure Office 365 DMARC — LazyAdmin (2024)

DMARC is the last step in securing your Office 365 mail. Where SPF only checks against the 5321.MailFrom address does DMARC also check the 5322.From address. It also tells the receiving mail systems what to do with mail send from your domain that didn’t pass the SPF and DKIM check.

Before we can start with configuring DMARC, you first need to configure SPF and DKIM for Office 365. These protocols are used to determine who is allowed to send mail on behalf of your domain.

In this article, we are going to take a look at how to set up DMARC and I will explain the different options you have when it comes to configuring DMARC.

How does DMARC work?

Before we configure DMARC, it’s good to understand how it exactly works. Because DMARC does not only tell the receiving mail server what to do with unauthorized (spoofed) emails, it also adds an extra security check.

The problem is that email can have multiple From headers. We have the Mail From address (5321.MailFrom), which identifies the sender of the mail. And we have the From address (5322.From), which is displayed in the mail client.

SPF only checks the Mail From address, which can be a problem. Take the following SMTP transcript example:

S: Helo stonegrovebank.comS: Mail from: fake@phishingdomain.comS: Rcpt to: info@lazyadmin.nlS: dataS: To: "LazyAdmin" <info@lazyadmin.nl>S: From: "Finance Stonegrove bank" <finance@stonegrovebank.com>S: Subject: Stonegrove bank - Important!

SPF only checks the Mail From the address. So in this case is the sending IP address allowed to send mail for the domain phishingdomain.com. If the attackers created an SPF record for the domain phishingdomain.com and listed the sending IP address, then the SPF check will pass.

The problem is that SPF doesn’t check the From address, it will completely ignore the fact the From address doesn’t match the Mail From address.

When you have enabled DMARC for your domain (stonegrovebank.com in this example), then the receiving server will also check the From address. This check will fail because the sending IP Address isn’t listed in your SPF record.

Monitoring, Quarantine and Rejecting Email

Another important function of DMARC is that it tells the receiving mail server what it should do with unauthorized emails. Before we can start with moving unauthorized mail to the spam folder, or rejecting mail completely, we first need to know for sure that all legitimate systems are authorized.

OptionPolicyDescription
Monitoringp=noneJust deliver the mail (used for testing)
Quarantinep=quarantineMove the mail to the spam folder
Rejectp=rejectDrop the email

The last thing that you want is that your legitimate emails are dropped by the receiving server because you forget to add an IP Address to the SPF record. So what we can do is first monitor the DMARC results, using the monitoring policy setting.

Only when we are certain that everything is working as expected, can we move to quarantine or rejecting mails.

DMARC Reporting

The monitoring policy is always used in combination with an email address to send the report to. These reports are generated in XML format and give you insight into the DMARC results. Now I have to say, they are a bit hard to read:

How to Configure Office 365 DMARC — LazyAdmin (1)

To help you analyze these reports you can use a third-party service, like dmarcly (they offer a 14-day trial to get started).

You can specify the email address to send the reports to with the following tag in the TXTrecord:

rua=mailto:dmarc@lazyadmin.nl; ruf=mailto:dmarc@lazyadmin.nl;

As you can see we have two different tags here that we need to supply, RUA is used for the aggregate reports and RUF for the forensic reports. Most third-party DMARC analyzers will have a different email address for each.

After you have monitored the DMARC reports for a couple of weeks you can start with moving the mail to the spam folder. This way emails won’t be lost when you forgot to add that new mail system (or web application) to the SPF record.

In the end, you might want to reject emails completely, but keep in mind that if you are not using a DMARC analyzer you won’t know when emails are dropped after a failed SPF and DMARC check. So be careful with the reject policy.

Setup DMARC for Office 365

So now you have an idea of how DMARC works, let’s take a look at how to set up DMARC for Office 365. The steps below are not specific to Office 365 but will work for any domain. To set up DMARC we need to create a DNS record, just like with SPF. So make sure you have access to the DNS records.

The first step is to log in to your DNS provider. I am using Cloudflare, if you don’t know how to create DNS records then contact your hosting provider.

We are going to create a new TXT DNS record:

  1. Add a new record
  2. Select TXT as type
  3. Set the name to _dmarc
  4. Set the content to:
v=DMARC1; p=none; rua=mailto:dmarc@stonegrovebank.com; ruf=mailto:dmarc@stonegrovebank.com; sp=none; fo=1;
How to Configure Office 365 DMARC — LazyAdmin (2)

What this record does is monitor p=none all DMARC events, and send a report when SPF or DKIM fails fo=1. It also monitors all subdomains sp=none. The reports are sent to the mail address dmarc@stonegrovebank.com.

When you are ready to move the unauthorized mail to the spam folders, you can change the record to the following:

v=DMARC1; p=quarantine; rua=mailto:dmarc@stonegrovebank.com; ruf=mailto:dmarc@stonegrovebank.com; sp=quarantine; fo=1;

DMARC Tags

Besides the policies and reporting mail address, you have also a couple of other options that you can use in your DMARC record.

TagOptionsDescription
spnone, quarantine, rejectUsed to apply the DMARC record to all subdomains. You can set a custom policy for the subdomains.
fo0, 1, d or sDetermine when to generate a forensic report:
0 – When both SPF and DKIM fail
1 – When SPF or DKIM fails
d – Only when DKIM fails
s – Only when SPF fails
pct1 – 99Percentage of failed emails that should be quarantined or rejected. Allows you to slowly test the quarantine or reject policy. Does not work with p=none

Third-party options for DMARC analyses

DMARC reports are sent on a daily basis to the given mail address. The reports are formatted in XML, so they are not easy to read or analyze. There are different DMARC monitoring solutions on the market, like DMARCLY for example.

These monitoring solutions are not free, but they can really help you with analyzing the DMARC reports and speed up the overall implementation.

After you have signed up you can customize and generate the DMARC record after which the reports will be sent to the monitoring tool.

How to Configure Office 365 DMARC — LazyAdmin (3)

After a couple of days, you will see the first results in the aggregate reports. Keep monitoring the reports for a couple of weeks until you are certain that all your systems are configured correctly in the SPF record.

How to Configure Office 365 DMARC — LazyAdmin (4)

Wrapping Up

SPF and DKIM are important steps when it comes to protecting your email. But don’t forget DMARC. Most people don’t implement DMARC, because they are afraid that legitimate mail won’t arrive. But by starting with monitoring and using DMARC monitoring tools to analyze the reports you can safely implement DMARC for your Office 365 tenant.

If you have any questions, just drop a comment below.

0 Shares

How to Configure Office 365 DMARC — LazyAdmin (2024)

References

Top Articles
Latest Posts
Article information

Author: Twana Towne Ret

Last Updated:

Views: 5647

Rating: 4.3 / 5 (44 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Twana Towne Ret

Birthday: 1994-03-19

Address: Apt. 990 97439 Corwin Motorway, Port Eliseoburgh, NM 99144-2618

Phone: +5958753152963

Job: National Specialist

Hobby: Kayaking, Photography, Skydiving, Embroidery, Leather crafting, Orienteering, Cooking

Introduction: My name is Twana Towne Ret, I am a famous, talented, joyous, perfect, powerful, inquisitive, lovely person who loves writing and wants to share my knowledge and understanding with you.