[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bind9 ns1 and ns2 not authoritative


Friday, August 22, 2008, 20:24:27, randall wrote:

> after my NoOb discovery that all slave entries have to be added manually
> on ns2 i found very little ready made scripts  available on google for
> automation and those i found where pretty messy or not usable on debian,
> or i'm looking in the wrong places.

I don't know smbind, but when you write that it just produces bind
config files from db, my script should be usable. I run it
periodically from cron on slave (and manually from master when adding
zone: ssh slave transfer-bind-zones.sh). You must have zones config in
separate file (for example named.conf.domains). It transfers it and
modifies the records from typu master to type slave.

The entries should be like this:
zone "abc.com" IN {type master; file "abc.com"; };
and script changes that into:
zone "abc.com" { type slave; file "abc.com"; masters {; }; };

(the second "sed" in script is probably only for reverse domains which have
different filename structure, but don't remember it well.)

kenny:~:# cat /usr/local/sbin/transfer-bind-zones.sh

scp master_server:/etc/bind/named.conf.domains /etc/bind/$tmpf
if [ \! -f /etc/bind/$tmpf ]; then
  echo "was not able to get new domains list" | mail -s "bind reload FAILED" root
  exit 1
cp /etc/bind/named.conf.domains /etc/bind/named.conf.domains.prev
sed 's/^zone \("[^"]*"\) .*$/zone \1 { type slave; file \1; masters {; }; };/g' /etc/bind/$tmpf |
sed 's/; file \([^/]*\)\/\([^"]*\)"; /; file \1_\2"; /g' >/etc/bind/named.conf.domains
rm -f /etc/bind/$tmpf
diff /etc/bind/named.conf.domains /etc/bind/named.conf.domains.prev >/dev/null
if [ $? -ne 0 ]; then # files differ, reload bind
  /etc/init.d/bind9 reload
  echo "secondary zone changed, bind reloaded" | mail -s "bind reloaded" root

  bYE, Marki

Reply to: