How to get the CNAME for a domain?

Mark Andrews marka at isc.org
Tue Jan 10 11:52:05 UTC 2017


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
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: marka at isc.org


More information about the bind-users mailing list