Karta.Auth.DMARC (Karta v1.0.0)

DMARC (RFC 9989, which obsoletes RFC 7489): whether a message's author domain, the domain of its From: address, is authenticated by an aligned SPF or DKIM pass, and what the domain's owner asks for when it is not.

Policy discovery and organisational domains use the DNS tree walk (§4.10), not the Public Suffix List: the record at _dmarc.<author domain>, else the walk up the tree, at most 8 queries however many labels the name has (a name of 8 or more labels skips to its last 7). The organisational domain is the domain of a record with psd=n, the domain one label below a record with psd=y, or else the shortest name with a record (§4.10.2). The policy is p for the author domain's own record; for a parent's, sp (the author domain exists) or np (it does not: NXDOMAIN), falling back to p (§4.10.1).

Alignment (§4.4): strict, the identifier is the author domain; relaxed, both have the same organisational domain. An identifier that is not the author's organisational domain or below it cannot have the same one, so it is not walked: a stranger's DNS cannot slow the check down or turn a fail into a temperror. An organisational domain that the Public Suffix List (Karta.PublicSuffix) lists as a public suffix only aligns with itself: a record published at a suffix without psd=y must not make every domain under it aligned with every other.

Results are Karta.Auth.DMARC.Results: pass if one aligned identifier passed; otherwise temperror if a lookup the answer depends on failed (the policy, an organisational domain, or an aligned SPF or DKIM check that ended in temperror); otherwise fail (§5.3.6).

Options: :dns (options for Karta.DNS.lookup/3) and :deadline (a System.monotonic_time(:millisecond) after which lookups stop, giving temperror).

Summary

Types

The authenticated identifiers: the SPF result of the MAIL FROM identity and every DKIM result, each with result and domain.

Functions

Evaluates DMARC for author, a domain name, with the identifiers' results.

Types

identifiers()

@type identifiers() :: %{
  spf: %{result: atom(), domain: String.t() | nil} | nil,
  dkim: [map()]
}

The authenticated identifiers: the SPF result of the MAIL FROM identity and every DKIM result, each with result and domain.

Functions

evaluate(author, identifiers, opts \\ [])

@spec evaluate(String.t(), identifiers(), keyword()) :: Karta.Auth.DMARC.Result.t()

Evaluates DMARC for author, a domain name, with the identifiers' results.