Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Lesson 4 of 6 · Worked example · 20 min · revision 2

Email Authentication from Monitor to Reject

Take a domain from p=none to p=reject the safe way: evaluate SPF with a small RFC 7208 evaluator, read RFC 9990 aggregate reports to find every sending service, fix a vendor with DKIM under your own domain, check each policy record against RFC 9989, and add the lookalike, reporting and payment-verification controls that DMARC does not provide.

Contentsand lesson path

What you will learn

  • Roll out SPF, DKIM and DMARC for a domain to an enforcing policy using aggregate reports, and explain the gateway, user-reporting and payment-verification controls that complement them against phishing and business email compromise.

01. The problem

In the phishing lab, a spoofed supplier email reached the inbox because the supplier's domain published p=none. Now the domain is yours. You run security for Brightwave, whose domain is brightwave.example. Staff send from your own mail servers and an office suite; a CRM vendor and a newsletter service also send as your domain. Your goal is a DMARC policy of p=reject, so that receivers refuse mail that fails, without blocking any of those legitimate services.

Three standards work together. SPF (RFC 7208) lists the servers allowed to send for the domain in the envelope sender, the address used during the SMTP transaction and later shown as Return-Path. DKIM (RFC 6376) adds a signature made with a key whose public half is published in DNS under a selector. DMARC (RFC 9989, May 2026, which replaced RFC 7489) ties them to the From address the reader sees: a message passes if SPF or DKIM passes for a domain aligned with it. DMARC also lets you ask receivers for daily aggregate reports (RFC 9990): XML summaries of every source that sent mail using your domain.

All the code below is standard-library Python 3.10 or later (tested with 3.12.13), in a folder called dmarc-lab. A JSON file stands in for DNS, and a script writes the reports that real receivers would send you.

Terminal
mkdir dmarc-lab && cd dmarc-lab

02. Step 1: Check what SPF authorises

Here are the records Brightwave starts with, written in DNS zone-file syntax. -all at the end means "everything not listed fails". Each include: pulls in another domain's list, which is how you authorise a service such as an office suite.

DNS zone · brightwave.example
$ORIGIN brightwave.example.
; SPF: one record per name, checked against the envelope sender's domain
@                TXT   "v=spf1 ip4:198.51.100.0/28 include:_spf.mailhost.test -all"
; DMARC in monitoring mode, asking receivers for daily aggregate reports
_dmarc           TXT   "v=DMARC1; p=none; rua=mailto:[email protected]"

dns.json holds the TXT records that the evaluator can see. spf.py implements the parts of RFC 7208 used here: ip4, include, redirect and all, the qualifiers + - ~ ?, and the limit of ten DNS-querying terms per check. A real evaluator also handles a, mx, ip6, exists and macros.

JSON · dmarc-lab/dns.json
{
  "brightwave.example": ["v=spf1 ip4:198.51.100.0/28 include:_spf.mailhost.test -all"],
  "_spf.mailhost.test": ["v=spf1 ip4:192.0.2.0/25 -all"],
  "news.brightwave.example": ["v=spf1 include:_spf.newsletters.test -all"],
  "_spf.newsletters.test": ["v=spf1 ip4:192.0.2.128/26 -all"],
  "crm-mail.test": ["v=spf1 ip4:203.0.113.128/27 -all"],
  "bounce.crm-mail.test": ["v=spf1 redirect=crm-mail.test"],
  "bloated.example": ["v=spf1 include:a.test include:b.test include:c.test -all"],
  "a.test": ["v=spf1 include:d.test include:e.test include:f.test -all"],
  "b.test": ["v=spf1 include:g.test include:h.test include:i.test -all"],
  "c.test": ["v=spf1 include:j.test include:k.test -all"],
  "d.test": ["v=spf1 -all"], "e.test": ["v=spf1 -all"], "f.test": ["v=spf1 -all"],
  "g.test": ["v=spf1 -all"], "h.test": ["v=spf1 -all"], "i.test": ["v=spf1 -all"],
  "j.test": ["v=spf1 -all"], "k.test": ["v=spf1 -all"]
}
Python · dmarc-lab/spf.py
"""A small SPF evaluator (RFC 7208 subset: ip4, include, redirect, all)."""
import ipaddress
import json
import sys

DNS = json.load(open("dns.json"))  # name -> TXT strings; stands in for real DNS
RESULT = {"+": "pass", "-": "fail", "~": "softfail", "?": "neutral"}


def check_host(ip, domain, lookups):
    records = [t for t in DNS.get(domain, []) if t.split()[0] == "v=spf1"]
    if len(records) != 1:
        return "none" if not records else "permerror"  # two records: an error
    redirect = None
    for term in records[0].split()[1:]:
        qualifier = term[0] if term[0] in RESULT else "+"
        term = term.lstrip("+-~?")
        if term.startswith(("include:", "redirect=")):
            lookups[0] += 1  # these terms cost a DNS query
            if lookups[0] > 10:
                return "permerror"
        if term.startswith("redirect="):
            redirect = term[9:]
            continue
        if term == "all":
            match = True
        elif term.startswith("ip4:"):
            match = ipaddress.ip_address(ip) in ipaddress.ip_network(term[4:])
        elif term.startswith("include:"):
            inner = check_host(ip, term[8:], lookups)
            if inner in ("permerror", "none"):
                return "permerror"
            match = inner == "pass"
        else:
            continue  # a, mx, exists, ip6 ... are left out of this sketch
        if match:
            return RESULT[qualifier]
    return check_host(ip, redirect, lookups) if redirect else "neutral"


for ip, mail_from_domain in [a.split(",") for a in sys.argv[1:]]:
    lookups = [0]
    result = check_host(ip, mail_from_domain, lookups)
    print(f"{ip:<14} MAIL FROM @{mail_from_domain:<22} spf={result:<9} "
          f"lookups={lookups[0]}")
Terminal
python3 spf.py 198.51.100.5,brightwave.example 192.0.2.10,brightwave.example \
  203.0.113.140,bounce.crm-mail.test 203.0.113.9,brightwave.example \
  198.51.100.5,bloated.example
Expected output
198.51.100.5   MAIL FROM @brightwave.example     spf=pass      lookups=0
192.0.2.10     MAIL FROM @brightwave.example     spf=pass      lookups=1
203.0.113.140  MAIL FROM @bounce.crm-mail.test   spf=pass      lookups=1
203.0.113.9    MAIL FROM @brightwave.example     spf=fail      lookups=1
198.51.100.5   MAIL FROM @bloated.example        spf=permerror lookups=11

Your servers pass directly and the office suite passes through its include. The CRM vendor also passes, but for bounce.crm-mail.test, because it uses its own envelope sender. That pass will not help DMARC, which needs a domain aligned with brightwave.example. The forged message from 203.0.113.9 fails. The last line shows a classic outage: bloated.example chains includes until the eleventh lookup, so the result is permerror and every message from that domain fails SPF, even from authorised servers. Publishing two SPF records for one name is also a permerror.

03. Step 2: Publish a monitoring policy and collect reports

The DMARC record above says p=none with a rua address. That is monitoring mode: receivers apply no policy but send reports. RFC 9989 describes this as the usual start, because almost every organisation has a sender it forgot about. If reports go to an address in another domain, such as a reporting service, that domain must publish a record that accepts them (RFC 9990, section 4), so that nobody can flood a stranger with reports.

Real reports usually arrive by email as compressed XML. make_reports.py writes three of them in the RFC 9990 format: two receivers on 2 November, and one receiver on 16 November after a fix you will make in step 4.

Python · dmarc-lab/make_reports.py
"""Write three DMARC aggregate reports in the RFC 9990 format (lab fixtures)."""
from datetime import datetime, timezone
from xml.etree import ElementTree as ET

NS = "urn:ietf:params:xml:ns:dmarc-2.0"
BW = "brightwave.example"
# source_ip, count, envelope_from domain, spf result, [(dkim domain, selector, result)]
WEEK1_A = [("198.51.100.5", 1200, BW, "pass", [(BW, "bw1", "pass")]),
           ("192.0.2.10", 800, BW, "pass", [(BW, "s1", "pass")]),
           ("203.0.113.140", 300, "bounce.crm-mail.test", "pass", []),
           ("198.51.100.77", 40, BW, "fail", [(BW, "bw1", "pass")]),
           ("203.0.113.9", 25, BW, "fail", [])]
WEEK1_B = [("198.51.100.5", 900, BW, "pass", [(BW, "bw1", "pass")]),
           ("203.0.113.141", 150, "bounce.crm-mail.test", "pass", []),
           ("192.0.2.140", 400, "news." + BW, "pass", [("news." + BW, "nl", "pass")]),
           ("192.0.2.200", 60, BW, "fail", [(BW, "bw1", "fail")])]
WEEK3_A = [(ip, n, env, spf, [(BW, "crm1", "pass")] if "crm" in env else dkim)
           for ip, n, env, spf, dkim in WEEK1_A]


def org(domain):
    return ".".join(domain.split(".")[-2:])  # lab shortcut for the tree walk


def add(parent, tag, text=None):
    node = ET.SubElement(parent, tag)
    if text is not None:
        node.text = str(text)
    return node


def report(path, reporter, day, rows):
    begin = int(datetime(*day, tzinfo=timezone.utc).timestamp())
    root = ET.Element("feedback", xmlns=NS)
    add(root, "version", "1.0")
    meta = add(root, "report_metadata")
    add(meta, "org_name", reporter)
    add(meta, "email", f"dmarc-noreply@{reporter}")
    add(meta, "report_id", f"{reporter}-{begin}")
    dates = add(meta, "date_range")
    add(dates, "begin", begin)
    add(dates, "end", begin + 86399)
    policy = add(root, "policy_published")
    for tag, value in [("domain", BW), ("p", "none"), ("discovery_method", "treewalk")]:
        add(policy, tag, value)
    for ip, count, env, spf, dkims in rows:
        dkim_ok = any(r == "pass" and org(d) == org(BW) for d, _, r in dkims)
        spf_ok = spf == "pass" and org(env) == org(BW)
        record = add(root, "record")
        row = add(record, "row")
        add(row, "source_ip", ip)
        add(row, "count", count)
        evaluated = add(row, "policy_evaluated")
        add(evaluated, "disposition", "none")  # p=none: monitor only
        add(evaluated, "dkim", "pass" if dkim_ok else "fail")
        add(evaluated, "spf", "pass" if spf_ok else "fail")
        ids = add(record, "identifiers")
        add(ids, "header_from", BW)
        add(ids, "envelope_from", env)
        auth = add(record, "auth_results")
        for domain, selector, result in dkims:
            dkim = add(auth, "dkim")
            for tag, value in [("domain", domain), ("selector", selector),
                               ("result", result)]:
                add(dkim, tag, value)
        spf_node = add(auth, "spf")
        add(spf_node, "domain", env)
        add(spf_node, "result", spf)
    ET.indent(root)
    ET.ElementTree(root).write(path, encoding="unicode", xml_declaration=True)


report("week1-a.xml", "receiver-a.test", (2026, 11, 2), WEEK1_A)
report("week1-b.xml", "receiver-b.test", (2026, 11, 2), WEEK1_B)
report("week3-a.xml", "receiver-a.test", (2026, 11, 16), WEEK3_A)
print("wrote week1-a.xml, week1-b.xml, week3-a.xml")
Terminal
python3 make_reports.py
head -n 43 week1-a.xml
Expected output
wrote week1-a.xml, week1-b.xml, week3-a.xml
<?xml version='1.0' encoding='utf-8'?>
<feedback xmlns="urn:ietf:params:xml:ns:dmarc-2.0">
  <version>1.0</version>
  <report_metadata>
    <org_name>receiver-a.test</org_name>
    <email>[email protected]</email>
    <report_id>receiver-a.test-1793577600</report_id>
    <date_range>
      <begin>1793577600</begin>
      <end>1793663999</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>brightwave.example</domain>
    <p>none</p>
    <discovery_method>treewalk</discovery_method>
  </policy_published>
  <record>
    <row>
      <source_ip>198.51.100.5</source_ip>
      <count>1200</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
    <identifiers>
      <header_from>brightwave.example</header_from>
      <envelope_from>brightwave.example</envelope_from>
    </identifiers>
    <auth_results>
      <dkim>
        <domain>brightwave.example</domain>
        <selector>bw1</selector>
        <result>pass</result>
      </dkim>
      <spf>
        <domain>brightwave.example</domain>
        <result>pass</result>
      </spf>
    </auth_results>
  </record>

Each record describes one source IP. policy_evaluated holds the DMARC view, where pass means pass and aligned. auth_results holds the raw SPF and DKIM results with the domains that were checked. Reading the two side by side shows why a source fails.

04. Step 3: Read the aggregate reports

dmarc_report.py maps each source IP to a service from your sender inventory, the list of services you know send as your domain, and adds up the counts. It removes the XML namespace, so reports in the older RFC 7489 format parse too.

Python · dmarc-lab/dmarc_report.py
"""Summarise DMARC aggregate reports by sending service."""
import ipaddress
import sys
from collections import defaultdict
from xml.etree import ElementTree as ET

INVENTORY = {  # every service you know sends as your domain
    "198.51.100.0/28": "own mail servers",
    "192.0.2.0/25": "office suite (mailhost.test)",
    "192.0.2.128/26": "newsletter service",
    "203.0.113.128/27": "CRM vendor (crm-mail.test)",
}


def sender(ip):
    for net, name in INVENTORY.items():
        if ipaddress.ip_address(ip) in ipaddress.ip_network(net):
            return name
    return f"unknown {ip}"


def text(node, path):
    found = node.find(path)
    return found.text if found is not None else "-"


totals = defaultdict(lambda: [0, 0, set()])  # name -> [messages, dmarc pass, notes]
for path in sys.argv[1:]:
    root = ET.parse(path).getroot()
    for el in root.iter():  # drop the namespace so RFC 7489 reports parse too
        el.tag = el.tag.split("}")[-1]
    for record in root.iter("record"):
        count = int(text(record, "row/count"))
        aligned_dkim = text(record, "row/policy_evaluated/dkim") == "pass"
        aligned_spf = text(record, "row/policy_evaluated/spf") == "pass"
        entry = totals[sender(text(record, "row/source_ip"))]
        entry[0] += count
        entry[1] += count if aligned_dkim or aligned_spf else 0
        spf = f"spf {text(record, 'auth_results/spf/result')} for " \
              f"{text(record, 'auth_results/spf/domain')}"
        dkims = [f"{text(d, 'result')} for {text(d, 'domain')}"
                 for d in record.iter("dkim") if d.find("domain") is not None]
        entry[2].add(f"{spf}; dkim {', '.join(dkims) or 'none'}")

known_total = known_pass = 0
print(f"{'sending service':<29}{'messages':>9}{'DMARC pass':>12}")
for name, (count, passed, notes) in sorted(totals.items(), key=lambda t: -t[1][0]):
    print(f"{name:<29}{count:>9}{passed / count:>12.0%}")
    for note in sorted(notes):
        print(f"    {note}")
    if not name.startswith("unknown"):
        known_total, known_pass = known_total + count, known_pass + passed
print(f"known services: {known_pass} of {known_total} messages pass DMARC")
Terminal
python3 dmarc_report.py week1-a.xml week1-b.xml
Expected output
sending service               messages  DMARC pass
own mail servers                  2100        100%
    spf pass for brightwave.example; dkim pass for brightwave.example
office suite (mailhost.test)       800        100%
    spf pass for brightwave.example; dkim pass for brightwave.example
CRM vendor (crm-mail.test)         450          0%
    spf pass for bounce.crm-mail.test; dkim none
newsletter service                 400        100%
    spf pass for news.brightwave.example; dkim pass for news.brightwave.example
unknown 192.0.2.200                 60          0%
    spf fail for brightwave.example; dkim fail for brightwave.example
unknown 198.51.100.77               40        100%
    spf fail for brightwave.example; dkim pass for brightwave.example
unknown 203.0.113.9                 25          0%
    spf fail for brightwave.example; dkim none
known services: 3300 of 3750 messages pass DMARC

Work through the list from the top. Your servers and the office suite pass with both methods. The newsletter service passes because DKIM uses news.brightwave.example, a subdomain, and relaxed alignment accepts the same organisational domain. The CRM vendor sends 450 messages that all fail: its SPF pass is for its own bounce domain, and it does not sign with DKIM at all. Under p=reject those messages would be refused.

Three sources are not in the inventory. 198.51.100.77 fails SPF but passes DKIM for your domain: the typical pattern of a forwarder or mailing list, which relays the message from a new IP while the signature survives. 203.0.113.9 and 192.0.2.200 fail everything; the second even carries a broken signature that claims your domain. Unless someone recognises them as a forgotten service, they are the spoofing that enforcement is meant to stop.

05. Step 4: Fix the CRM vendor with DKIM under your domain

Adding the vendor's servers to your SPF record would not help, because SPF is checked against the vendor's envelope domain. The fix is to have the vendor sign with d=brightwave.example. Most vendors support this: they give you a selector, and you publish their key under it, often as a CNAME so they can rotate it. Some vendors can also use a bounce subdomain of yours, which aligns SPF; DKIM is the more robust choice because it survives forwarding.

DNS zone · added for the CRM vendor
$ORIGIN brightwave.example.
; The CRM vendor signs with d=brightwave.example and selector crm1. A CNAME
; to the vendor's key lets the vendor rotate the key without asking you.
crm1._domainkey  CNAME crm1.dkim.crm-mail.test.

Once the vendor signs, the next reports show the change. Run the summary on the 16 November report:

Terminal
python3 dmarc_report.py week3-a.xml
Expected output
sending service               messages  DMARC pass
own mail servers                  1200        100%
    spf pass for brightwave.example; dkim pass for brightwave.example
office suite (mailhost.test)       800        100%
    spf pass for brightwave.example; dkim pass for brightwave.example
CRM vendor (crm-mail.test)         300        100%
    spf pass for bounce.crm-mail.test; dkim pass for brightwave.example
unknown 198.51.100.77               40        100%
    spf fail for brightwave.example; dkim pass for brightwave.example
unknown 203.0.113.9                 25          0%
    spf fail for brightwave.example; dkim none
known services: 2300 of 2300 messages pass DMARC

06. Step 5: Move to enforcement

Every known service now passes. Move in steps, and keep rua so that you keep seeing the effect. First p=quarantine, which asks receivers to treat failing mail as suspicious (usually the spam folder). After some weeks with no legitimate failures, p=reject. Add np=reject (first defined in RFC 9091, now in the core standard) for subdomains that do not exist, a favourite of spoofers. The right number of weeks depends on how often your services send: a quarterly payroll run needs a quarter of reports.

RFC 9989 also removed the pct tag, which asked receivers to apply the policy to a percentage of mail, because receivers applied it inconsistently. It added t=y, a test flag that asks receivers to apply one level less. Receivers that still follow RFC 7489 do not know t, so do not count on it. check_dmarc.py reads records with the RFC 9989 rules; the last three lines of records.txt are deliberate mistakes.

Text · dmarc-lab/records.txt
v=DMARC1; p=none; rua=mailto:[email protected]
v=DMARC1; p=quarantine; rua=mailto:[email protected]
v=DMARC1; p=reject; np=reject; rua=mailto:[email protected]
v=DMARC1; p=quarantine; pct=25; rua=mailto:[email protected]
p=reject; v=DMARC1; rua=mailto:[email protected]
v=DMARC1; p=reject
Python · dmarc-lab/check_dmarc.py
"""Read DMARC policy records the way RFC 9989 tells receivers to."""
import sys

KNOWN = {"v", "p", "sp", "np", "adkim", "aspf", "fo", "psd", "rua", "ruf", "t"}
POLICIES = {"none", "quarantine", "reject"}


def check(record):
    tags = [part.strip().split("=", 1) for part in record.split(";") if part.strip()]
    if not tags or tags[0] != ["v", "DMARC1"]:
        return ["IGNORED: the record must start with v=DMARC1"]
    found = dict(tags)
    notes = [f"unknown tag '{name}' is ignored" for name, _ in tags
             if name not in KNOWN]
    policy = found.get("p", "none")  # a valid record without p counts as p=none
    if policy not in POLICIES:
        notes.append(f"p={policy} is not a valid policy")
    if "rua" not in found:
        notes.append("no rua: receivers send no aggregate reports")
    mode = "monitoring" if policy == "none" else f"enforcing, p={policy}"
    if found.get("t") == "y" and policy != "none":
        mode += " in test mode (one level lower)"
    for tag in ("sp", "np"):
        if tag in found:
            mode += f", {tag}={found[tag]}"
    return [mode] + notes


for n, line in enumerate(open(sys.argv[1]), 1):
    print(f"{n}. " + "; ".join(check(line.strip())))
Terminal
python3 check_dmarc.py records.txt
Expected output
1. monitoring
2. enforcing, p=quarantine
3. enforcing, p=reject, np=reject
4. enforcing, p=quarantine; unknown tag 'pct' is ignored
5. IGNORED: the record must start with v=DMARC1
6. enforcing, p=reject; no rua: receivers send no aggregate reports

Record 4 still enforces quarantine on all failing mail, because pct is now an unknown tag. Record 5 is ignored as a whole, because v=DMARC1 must come first. Record 6 enforces, but you have stopped the reports that would tell you about a broken sender.

07. Step 6: Add the controls DMARC does not provide

DMARC protects only your exact domain. A lookalike domain, such as brlghtwave.example with a lower-case L, is a different domain; it can publish its own SPF, DKIM and DMARC and pass them all. Business email compromise (BEC) fraud often uses lookalikes, or a supplier's real but compromised mailbox, to ask for a change of bank details. lookalike.py flags inbound sender domains that imitate yours or a key supplier's: same skeleton after mapping look-alike characters, the brand name inside another domain, or one or two edits away.

Python · dmarc-lab/lookalike.py
"""Flag inbound sender domains that imitate our domain or a key supplier's."""
PROTECTED = ["brightwave.example", "northwind-traders.example"]
ALLOW = {"brightwater.example"}  # a real partner whose name happens to be close
INBOUND = ["brightwave.example", "brlghtwave.example", "brightvvave.example",
           "brightwave-invoices.test", "brightwater.example", "coffee-club.test",
           "northwind-traders.example", "northwlnd-traders.example",
           "northwind-pay.test"]
CONFUSABLE = [("vv", "w"), ("rn", "m"), ("0", "o"), ("1", "l"), ("i", "l")]


def skeleton(name):
    """Map look-alike characters to one form, so 'brlght' and 'bright' compare equal."""
    label = name.split(".")[0]
    for fake, real in CONFUSABLE:
        label = label.replace(fake, real)
    return label


def distance(a, b):
    """Levenshtein edit distance."""
    row = list(range(len(b) + 1))
    for i, ca in enumerate(a, 1):
        prev, row[0] = row[0], i
        for j, cb in enumerate(b, 1):
            prev, row[j] = row[j], min(row[j] + 1, row[j - 1] + 1, prev + (ca != cb))
    return row[-1]


for domain in INBOUND:
    if domain in ALLOW:
        print(f"skip {domain:<26} allow-listed partner")
        continue
    for target in PROTECTED:
        brand = target.split(".")[0].split("-")[0]
        if domain == target:
            continue
        if skeleton(domain) == skeleton(target):
            reason = "homoglyphs"
        elif brand in domain:
            reason = f"contains '{brand}'"
        elif distance(skeleton(domain), skeleton(target)) <= 2:
            reason = "within 2 edits"
        else:
            continue
        print(f"FLAG {domain:<26} {reason:<22} {target}")
Terminal
python3 lookalike.py
Expected output
FLAG brlghtwave.example         homoglyphs             brightwave.example
FLAG brightvvave.example        homoglyphs             brightwave.example
FLAG brightwave-invoices.test   contains 'brightwave'  brightwave.example
skip brightwater.example        allow-listed partner
FLAG northwlnd-traders.example  homoglyphs             northwind-traders.example
FLAG northwind-pay.test         contains 'northwind'   northwind-traders.example

brightwater.example is a real partner one or two edits away, which is why it is on the allow-list. A gateway can use such flags to tag or quarantine mail, alongside external-sender banners, URL rewriting with checks at the time of click, and attachment sandboxing. The control that stops the payment, though, is a process: verify every change of bank details by calling the supplier on a number you already hold, not one from the email. Add a one-click report button, so that users like Amy become sensors.

08. Common mistakes

09. Check your understanding

Practice check · 3 questions

SPF, reports and policy

Three questions about the code and data in this worked example.

Q1. You add `include:_spf.helpdesk.test` before `-all` in brightwave.example's record, but `dns.json` has no record for `_spf.helpdesk.test`. What does `spf.py` print for 203.0.113.9?
Q2. In the first summary, `unknown 198.51.100.77` fails SPF but passes DKIM for brightwave.example. What is the most likely cause, and what should you do?
Q3. The 16 November report shows every known service passing, but spoofed mail from 203.0.113.9 still arrives. Which record should you publish next?
Practice only: not graded, not saved, not evidence.

10. Apply it

For the skill project, do this for a domain you own or a test domain at your DNS provider:

  • Publish SPF, set up DKIM signing for every service that sends as the domain, and publish p=none with a rua address. Check the records with check_dmarc.py and a DNS query (dig TXT _dmarc.<your-domain>).
  • Feed the first week of real reports into dmarc_report.py (unzip them first) and extend INVENTORY until no legitimate source is unknown.
  • Write the rollout plan: the gate for p=quarantine, the gate for p=reject, who signs off, and how you will roll back if a service breaks. Add one paragraph on lookalike monitoring and payment verification for the finance team.

11. Review prompt

Without looking back:

  1. Which identity does SPF check, which does DKIM check, and what does DMARC add?
  2. Why do you start with p=none and a rua address, and what tells you it is safe to move on?
  3. Why does a vendor's SPF pass not satisfy DMARC, and how does DKIM fix it?
  4. Name three controls against payment fraud that DMARC on your own domain cannot provide.

References

Your progress

Reading state

Sign in to save that you finished reading this lesson.

Sign in to mark reading complete

Prove this skill

8 questions · about 6 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.
Take the skill check