Labs / Sealed Lines / DNSSEC & email authentication

Lab 1 of 2 · DNSSEC & email authentication

SPF, DKIM and DMARC: proving who sent an email

Read SPF, DKIM and DMARC, and watch a forged sender get caught.

Open this lab Pro 6 steps

The idea

Email authentication: a domain publishes in DNS who may send its mail (SPF), the key that signs it (DKIM) and what to do with mail that fails (DMARC), and a receiving server checks all three. Here mailNorth sends alice's mail for north.lab, northDns publishes north.lab's policies, mailSouth checks what reaches bob, and an attacker forges.

Two senders on one message
Two senders on one message
The signature proves the bytes, not the sender
The signature proves the bytes, not the sender

Steps

  1. The policies are TXT records in DNS

    SMTP lets any server claim any sender. So north.lab vouches for its mail in DNS with three TXT records: who may send (SPF), the signing key (DKIM), and what to do with failures (DMARC).

    bobLaptop:~# dig +short TXT north.lab
    bobLaptop:~# dig +short TXT _dmarc.north.lab
    bobLaptop:~# dig +short TXT lab._domainkey.north.lab
  2. mailNorth signs what its office sends

    A signature lets any receiver check that north.lab's server sent the message unchanged, whoever carried it. alice sends bob a report. mailNorth adds a DKIM-Signature header: north.lab's private key signing chosen headers and a hash of the body. Then bob reads it.

    aliceLaptop:~# curl smtp://mailNorth.lab --mail-from alice@north.lab --mail-rcpt bob@south.lab --upload-file ~/report.eml
    bobLaptop:~# curl -s -u bob:hunter2 'imap://mailSouth.lab/INBOX;UID=1'

Pro

4 more steps in the app

  1. mailSouth checks all three and writes down the verdict
  2. A forger claims to be alice
  3. Passing SPF is not enough: alignment
  4. A signature covers content, not the sender
Get Pro

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab