Script for verifying zone files

Atkins, Brian (GD/VA-NSOC) Brian.Atkins2 at va.gov
Thu Jul 22 17:01:52 UTC 2010


Thanks, Bill. That's more what I'm looking for.

Several people suggested looking at named-checkzone, but my goal is to compare an edited version of the zone file against the active zone file. The named-checkzone program, to my understanding, merely checks for syntax and doesn't do anything with actual verification of the records.

Brian 


-----Original Message-----
From: wllarso [mailto:wllarso at swcp.com] 
Sent: Thursday, July 22, 2010 12:45 PM
To: Atkins, Brian (GD/VA-NSOC)
Cc: bind-users at lists.isc.org
Subject: Re: Script for verifying zone files

On Thu, 22 Jul 2010 11:44:55 -0400, "Atkins, Brian (GD/VA-NSOC)"
<Brian.Atkins2 at va.gov> wrote:
> Does anyone know of an existing script or program that can parse a zone
> file and verify records against an active server?
> 

Oh, a challenge.  Thanks

> I'm attempting to clean up some large zone files and want to ensure that
> none of the changes will break DNS when I implement it. Later, I'd like
> to use it to verify that the records point to active hosts, but that's
> later.
> 
> I started putting together a bash script, but I'm having issues where a
> record exists on multiple lines. For example:

Since, in a zone file, any line that begins with white space (tab or space
character) will use the same left hand side name as the previous line.  So,
using AWK, you could do something like:

    awk 'BEGIN{LHS=""}/^[WS]/{print LHS,$0;next}{print $0;LHS=$1}'

(Guaranteed NOT to work without lots of tweeks and testing.  Use at your
own risk!)

Now, as to checking that "the records point to active hosts", well, I
won't even try for that.  What do you mean by "active"?

But, as someone else said, look at "named-checkzone".

Bill


More information about the bind-users mailing list