[net-dns-users] Parsing MS DNS zone files

Chris Buxton clists at buxtonfamily.us
Wed Oct 29 21:52:13 UTC 2014


Thanks for the replies. Normally, I would indeed use zone transfers to pull data in a standard format. However, for my current task, this is not an option.

I ended up solving the aging values problem using shell commands to strip this easily-identifiable data from the source files. I then (temporarily) solved the WINS problem by hacking Net::DNS::ZoneFile::_getRR to skip WINS records.

        $line = $self->_getline if $line =~ /\sWINS\s/;

Perhaps in the future I will add a Net::DNS::RR::WINS package to better account for this, but I don't have time for that right at the moment.

Thanks,
Chris

> On Oct 27, 2014, at 4:52 AM, tlhackque <tlhackque at yahoo.com> wrote:
> 
> On 27-Oct-14 00:02, Chris Buxton wrote:
>> Hi,
>> 
>> I'm trying to parse MS DNS zone files using Net::DNS::Zonefile, but it's having issues with two non-standard Microsoft additions to the format:
>> 
>> 1. Age values. For example:
>> 
>> _kerberos._tcp.direktion._sites.dc._msdcs [AGE:3627351] 600     SRV     0 100 88        atzt0009.at.zurich.com <http://atzt0009.at.zurich.com/>.
>> 
>> 2. WINS records. For example:
>> 
>> @                       0       WINS    L2 C900 (
>>                                         192.168.47.221
>>                                         192.168.47.222 )
>> 
>> I don't actually need these data points. I just need to have Net::DNS::ZoneFile::read not fail (return null) when encountering them. I have a lot of this data, such that it would be painful to rely on manual remediation. Does anyone have any ideas?
>> 
>> Thanks,
>> Chris Buxton
> 
> I'm not an MS DNS admin expert - perhaps there's an 'export a standard zonefile' utility somewhere.  A quick search didn't turn one up, but I may have missed it.
> 
> One approach is to use axfr() instead of reading the file.  You can tell the MS server not to transfer these records - there's a 'do not repicate this record' checkbox somewhere.  See     http://technet.microsoft.com/en-us/library/cc784258(v=ws.10).aspx <http://technet.microsoft.com/en-us/library/cc784258(v=ws.10).aspx>.
> 
> Or you can use Dick's approach and trap the exception - though I'd match for these cases on the error string in case you trip on another error from time to time.
> 
> I'd use axfr() if possible - that's the standard API to DNS.  M$ extensions are always a moving target.  At least you can beat them up if that's broken.
> 
> If axfr() isn't allowed from the hosting server, or if these files aren't served by one: I might even go as far as running a private M$ server with read-only access to these zone files, on a non-standard port rather than forcibly read the files...
> 
> I really, really don't like chasing M$... 
> 
> If at some point you need the WINS/WINS-R records, it wouldn't be hard to write a Net::DNS class for them.  You might suggest an API for registering a private class so that you don't have to patch the dispatch hash.  Then you could submit it to CPAN - assuming the Net::DNS folks don't take it.
> 
> Hmm, looks like a 5cent response to a 1cent question.  Oh, well.
> 
> Good luck.
> 
> -- 
> This communication may not represent my employer's views,
> if any, on the matters discussed. 
> _______________________________________________
> net-dns-users mailing list
> net-dns-users at nlnetlabs.nl
> https://www.nlnetlabs.nl/mailman/listinfo/net-dns-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nlnetlabs.nl/pipermail/net-dns-users/attachments/20141029/99239dac/attachment.htm>


More information about the net-dns-users mailing list