GitHub - sanjay/dns-validator

2 min read Original article ↗

DNS Validator

A Ruby tool that compares DNS records in a BIND format file with actual DNS lookups to ensure your DNS records are correctly configured and propagated.

Features

  • Supports A, CNAME, MX, TXT, SRV, and NS record types
  • Parallel DNS lookups for faster processing
  • Case-sensitive or case-insensitive matching options
  • Strict or loose TXT record validation
  • DNS cache control (fresh lookups or use system cache)
  • Detailed diagnostic information for resolving DNS issues

Installation

Simply clone the repository and ensure you have Ruby installed:

git clone https://github.com/sanjay/dns-validator.git
cd dns-validator
chmod +x dns-validator.rb

Usage

Basic usage:

./dns-validator.rb -f your_bind_file.txt

Command Line Options

  • -f, --file FILE: BIND zone file to check
  • -v, --verbose: Show detailed output
  • -d, --domain DOMAIN: Override the domain name
  • -c, --case-sensitive: Enable case-sensitive matching for DNS names
  • --use-cache: Use local DNS cache (default is to bypass cache)
  • --loose-txt: Allow extra TXT records in DNS not present in BIND file
  • -h, --help: Show help message
  • -V, --version: Show version information

Examples

Check DNS records with verbose output:

./dns-validator.rb -f your_bind_file.txt -v

Allow extra TXT records in DNS:

./dns-validator.rb -f your_bind_file.txt --loose-txt

Requirements

  • Ruby 2.5 or higher
  • Standard Ruby libraries: resolv, optparse, thread, timeout

License

GNU GPLv3 License - see LICENSE file for details