Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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!)

David.

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
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 mail.example.com

      This is a MX record pointing to mail.example.com.example.com. 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.

      David.

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://860850]
Approved by moritz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2014-09-02 19:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (29 votes), past polls