Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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

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 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?
[ambrus]: Today I accidentally cut my hand while carrying a computer. On the display part of the motherboard that sticks out at the back of the chasis and has ports, there's this thin metal sheet with holes cut for the ports, to guide plugs into the sockets.
[ambrus]: This sheet has sharp needle-like parts, 0.004 long and less than 0.001 wide, that can get bent to point outwards, and one of these cut into my palm when I lifted the box.
[ambrus]: So now when I choose what motherboard to buy for my new home computer, I have one more specific property to guide me. Useful, because there's so many different boards to choose from.

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2017-01-16 19:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (151 votes). Check out past polls.