Dev.to Security 🔐 Cybersecurity 👁 0 📖 2 min read

Audit SPF, DMARC and SSL for a list of domains in one run

Disclosure: I build the Domain Health Audit actor mentioned below. The checks themselves are plain DNS and HTTPS, and you can do them with any tool. If you manage many domains (an agency, an IT shop, a cold-email team),

Disclosure: I build the Domain Health Audit actor mentioned below. The checks themselves are plain DNS and HTTPS, and you can do them with any tool.

If you manage many domains (an agency, an IT shop, a cold-email team), the same few problems repeat: a second SPF record, a DMARC policy stuck on p=none, a certificate about to expire, missing security headers.

What to check, and what the results mean

  • SPF: exactly one v=spf1 record. Two records is a permanent error. Check it ends in ~all or -all, and count DNS lookups (the limit is 10, includes and redirects count).
  • DMARC: a record at _dmarc.<domain>. p=none only monitors. quarantine or reject enforces. Subdomains inherit the parent's policy unless they set their own, so do not flag a subdomain as missing DMARC when the parent has it.
  • DKIM: be careful. The selector name is private, so you cannot prove DKIM is missing from outside. A good tool says "not detected for common selectors", not "missing".
  • MX: present, and pointing to the provider you expect.
  • SSL: days until expiry, invalid or self-signed certificates.
  • Security headers: HSTS, CSP, X-Frame-Options, nosniff, Referrer-Policy, and a security.txt file.

Do it from the command line

dig +short TXT example.com | grep spf1
dig +short TXT _dmarc.example.com
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -enddate

Fine for one domain. For fifty it gets tedious.

Doing a list

Domain Health Audit takes a list of domains and returns, for each, a 0-100 score, an A-F grade and a fix list sorted by impact, as JSON, CSV or a readable report. I cross-checked it against dig on 52 domains and found no DMARC mismatches, and DKIM never changes the score because it cannot be verified from outside. Price is $0.002 per domain, and the Apify free credit covers a trial.

For ongoing watching, Domain Change Monitor re-checks DNS, certificates and expiry on a schedule and flags what changed since the last run.

Run the audit before a client onboarding and again each quarter. Most findings are quick fixes.

If you would rather have it done for you: I offer a $15 audit report for up to 10 domains (48h): Domain Email-Security and Expiry Audit Report. There is also a fix plan with copy-paste records. I make both (LightData Tools).

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.