Check your DNS records for a variety of potential issues.
- CAA: Checks that extant CAA records are valid. If specified by policy, requires
issueandiodeffields to be present. - CNAME: Checks that CNAME records point to names that have resolvable A records.
- Mail: Checks that MX records point to names that have resolvable A records. Partially validates DMARC records, if present. If specified by policy, requires domains with MX records to have SPF and DMARC records.
- rDNS: Checks that reverse DNS for the IPs that A/AAAA records point to resolve to the same domain.
Create a new API token in the DigitalOcean control panel: https://cloud.digitalocean.com/account/api/tokens
Note that a read-only token is sufficient.
Create a new API key and secret here: https://porkbun.com/account/api
Note that you must enable API access for each domain individually. See Porkbun's API docs.
Create a new API token in Name.com Account Settings: https://www.name.com/account/settings/api
Credentials for supported DNS hosts are accepted via environment variables, listed below. dns-auditor will attempt to read these from the .env file in the working directory, if it exists. See .env.sample for an example.
DIGITALOCEAN_TOKEN: your DigitalOcean API token
PORKBUN_API_KEY: your Porkbun API keyPORKBUN_SECRET_KEY: your Porkbun API secret key
NAMECOM_USERNAME: your Name.com usernameNAMECOM_API_TOKEN: your Name.com API token
Certain checks can be customized with a policy file. See policy.ini.sample for an example. Pass this file to dns-auditor with the --policy option.
RequireIssue: Iftrue, requires that the domain has a CAA record with anissueorissuewildfield.RequireIodef: Iftrue, requires that the domain has a CAA record with aniodeffield.IodefAllowlist: Comma-separated list of allowediodefaddresses (email addresses or URLs). If specified, CAAiodefrecords must contain values from this allowlist. Leave empty or omit to allow any validiodefaddress.
RequireSPF: Iftrue, requires that any domain that has MX records also has an SPF record.RequireDMARC: Iftrue, requires that any domain that has MX records also has a DMARC record.
FailOnMissingPTR: Iftrue, a missing PTR record will cause the check to fail.
--domain: Domain to audit. If not given, all domains in the account will be audited. Optional.--host: Hosting service for your DNS records. One of:do(DigitalOcean),pb(Porkbun),nc(Name.com).--policy: Path to a .ini policy file. Optional.--verbose: Print each check that is run regardless of its result. Optional.
Clone the repository and run make dev/bootstrap, which will create a virtualenv for you:
git clone https://github.com/cdzombak/dns-auditor.git
cd dns-auditor
make dev/bootstrap
Then, activate the virtualenv and run main.py:
. venv/bin/activate
./main.py --host pb --domain dzombak.com
Alternatively, run main.py via the venv's Python interpreter directly:
./venv/bin/python ./main.py --host pb --domain dzombak.com
Pre-built Docker images are available on Docker Hub. To run it:
docker run --rm -e PORKBUN_API_KEY='pk1_aaaa0000' -e PORKBUN_SECRET_KEY='sk1_0000aaaa' cdzombak/dns-auditor --host pb --domain dzombak.com
Remember that:
- You will need to provide environment variables to the container for your DNS host credentials
- Any policy file you want to use must be mounted into the container
GPL 3.0; see LICENSE in this repository.
Chris Dzombak (dzombak.com; GitHub @cdzombak)