From owner-freebsd-questions@FreeBSD.ORG Fri Jan 26 16:02:09 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D55AE16A401 for ; Fri, 26 Jan 2007 16:02:09 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from ns1.jnielsen.net (ns1.jnielsen.net [69.55.238.237]) by mx1.freebsd.org (Postfix) with ESMTP id B9B0D13C483 for ; Fri, 26 Jan 2007 16:02:09 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from localhost (jn@ns1 [69.55.238.237]) (authenticated bits=0) by ns1.jnielsen.net (8.12.9p2/8.12.9) with ESMTP id l0QG28cG023280; Fri, 26 Jan 2007 08:02:09 -0800 (PST) (envelope-from lists@jnielsen.net) From: John Nielsen To: freebsd-questions@freebsd.org Date: Fri, 26 Jan 2007 10:58:06 -0500 User-Agent: KMail/1.9.5 References: <1169826632.23091.24.camel@columbus.webtent.org> In-Reply-To: <1169826632.23091.24.camel@columbus.webtent.org> X-Face: #X5#Y*q>F:]zT!DegL3z5Xo'^MN[$8k\[4^3rN~wm=s=Uw(sW}R?3b^*f1Wu*.<=?utf-8?q?of=5F4NrS=0A=09P*M/9CpxDo!D6?=)IY1w<9B1jB; tBQf[RU-R<,I)e"$q7N7 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-6" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200701261058.06542.lists@jnielsen.net> X-Virus-Scanned: ClamAV version 0.88.4, clamav-milter version 0.88.4 on ns1.jnielsen.net X-Virus-Status: Clean Cc: Robert Fitzpatrick Subject: Re: BIND tool for setting up secondary records? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jan 2007 16:02:09 -0000 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