[Pdns-users] Re: Verify PowerDNS answers?

Augie Schwer augie.schwer at gmail.com
Thu Nov 9 21:28:55 UTC 2006


On 10/5/06, Augie Schwer <augie.schwer at gmail.com> wrote:
> I could obviously write something up that takes a set of queries and
> correct answers and then queries PowerDNS to verify its answers, but
> if there was already something written that would run through a set of
> tests quickly and effectively it would be great; any suggestions
> welcome.

I know it's an old thread, but in case it helps anyone else out here's
what I ended up using:

#!/usr/bin/perl
# dnsreplay.pl - replay a BIND query log and print to STDOUT
# when a query fails against the given name server.
# $Id: dnsreplay.pl 852 2006-11-09 21:26:01Z augie $

use strict;
use Net::DNS;

if ( @ARGV < 2 ) { print "Usage: dnsreplay.pl NAMESERVER QUERYLOG\n"; exit;}

my $nameserver  = $ARGV[0];
my $querylog    = $ARGV[1];
my $res   = Net::DNS::Resolver->new(
                'nameservers'   => [$nameserver],
                'recurse'       => 0,
                'debug'         => 0
);

open(FILE,"<$querylog") or die("Could not open $querylog: $!");
while(<FILE>)
{
        my ($zone,$type) = (split)[3,5];
        next if ( $type eq 'A6' ) ; # Net::DNS does not understand A6 records.
        my $packet = $res->send($zone,$type);
        unless ( $packet->answer )
        { print "$nameserver did not answer for $zone of type $type .\n"; }
}
close(FILE);



-- 
Augie Schwer    -    Augie at Schwer.us    -    http://schwer.us
Key fingerprint = 9815 AE19 AFD1 1FE7 5DEE 2AC3 CB99 2784 27B0 C072


More information about the Pdns-users mailing list