<div dir="ltr"><div class="gmail_extra"><div><div class="gmail_signature" data-smartmail="gmail_signature"><br></div></div><div class="gmail_quote">On Tue, Jan 10, 2017 at 6:52 AM, Mark Andrews <span dir="ltr"><<a href="mailto:marka@isc.org" target="_blank">marka@isc.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Use named-checkconf to get the list of master and slave zones from<br>
named.conf then transfer them all and extract the CNAME ownername<br>
that matches.<br>
<br>
named-checkconf -p |<br>
awk '$1 == "zone" { zone = $2; next; }<br>
$1 == "type" && ( $2 == "slave;" || $2 == "master;" ) { print zone }' |<br>
sed -e 's/^"//' -e 's/"$//' |<br>
dig axfr -f - |<br>
awk -v VSERVER=${VSERVER} '$4 == "CNAME" && $5 == VSERVER { print $1 }'<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Mark Andrews, ISC<br></font></span><div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div>I think this is a very interesting solution because:</div><div>- named-checkconf and dig format in a standard way, so it is easy to parse</div><div>- since DNS holds the data in ram, this avoids reading the files from disk, so it could be much faster (unless the pipes | write to disk)</div><div><br></div><div>-- </div><div>Bob Harold</div><div><br></div></div><br></div></div>