How to get the CNAME for a domain?

Bob Harold rharolde at umich.edu
Thu Jan 12 16:34:23 UTC 2017


On Tue, Jan 10, 2017 at 6:52 AM, Mark Andrews <marka at isc.org> wrote:

>
> Use named-checkconf to get the list of master and slave zones from
> named.conf then transfer them all and extract the CNAME ownername
> that matches.
>
> named-checkconf -p |
> awk '$1 == "zone" { zone = $2; next; }
> $1 == "type" && ( $2 == "slave;" || $2 == "master;" ) { print zone }' |
> sed -e 's/^"//' -e 's/"$//' |
> dig axfr -f - |
> awk -v VSERVER=${VSERVER} '$4 == "CNAME" && $5 == VSERVER { print $1 }'
>
> --
> Mark Andrews, ISC
>
> I think this is a very interesting solution because:
- named-checkconf and dig format in a standard way, so it is easy to parse
- 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)

-- 
Bob Harold
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20170112/1e2e9946/attachment-0001.html>


More information about the bind-users mailing list