2

A bit of background - I am building a tool which apart from doing a number of things also allows the user to manage Azure DNS. In my application there's a feature where a user could export the DNS settings to create a zone file. Using various resources on the Internet (e.g. https://en.wikipedia.org/wiki/Zone_file#File_format and https://www.rfc-editor.org/rfc/rfc1035), I am able to create a zone file.

What I am struggling with is how can I validate if the zone file I created is proper or not based on RFC 1035. Is there a programmatic way of validating a zone file? Or may be some PowerShell script or a system/3rd party tool that I can use to validate the file.

As a side note, I used GoDaddy's web interface to import the zone file and it worked just fine.

1 Answers1

1

I'm going to borrow a very applicable passage from NSD's documentation:

https://www.nlnetlabs.nl/projects/nsd/documentation.html

Grammar for DNS (RFC 1035) zone files

Up front: it is impossible to write a clean lexer/grammer for DNS zone files. At first it looks like it is easy to make such a beast, but when you start implementing it the details make it messy.

If the author of an authoritative nameserver feels this way, then trying to implement it on your own for anything less than a commercial product is probably a fool's errand. If this is something you're building for your own company's usage, I'd suggest using one of the zone validation tools provided alongside popular nameserver software. An example would be BIND's named-checkzone, but I'm not going to get into a feature bake-off between these tools as product recommendation questions are off topic. You will need to do your own research here.

Andrew B
  • 31,858
  • 12
  • 90
  • 128