[Pdns-users] migrating from bind

Craig Sanders cas at taz.net.au
Sun Jun 15 00:39:55 UTC 2003


On Sat, Jun 14, 2003 at 12:08:04PM +0200, bert hubert wrote:
> On Sat, Jun 14, 2003 at 06:28:47PM +1000, Craig Sanders wrote:
> 
> > unfortunately, the XDB back-end is essentially undocumented.  anyone know
> > where i can find some docs for it?  with docs, i can write a zone2tdb tool
> > (possibly based on zone2sql) that takes a bind zonefile as input and
> > creates a tdb output file.
> 
> Currently, the xdb backend has some inherent limitations. One thing it
> doesn't deal with currently is being a slave, you'd need to retrieve zones
> yourself every once in a while.

that's not a problem.  at the moment, i'm using rsync to fetch relays.tgz from
the relays.osirusoft.com primary.  then (using dd, gzcat, head, and sed)
checking whether the serial number in the tar.gz file is different to the
serial in the zone file that bind is using.  if it is, then untar relays.tgz,
move the zone file into the correct directory, and run "ndc reload".


#! /bin/bash

cd /var/cache/bind/osirusoft/tmp

rsync -q --partial rsync://rsync.osirusoft.com/www/relays.tgz relays.tgz

SERIAL=$(head -100 ../relays.osirusoft.com | \
         grep "200[3-9][01][0-9]" | \
         sed -e 's/.*\(200[3-9][01][0-9][0-3][0-9][0-9][0-9]\).*/\1/' | \
         head -1)

NEWSERIAL=$(dd if=relays.tgz count=100 2>/dev/null  | \
            zcat 2>/dev/null | \
            grep -a "200[3-9][01][0-9]" | \
            sed -e 's/.*\(200[3-9][01][0-9][0-3][0-9][0-9][0-9]\).*/\1/' | \
            head -1)

if [ "$SERIAL" != "$NEWSERIAL" ] ; then
  tar xfz relays.tgz
  mv -f ./relays.osirusoft.com ..
  /usr/sbin/ndc reload relays.osirusoft.com
fi



my plan is to change the last part of that script so that it untars the file,
converts it to a TDB file, moves it into place and, if necessary, tell pdns to
reload the zone.

> Can you show me a bit of the zone you are dealing with?

if you really want a sample, i can send it to you but it looks like any other
zone file (but with lots of lowercase "in a" and "in txt").

> > PS: has anyone else noticed that the bind and bind2 back-ends are case
> > sensitive?  "IN A" records work, but "IN a" or "in a" don't.  i guess that
> > it's case sensitive for other record types too but didn't bother testing, i
> > just cleaned up my zone file by writing a tiny sed script that uppercased
> > all record types.
> 
> I think I did this to get some other zones working that had 'in' as a
> hostname or so.

huh?  that shouldn't be necessary.  you can tell whether the string 'in' is
supposed to be a hostname by it's position within the line you're parsing, or
by whether the rest of the line makes sense.

even better would be to simply not allow ambiguity if someone wants to define a
hostname called "in".

how does bind handle a zone that has something like this:

; define mx record for foo.example.com. 
foo	IN	MX 10 mail.example.com.
;
; define A record for in.example.com.
in	A	192.168.1.1

where the "in" is supposed to be a hostname, because IIRC specifying the "IN"
class is optional.


IIRC, it treats it as if you've defined an A record for "foo", which is a
reasonable interpretation, IMO - if someone wants to do something weird and
unneccessary like that, it should be their responsibility to be unambiguous
about what they mean and write it as:

in	IN	A	192.168.1.1

(in upper or lower case as they choose, of course).


craig



More information about the Pdns-users mailing list