Date: Fri, 26 Jan 2007 10:58:06 -0500 From: John Nielsen <lists@jnielsen.net> To: freebsd-questions@freebsd.org Cc: Robert Fitzpatrick <lists@webtent.net> Subject: Re: BIND tool for setting up secondary records? Message-ID: <200701261058.06542.lists@jnielsen.net> In-Reply-To: <1169826632.23091.24.camel@columbus.webtent.org>
index | next in thread | previous in thread | raw e-mail
On Friday 26 January 2007 10:50, Robert Fitzpatrick wrote:
> I am not a member of a BIND list, so I thought I'd ask here first if
> anyone knows of a script tool that will query a primary name server and
> setup secondary records on another BIND server? Or any other solution
> for doing mass entries of domains to a BIND server to setup secondary
> records with the same primary master?
If you set up a slave domain it will automatically query and stay in sync with
the master nameserver.
I use scripts on both ends for most new domains. Here's the files from the
slave side:
=== begin addconf.sh ===
#!/bin/sh
DATADIR="/etc/namedb/conf"
TEMPLATE="/etc/namedb/templates/default.bind"
usage() {
echo "Usage: $0 \"domain.name\" [templatefile]"
exit 1;
}
if [ "$2" ] ; then
if [ -r $2 ] ; then
TEMPLATE=$2
else
usage
fi
fi
if [ "$1" ] ; then
DOMAIN=$1
else
usage
fi
echo -n "Configuring ${DOMAIN} using ${TEMPLATE}.."
cat ${TEMPLATE} | sed -e "s/%%DOMAIN%%/${DOMAIN}/g" >
${DATADIR}/${DOMAIN}.bind
echo " done."
=== end addconf.sh ===
=== begin default.bind ===
zone "%%DOMAIN%%" {
type slave;
file "slave/%%DOMAIN%%.bak";
masters { my.master.server.ip; };
allow-query { 0.0.0.0/0; };
};
=== end default.bind ===
=== begin make-conf.sh ===
#!/bin/sh
inputfile=/etc/namedb/templates/named.conf.in
outputfile=/etc/namedb/named.conf
backupfile=/etc/namedb/backups/named.conf.old
confdir=/etc/namedb/conf
if [ -r ${outputfile} ] ; then
echo "Backing up current file to ${backupfile}.."
mv -f ${outputfile} ${backupfile}
fi
echo -n "Generating ${outputfile}"..
cp -f ${inputfile} ${outputfile}
for conffile in ${confdir}/*.bind; do
echo "include \"${conffile}\";" >> $outputfile
done
echo " done."
=== end make-conf.sh ===
For named.conf.in you just want your normal named.conf file that doesn't
include any of the domains defined in ${confdir}. Figuring out the rest of it
I leave as an exercise for the reader, but I'm happy to answer specific
questions.
JN
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701261058.06542.lists>
