How to get the CNAME for a domain?

Michelle Konzack linux4michelle at gmail.com
Tue Jan 10 10:40:05 UTC 2017


Hello experts,

I do not want to querry the world, but only my own Name Server for CNAME
configured (or not).

Currently I am updating my web administration interface and I have  lost
over the time a script, which queried my Name Server for CNAMES.

E.g. if I have a physical server <vserver04.tamay-dogan.net> I  like  to
know, which CNAMEs (on MY Name Server) pointing to it as

www.electronica.tamay-dogan.net    IN CNAME    vserver04.tamay-dogan.net

OK, I can grep the whole /etc/bind/master/ directory, but since my  Name
Server is responsable for several 1000 (sub)domains,  the  execution  of
the script takes ages!

----[tdgetincname]------------------------------------------------------
#!/bin/bash

VSERVER="$1"

LIST=`cd /etc/bind/master/ && find -type f |grep -v -E "(.conf|.signed|.private|.key)$" |sed 's|^\./||' |sort`

for FILE in ${LIST}
do
  RET=`cd /etc/bind/master/ && grep -E "IN CNAME.*${VSERVER}" ${FILE} |sed "s|\.[ \t]*IN CNAME.*||"`

  if [ -n "${RET}" ]
  then
    echo "${RET}"
  fi
done
------------------------------------------------------------------------

Note: If I do not the "cd /etc/bind/master/ &&",
      I exceed the maximum lenght of the commandline.

Any ideas how to do this better?

Thanks in avance

-- 
Michelle Konzack        ITSystems
GNU/Linux Developer     0033-6-61925193
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20170110/54136ff0/attachment.bin>


More information about the bind-users mailing list