<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Thank you Timothe for this. I tested this on some of my domains
and found AXFR worked the best....</p>
<p>dig @::1 $zone axfr | grep -v '^;' | grep -v '^$zone' | grep
'NS ' | cut -f1 | cut -f1 -d' ' | sed 's/\.$//' |sort -u
> axfr.$zone</p>
<p>... does the trick. $zone is the Zone in question. There is a
<tab> after "NS".</p>
<p>Take a Zone, Strip comments, Strip lines beginning with the Zone,
Look for NS records (exclude NSEC records), take the first
argument (strip trailing dot) and make the output sorted and
unique...<br>
</p>
<p>I'll be writing in PHP and already use a similar PHP "NET::DNS"
type library.... so shouldn't be difficult.</p>
<p>Yes - this will go into a Database - etc.. <br>
</p>
<div class="moz-cite-prefix">On 2023/08/22 02:10, Timothe Litt
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:eb999d0b-7ef2-e141-acb1-b9f30ffd93fc@acm.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<p>(Sorry for the duplicate/reply without context). See below.<br>
</p>
<div class="moz-cite-prefix">On 21-Aug-23 11:11, Mark Elkins
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:0d8c3a05-a45a-0e03-b11f-9d4f32ad618a@posix.co.za">
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<p>Hi,</p>
<p>I'm writing some software to be able to read information from
a Zone file. I am a legally authorised Secondary Authoritative
Nameserver for a number of domains or rather zone files, eg.
EDU.ZA (and others). Is there an easy way to:-</p>
<p>1) Count how many delegated domains there are (Names with NS
records)</p>
<p>2) Extract the above Names - so I can look for changes
(Added/Deleted names)<br>
</p>
<p>3) find out how many unique names have DS records (I can DIG
I suppose)<br>
</p>
<p>I'd also like to spot broken stuff (named-checkzone ?)<br>
</p>
<p>So the zones (such as EDU.ZA) contain the domain name of the
entity (whois.edu.za) along with the Nameserver records and in
this case, a DS record. e.g... "whois.edu.za" looks like....</p>
<p>whois NS
control.vweb.co.za.<br>
NS
secdns1.posix.co.za.<br>
NS
secdns2.posix.co.za.<br>
NS
secdns3.posix.co.za.<br>
DS 27300 13 2
8ED21DB407F6AC3E6EA757AE566953C1BBADD8B652BE4C7C0744B1D7
9DF42894<br>
DS 17837 13 2
36FD5B19450B672988AE507FB7D2F948ED1E889546C6E16554C7EAF9
CE9C3FEA<br>
</p>
<p>One hindrance is that journal files are present - so it is
not just the zone file but the zone.jnl file as well.</p>
<p>Some African ccTLDs have everything in one zone e.g. their
COM, EDU, GOV - etc. In South Africa, these are all separate
zones, making life somewhat easier.<br>
</p>
<p>I'd hate to re-invent software that already exists.</p>
<p>The primary purpose is to pull in data into an (ICANN
requested) African DNS Observatory.<br>
</p>
<p><br>
</p>
<div class="moz-signature">-- <br>
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<title></title>
<p>Mark James ELKINS - Posix Systems - (South) Africa<br>
<a class="moz-txt-link-abbreviated moz-txt-link-freetext"
href="mailto:mje@posix.co.za" moz-do-not-send="true">mje@posix.co.za</a>
Tel: <a href="tel:+27826010496" moz-do-not-send="true">+27.826010496</a><br>
For fast, reliable, low cost Internet in ZA: <a
href="https://ftth.posix.co.za" moz-do-not-send="true"
class="moz-txt-link-freetext">https://ftth.posix.co.za</a><br>
</p>
</div>
</blockquote>
<p>Mark,<br>
</p>
<p>a) Use named-compilezone to extract the zone with journals
applied.</p>
<p>b) my favorite: do an axfr of the zone, which gives the correct
data with all the pseudo-ops expanded</p>
<p>c) Use a library - I use Perl's Net::DNS - and write code to do
the axfr & walk the zone - it allows you to access fields in
the records.</p>
<p><a href="https://github.com/tlhackque/certtools"
class="moz-txt-link-freetext" moz-do-not-send="true">https://github.com/tlhackque/certtools</a>
has a simple utility called acme_token_check that does (c) to
remove stray ACME records - it shows how to do the transfer and
walk the zone. (And also how to use DNS UPDATE to maintain
it.)</p>
<p> Enjoy.</p>
<p><br>
</p>
<pre class="moz-signature" cols="72">Timothe Litt
ACM Distinguished Engineer
--------------------------
This communication may not represent the ACM or my employer's views,
if any, on the matters discussed.
</pre>
</blockquote>
<div class="moz-signature">-- <br>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title></title>
<p>Mark James ELKINS - Posix Systems - (South) Africa<br>
<a class="moz-txt-link-abbreviated" href="mailto:mje@posix.co.za">mje@posix.co.za</a> Tel: <a href="tel:+27826010496">+27.826010496</a><br>
For fast, reliable, low cost Internet in ZA: <a
href="https://ftth.posix.co.za">https://ftth.posix.co.za</a><br>
<br>
<br>
</p>
</div>
</body>
</html>