Projects / 2024

zonecheck

A small DNS zone linter for the mistakes that only hurt during an incident.

stable PythondnspythonCLI

zonecheck is a command-line linter for small DNS zones. It does not try to validate every RFC. It checks the handful of things that are easy to get wrong and expensive to discover at the wrong moment: missing NS glue, inconsistent MX targets, broken SPF, missing CAA, and TTLs that contradict the stated change policy.

Why

Most zone files are fine until they are not. A missing trailing dot turns a hostname into a relative name. An MX points at a host that does not resolve. A CAA record blocks the certificate authority you actually use. None of these are visible in a normal dig of the website.

A linter is cheaper than an incident review.

What it checks

  • NS records resolve, and the delegation is consistent;
  • MX targets resolve to A or AAAA records;
  • SPF and DMARC records parse and do not exceed the lookup limit;
  • CAA records include the CA you use;
  • TTLs are within the configured policy;
  • the zone has a sensible negative-caching TTL.
zonecheck example.com
zonecheck --zone-file db.example.com --origin example.com

Output is plain text by default, with a --json flag for CI. Exit code is non-zero when a check fails, so it can run in a pre-deploy hook.

Status

Stable and deliberately small. It is not a replacement for a full DNS test suite, and it does not attempt to be authoritative. It is the checklist I want before a zone change, automated.

Notes

The tool reads from the live DNS by default, which means it sees the same answers your users see. Use --zone-file when you want to check a change before it is published. Both modes share the same checks, so the result should be identical unless the zone is already out of sync.