Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Validation of the data fields of a DNS zone file

by dwm042 (Priest)
on Sep 20, 2010 at 14:32 UTC ( #860850=perlquestion: print w/replies, xml ) Need Help??
dwm042 has asked for the wisdom of the Perl Monks concerning the following question:

Are there any Perl resources for ways (regular expressions appreciated) for the validation of the various fields of a DNS zone file? In particular I'm interested in validation of the SOA header, but validation resources for the common RR entries would be much appreciated as well.

Things like the end of a CNAME record almost resemble a standard address, except for that period at the end of the name. Therefore, many common canned patterns are unavailable. Another example is the MNAME, which isn't quite a standard email address, and also should be terminated with a period (usually!)


Update: Found Regexp::Common::dns, though it isn't a supported component of the Regexp::Common tree.

  • Comment on Validation of the data fields of a DNS zone file

Replies are listed 'Best First'.
Re: Validation of the data fields of a DNS zone file
by gman (Friar) on Sep 20, 2010 at 15:03 UTC

      Problem with Net::DNS is that it is looking over the Internet at a functioning DNS server. I'm looking at tools to parse the raw BIND zone files and look for errors that would prevent a server from starting.

      Further, certain entries are perfectly allowed on a working server, but can indicate an oversight. A record like this:

      @ IN MX 10

      This is a MX record pointing to Perfectly legit to an external source, but not really pointing where the author wanted. That's the kind of thing I'd like to generate a warning on, on the admin side of things.

      I suspect what I'm asking for is a very large library of REs that might have something useful in terms of DNS.


Re: Validation of the data fields of a DNS zone file
by Krellis (Initiate) on Sep 21, 2010 at 23:06 UTC

    Have you checked out named-checkzone, as distributed with BIND? It's not a Perl solution, I know, but it and its output could be included in a Perl solution, and might be better than re-inventing the wheel. Google will turn up plenty of examples of the manpage if you don't have an installed copy handy.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://860850]
Approved by moritz
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2018-05-20 16:43 GMT
Find Nodes?
    Voting Booth?