networking:bind:dmarc_domain-based_message_authentication_reporting_and_conformance
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
networking:bind:dmarc_domain-based_message_authentication_reporting_and_conformance [2020/05/12 15:01] – [rf: Report Format (Optional)] peter | networking:bind:dmarc_domain-based_message_authentication_reporting_and_conformance [2020/05/12 15:35] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Networking - Bind - DMARC (Domain-based Message Authentication Reporting and Conformance) ====== | ||
- | |||
- | **DMARC** is built upon two other authentication protocols: | ||
- | |||
- | - [[Networking: | ||
- | - [[Networking: | ||
- | |||
- | A DMARC policy allows a sender to indicate that their messages are protected by SPF and/or DKIM, and tells a receiver what to do if neither of those authentication methods passes – such as junk or reject the message. | ||
- | |||
- | The receiver will look to the established policy to make a determination on where to filter mail. | ||
- | |||
- | So DMARC requires one or the other, though it makes it easier to fail if SPF and DKIM aren't both implemented. | ||
- | |||
- | ---- | ||
- | |||
- | ===== DNS config ===== | ||
- | |||
- | DMARC-policies are published as TXT records, in DNS. | ||
- | |||
- | The basic record looks like this: | ||
- | |||
- | <code bash> | ||
- | _dmarc.example.com. IN TXT " | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== Lookup DMARC record ===== | ||
- | |||
- | Use dig or nslookup. | ||
- | |||
- | <code bash> | ||
- | dig -t txt _dmarc.example.com +short | ||
- | </ | ||
- | |||
- | |||
- | ---- | ||
- | |||
- | ===== DMARC tags ===== | ||
- | |||
- | DMARC tags tell the email receiver to | ||
- | |||
- | - Check for DMARC and | ||
- | - What to do with messages that fail DMARC authentication. | ||
- | |||
- | |||
- | ^Tag Name^Required^Purpose^Sample^ | ||
- | |v|required|Protocol version|v=DMARC1| | ||
- | |p|required|Policy for domain|p=quarantine| | ||
- | |pct|optional|% of messages subjected to filtering|pct=20| | ||
- | |rua|optional|Reporting URI of aggregate reports|rua=mailto: | ||
- | |ruf|optional|Reporting URI of failure reports|ruf=mailto: | ||
- | |sp|optional|Policy for subdomains of the domain|sp=reject| | ||
- | |aspf|optional|Alignment mode for SPF|aspf=r| | ||
- | |adkim|optional|Alignment mode for DKIM|adkim=r| | ||
- | |fo|optional|Failure reports options|fo=0| | ||
- | |rf|optional|Failure report format|rf=ATRF| | ||
- | |||
- | |||
- | ---- | ||
- | |||
- | ==== v: Version ==== | ||
- | |||
- | This tag is used to identify the TXT record as a DMARC record, so email receivers can distinguish it from other TXT records. | ||
- | |||
- | The v: tag must have the value of " | ||
- | |||
- | If the value doesn' | ||
- | |||
- | Example: | ||
- | |||
- | <code bash> | ||
- | v=DMARC1 | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ==== p: Requested Mail Receiver Policy ==== | ||
- | |||
- | This tag indicates the policy to be enacted by the receiver for messages that fail DMARC authentication and alignment checks, as specified by the domain owner. | ||
- | |||
- | This policy will apply to the domain queried and to all subdomains unless a separate subdomain policy is explicitly described. | ||
- | |||
- | It must be the **second** tag within the entire DMARC record. | ||
- | |||
- | There are three possible values for the p: tag. | ||
- | |||
- | * **p=none**: The domain owner requests no specific action be taken on mail that fails DMARC authentication and alignment. | ||
- | * **p=quarantine**: | ||
- | * **p=reject**: | ||
- | |||
- | Given the information above, the most basic DMARC record example could be: | ||
- | |||
- | <code bash> | ||
- | v=DMARC1; p=none | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ==== rua: Reporting URI of aggregate reports (Optional) ==== | ||
- | |||
- | Indicates where aggregate DMARC reports should be sent to. | ||
- | |||
- | Senders designate the destination address in the following format: | ||
- | |||
- | <code bash> | ||
- | rua=mailto: | ||
- | </ | ||
- | |||
- | If not present aggregate reports will not be sent from the receiving MTA. | ||
- | |||
- | Where a mailto address lies within the sending zone no additional configuration is required, however if the mailto address lies outside the sending zone an additional empty DMRC RR is required. | ||
- | |||
- | Thus, if the email sending zone is example.net and the DMARC TXT RR contains the parameter **rua=mailto: | ||
- | |||
- | If, however the email sending zone is example.net and the DMARC TXT RR in the zone file for example.net contains the parameter **rua=mailto: | ||
- | |||
- | <code bash> | ||
- | # example.com zone file fragment | ||
- | $ORIGIN example.com. | ||
- | ... | ||
- | # Authorizes the receiving of DMARC reports for example.net. | ||
- | example.net._report._dmarc | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ==== ruf: Reporting URI of failure reports (Optional) ==== | ||
- | |||
- | Indicates where forensic DMARC reports should be sent to. | ||
- | |||
- | Senders designate the destination address in the following format: | ||
- | |||
- | <code bash> | ||
- | ruf=mailto: | ||
- | </ | ||
- | |||
- | The addresses is a comma separated list of DMARC URIs used in conjunction with the **fo** key. | ||
- | |||
- | Where a mailto address is lies with the sending zone no additional configuration is required, however if the mailto address lies outside the sending zone an additional empty DMRC RR is required. | ||
- | |||
- | Thus, if the email sending zone is example.net and the DMARC TXT RR contains the parameter **ruf=mailto: | ||
- | |||
- | If, however the email sending zone is example.net and the DMARC TXT RR in the zone file for example.net contains the parameter **ruf=mailto: | ||
- | |||
- | <code bash> | ||
- | # example.com zone file fragment | ||
- | $ORIGIN example.com. | ||
- | ... | ||
- | # authorises the receiving of DMARC reports for example.net | ||
- | example.net._report._dmarc | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ==== adkim: DKIM identifier alignment ==== | ||
- | |||
- | Indicates strict or relaxed DKIM identifier alignment. | ||
- | |||
- | The default is relaxed. | ||
- | |||
- | * **r** (relaxed - default) or | ||
- | * **s** (strict) mode | ||
- | |||
- | In strict mode the sender domain name must exactly match the corresponding d=name (in the DKIM mail headers). | ||
- | |||
- | In relaxed mode any subdomain of d=domain (in the mail headers) will also be accepted. | ||
- | |||
- | Thus if d=example.com in the mail header then mail from user@example.com will pass from either adkim = r or adkim=s, however, mail from user@a.example.com will fail if adkim=s but pass if adkim=r. | ||
- | |||
- | ---- | ||
- | |||
- | ==== aspf: Alignment mode for SPF ==== | ||
- | |||
- | Indicates strict or relaxed SPF identifier alignment. | ||
- | |||
- | The default is relaxed. | ||
- | |||
- | * **r** (relaxed - default) or | ||
- | * **s** (strict) mode | ||
- | |||
- | In strict mode the domain.name in the MAIL FROM command (in SMTP) and the from: header (in the mail item) must match exactly. | ||
- | |||
- | In relaxed mode any valid subdomain of domain.name is acceptable. | ||
- | |||
- | ---- | ||
- | |||
- | ==== rf: Report Format (Optional) ==== | ||
- | |||
- | Format used for the message-specific failure reports expressed as an optional comma-separated list of values. | ||
- | |||
- | The two accepted formats are | ||
- | |||
- | * **afrf**: Message format for error reporting (Abuse Report format) is defined by RFC 5965. | ||
- | * **iodf**: Message format for error reporting (Incident Object Description Exchange Format) is defined by RFC 5070. | ||
- | |||
- | Note that receivers can define other formats, albeit this should be a rare occurrence as most operations are embracing ARF as the reporting format of choice. | ||
- | |||
- | The default is Authentication Failure Reporting Format, or " | ||
- | |||
- | ---- | ||
- | |||
- | ==== ri: Reporting Interval (Optional) ==== | ||
- | |||
- | The number of seconds elapsed between sending aggregate reports to the sender. | ||
- | |||
- | Implicitly anything less than 1 hour (3600) can be rounded up to 1 hour by the receiving MTA. | ||
- | |||
- | ---- | ||
- | |||
- | ==== pct: Percentage of messages to which the DMARC policy is to be applied (Optional) ==== | ||
- | |||
- | Defines the percentage of mail to which the DMARC policy applies. | ||
- | |||
- | The specification does not mandate how to calculate this percentage. | ||
- | |||
- | ---- | ||
- | |||
- | ==== fo: Failure reports options (Optional) ==== | ||
- | |||
- | Dictates what type of authentication and/or alignment vulnerabilities are reported back to the Domain Owner. | ||
- | |||
- | There are four values to the latter **fo:** tag: | ||
- | |||
- | * **0**: Generate a DMARC failure report if all underlying authentication mechanisms fail to produce an aligned " | ||
- | * **1**: Generate a DMARC failure report if any underlying authentication mechanism produced something other than an aligned " | ||
- | * **d**: Generate a DKIM failure report if the message had a signature that failed evaluation, regardless of its alignment. | ||
- | * **s**: Generate an SPF failure report if the message failed SPF evaluation, regardless of its alignment. | ||
- | |||
- | While the default is **" | ||
- | |||
- | Defines the error reporting policy the sending MTA requests from the receiving MTA. Multiple options may be defined using colon (:) separated values, for example, **fo=0:s**. | ||
- | |||
- | ---- | ||
- | |||
- | ==== sp: Subdomain Policy (Optional) ==== | ||
- | |||
- | If sp= is present it indicates the defined policy that applies to subdomains. | ||
- | |||
- | There are three possible values for the sp: tag. | ||
- | |||
- | * **p=none**: The subdomain owner requests no specific action be taken on mail that fails DMARC authentication and alignment. | ||
- | * **p=quarantine**: | ||
- | * **p=reject**: | ||
- | |||
- | For example | ||
- | |||
- | <code bash> | ||
- | _dmarc | ||
- | </ | ||
- | |||
- | Failed mail from user@example.com would be rejected but mail from user@a.example.com or user@b.a.example.com or user@anything.example.com would be quarantined. | ||
- | |||
- | ---- | ||
- | |||
- | ===== What about sub-domains? | ||
- | |||
- | The final DMARC tag we will discuss today is the sp: tag, which is used to indicate a requested policy for all subdomains where mail is failing the DMARC authentication and alignment checks. | ||
- | |||
- | For the following scenarios, we will use the top-level domain of " | ||
- | |||
- | - The Domain Owner wants to enforce a reject policy for " | ||
- | |||
- | - Domain Owner wants to enforce a reject policy for " | ||
- | |||
- | ---- | ||
- | |||
- | ===== Create a DMARC record in monitor mode ===== | ||
- | |||
- | <code bash> | ||
- | v=DMARC1; p=none; fo=1; rua=mailto: | ||
- | </ | ||
- | |||
- | With DMARC in monitor mode, you can gather the information on your entire email ecosystem, including who is sending email on behalf of your brand, what emails are getting delivered, and what emails are not. | ||
- | |||
- | Request to receive the daily aggregate and forensic reports by specifying your email address in the rua tag and the ruf tag, respectively. | ||
- | |||
- | ---- | ||
- | |||
- | ===== Deploy Slowly ===== | ||
- | |||
- | It is strongly recommended to ramp up DMARC use slowly by employing these policies in this order. | ||
- | |||
- | Similarly, the optional pct tag can be used to stage and sample your DMARC deployment. | ||
- | |||
- | A conservative deployment cycle would resemble: | ||
- | |||
- | <code bash> | ||
- | 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. | ||
- | </ | ||
- | |||
- | Attempt to remove the percentages as quickly as possible to complete the deployment. | ||
- | |||
- | As always, review your daily reports. | ||
- | |||
- | ---- | ||
- | |||
- | ===== Examples ===== | ||
- | |||
- | <code bash> | ||
- | v=DMARC1; p=reject; fo=1; rua=mailto: | ||
- | </ | ||
- | |||
- | |||
- | Choose how you want recipient servers to handle email from your domain that fails SPF/DKIM validation. Options are outlined below in red: | ||
- | |||
- | <code bash> | ||
- | None: " | ||
- | Reject: " | ||
- | Quarantine: " | ||
- | </ | ||
- | |||
- | Alternately, | ||
- | |||
- | < | ||
- | None: " | ||
- | Reject: " | ||
- | Quarantine: " | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ==== Single Domain Name using DKIM and SPF - Aggressive ==== | ||
- | |||
- | This is an aggressive policy and should only be adopted where the sender is certain that both DKIM and SPF are correctly configured. | ||
- | |||
- | <code bash> | ||
- | # example.net zone file fragment | ||
- | $ORIGIN example.net. | ||
- | ... | ||
- | _dmarc | ||
- | " | ||
- | |||
- | # NOTE: since the required email address is out-of-zone the | ||
- | # following change to the zone file for example.com must be made | ||
- | # example.com zone file fragment | ||
- | $ORIGIN example.com. | ||
- | ... | ||
- | example.net._report._dmarc | ||
- | # functionally identical | ||
- | example.net._report._dmarc.example.net. | ||
- | ... | ||
- | </ | ||
- | |||
- | Strictly, the adkim=, aspf=, ri= and pct= are not necessary since their defaults are used. However, explicit use of defaults is good defensive configuration policy, and can prevent catastrophic errors in the event that a default is subsequently changed. | ||
- | |||
- | ---- | ||
- | |||
- | ==== Single Domain Name using DKIM and SPF - Timid ==== | ||
- | |||
- | This is a timid (or cautious if you prefer) policy where the sender is discovering the real pathology of their mail service and is unsure (or has no idea) if either DKIM and SPF are correctly configured. | ||
- | |||
- | <code bash> | ||
- | # example.net zone file fragment | ||
- | $ORIGIN example.net. | ||
- | ... | ||
- | _dmarc | ||
- | " | ||
- | </ | ||
- | |||
- | Strictly, the adkim=, aspf=, ri= and pct= are not necessary since their defaults are used. However, explicit use of defaults is good defensive configuration policy. | ||
- | |||
- | ---- | ||
- | |||
- | ==== Single Domain Name using SPF only - Aggressive ==== | ||
- | |||
- | This is an aggressive policy and should only be adopted where the sender is certain that SPF is correctly configured. Assume the domain example.net only sends mail in the form user@example.net (mail is not sent from any subdomain) and that only SPF is used in relaxed format. | ||
- | |||
- | <code bash> | ||
- | # example.net zone file fragment | ||
- | $ORIGIN example.net. | ||
- | ... | ||
- | _dmarc | ||
- | " | ||
- | </ | ||
- | |||
- | Strictly, the aspf=, ri= and pct= are not necessary since their defaults are used. However, explicit use of defaults is good defensive configuration policy. | ||
- | |||
- | ---- | ||
- | |||
- | ==== No mail ==== | ||
- | |||
- | This is a supreme act of good neighborliness. | ||
- | |||
- | <code bash> | ||
- | # example.net zone file fragment | ||
- | $ORIGIN example.net. | ||
- | ... | ||
- | # negative (or dummy) SPF RR | ||
- | example.net. TXT " | ||
- | ... | ||
- | _dmarc | ||
- | </ | ||
- | |||
- | In this case the DMARC is simply saying reject any mail from this domain that fails the SPF check and the SPF TXT RR, by use of the -all ensures that all mail fails the SPF test. Net result - no mail is allowed to be sent from this domain name. | ||
- | |||
- | ---- | ||
- | |||
- | ===== References ===== | ||
- | |||
- | https:// | ||
networking/bind/dmarc_domain-based_message_authentication_reporting_and_conformance.1589295662.txt.gz · Last modified: 2020/07/15 09:30 (external edit)