dns-sentinel

Sentinel · security scanner

dns-sentinel

Audit your domains' DNS and email security before attackers or spammers find the gaps.

npm i -D @mrlouiswright/dns-sentinel

Published to GitHub Packages: add @mrlouiswright:registry=https://npm.pkg.github.com to .npmrc first (installing needs a token with read:packages).

What it checks

  • SPFspf-missing (high; medium for non-mail domains), spf-multiple (high), spf-too-many-lookups (high; nested includes, a, mx, exists, redirect counted against the 10-lookup limit), spf-void-lookups (medium)…
  • DMARCdmarc-missing (high), dmarc-multiple (high), dmarc-invalid (high), dmarc-policy-none (medium; high for non-mail domains), dmarc-no-rua (low), dmarc-pct (medium, pct < 100), dmarc-weak-subdomain (medium, sp weaker than p)…
  • DKIMSelectors from --dkim-selector, plus ~30 common selectors with --dkim-common. dkim-weak-key (critical for RSA < 1024 bits, medium for < 2048), dkim-revoked (low, empty p=), dkim-testing (low, t=y), dkim-missing (medium)…
  • MXmx-missing (recommends a null MX MX 0 . for domains that don't receive mail), null-mx-misconfigured (high), null-mx-spf (medium), mx-dangling (high), mx-cname (low), mx-ip-literal (medium)
  • MTA-STS / TLS-RPTmta-sts-missing (low), mta-sts-invalid (medium: TXT id, policy fetch over HTTPS, policy syntax), mta-sts-testing (low), mta-sts-mx-mismatch (medium; high in enforce mode), tlsrpt-missing (low), tlsrpt-invalid (low)
  • CAAClosest-ancestor lookup (RFC 8659). caa-missing (low), caa-permissive (low; no issue tags or > 3 CAs), caa-critical-unknown (high), caa-no-iodef (info)
  • DNSSECDS and DNSKEY presence plus the AD flag from a validating DoH resolver. dnssec-disabled (medium), dnssec-no-ds (medium), dnssec-broken (high: SERVFAIL, or DS without validation), dnssec-weak-algorithm (RSASHA1/DSA keys…
  • Dangling CNAMEsFor --subdomain, --subdomains-file or --common-subdomains: follows the CNAME chain and flags dangling-cname (high: target NXDOMAIN; medium: no addresses)…

Quick usage

CLI

npx dns-sentinel example.com
npx dns-sentinel example.com example.org --dkim-selector google,s1 -s www -s docs -s status
npx dns-sentinel example.com --subdomains-file subdomains.txt --fail-on medium -f sarif > dns.sarif
npx dns-sentinel example.com --doh                        # all lookups over DNS-over-HTTPS (Cloudflare)
npx dns-sentinel example.com --resolver 9.9.9.9 --axfr    # pick a resolver; attempt zone transfers
npx dns-sentinel example.com --checks spf,dmarc,dkim --dkim-common

API

import { auditDomains, formatText, MockResolver } from 'dns-sentinel';

const report = await auditDomains(['example.com'], { dkimSelectors: ['google'], subdomains: ['www'], doh: true });
console.log(formatText(report, { failOn: 'high' }));

// Offline / tests: pass any resolver with query(name, type)
const resolver = new MockResolver({ 'example.com': { TXT: ['v=spf1 +all'], MX: [] } });
await auditDomains(['example.com'], { resolver, http: false });

Every option is documented in the dns-sentinel docs.

CI / GitHub Action

on:
  schedule: [{ cron: '0 6 * * 1' }]
permissions:
  contents: read
jobs:
  dns:
    runs-on: ubuntu-latest
    steps:
      - uses: MrLouisWright/dns-sentinel@<sha> # v1
        with:
          domains: example.com example.org
          subdomains: www docs status
          dkim-selectors: google,s1
          fail-on: medium