Skip to content

About

Explainable SPF, DKIM, and RFC 9989 DMARC auditing and policy simulation.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

MailVerity — Email authentication, made legible.

English · Türkçe

CI MIT License

MailVerity is an explainable email-authentication posture auditor and policy laboratory. It inspects SPF, DKIM, and the current RFC 9989 DMARC record format, then turns DNS text into prioritized findings and concrete remediation guidance. Its simulator never generates or sends email.

Posture scoring helps prioritize review. It is not a guarantee of inbox placement or proof that a domain cannot be spoofed.

Highlights

  • audits SPF records and recursively estimates DNS-querying terms against RFC 7208's limit;
  • catches +all, neutral/softfail policy, deprecated ptr, invalid networks, duplicate records, unknown mechanisms, and thin lookup headroom;
  • understands RFC 9989 DMARC tags including np, psd, and t;
  • identifies legacy pct, rf, and ri tags removed from the current DMARC format;
  • inspects explicitly supplied DKIM selectors for malformed, revoked, short, or testing keys;
  • provides a safe DMARC alignment and disposition simulator;
  • supports deterministic offline DNS fixtures for education, CI, and incident reports;
  • produces human-readable or stable JSON output with useful exit codes.

Install

python -m pip install "git+https://github.com/gorkemguler/MailVerity.git"

For local development:

git clone https://github.com/gorkemguler/MailVerity.git
cd MailVerity
python -m pip install -e '.[dev]'

Python 3.10+ is required.

Audit a domain

mailverity audit example.com

DKIM selectors cannot be safely enumerated. Read the s= value from a recent, trusted DKIM-Signature header and supply it explicitly:

mailverity audit example.com --selector selector1 --selector google

--common-selectors checks a small convenience list, but a missing guessed selector is not treated as a vulnerability.

JSON output and a CI threshold:

mailverity audit example.com --selector selector1 --json --fail-on medium > posture.json

Simulate a policy safely

This command models alignment and policy handling. It performs no DNS request and sends no mail:

mailverity simulate news.example.com \
  --organizational-domain example.com \
  --spf-result pass \
  --spf-domain bounce.example.com \
  --dkim-result fail \
  --policy reject

Use --aspf s or --adkim s for strict alignment and --test-mode to model RFC 9989 t=y.

Offline DNS fixture

Audits can be reproduced without network access:

{
  "example.com": "v=spf1 ip4:192.0.2.0/24 -all",
  "_dmarc.example.com": "v=DMARC1; p=reject; rua=mailto:dmarc@example.com",
  "s1._domainkey.example.com": "v=DKIM1; k=rsa; p=BASE64_PUBLIC_KEY"
}
mailverity audit example.com --offline dns.json --selector s1

Exit codes

Code Meaning
0 Audit completed and no finding reached --fail-on, or simulation completed
1 Audit completed and a finding reached the selected threshold
2 Invalid input, fixture problem, or DNS operational error

Standards notes

MailVerity audits a direct _dmarc.<domain> record. RFC 9989 DNS Tree Walk policy discovery depends on message context and is intentionally not presented as a full receiver implementation. The simulator asks for the organizational domain explicitly when relaxed alignment crosses subdomains, avoiding outdated public-suffix assumptions.

Development

pytest --cov=mailverity --cov-report=term-missing
ruff check .

Primary references

License

MIT © Görkem Güler

About

Explainable SPF, DKIM, and RFC 9989 DMARC auditing and policy simulation.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages