2

I have a webapp that acts as a DNS manager, writing all zones to "/var/named". I would like to be able to configure named to load all zones in that folder, without explicitely having to tell it which zone goes to which file.

Is that remotely possible?

The reason for this is that i will be having a lot of zones added/deleted and a lot of records for each of them. I was thinking for using a database for that, but the idea of doing 500 record inserts scares me (it needs to be snappy). It's easier to write to a file.

Any suggestions?

3 Answers 3

1

As the problem is stated, this is not possible with bind9. However, the problem really is to do with how you can make significant changes to which zones you are serving for, without a performance hit.

Possible suggestions are:

  • dynamically loadable zones with bind9

  • bind10 (but this is not mature, you probably don't want to rely on it for critical production environments)

  • another dns server, such as powerdns. If you're using the default recommended schema for a SQL backend to powerdns, it will serve all of the zones in the domains table, so if you can have your "dns manager" update that table then you're in business. At the very least, an immediatge, kludgy workaround would be to have powerdns's zone2sql tool take the zone files that your dns manager app creates and insert them into the db.

1
  • I heard good things about powerdns, but i can't seem to find anywhere how can i include an entire directory of zones. Can you point me in the right direction?
    – alexcepoi
    Feb 7, 2011 at 16:42
2

I don't believe it's possible. BIND likes to have each zone separately configured with its own zone block containing the name of the zone file and the domain name therein.

2

As others have said, this is not directly possible.

But, you can still automate it!

Setup a script (makefile, bash, what-have-you) that generates a proper bind9 config file containing all the zone blocks:

AUTOZONEFILE=/var/lib/named/etc/named.conf.autozone

cp -a $AUTOZONEFILE $AUTOZONEFILE.old
> $AUTOZONEFILE.new
for zonefile in /var/lib/named/master/autozones/*; do
    CURZONE="$(basename "$zonefile")"
    cat <<EOF >> $AUTOZONEFILE.new
zone "$CURZONE" {
    type master;
    file "master/autozones/$CURZONE";
};
EOF
    done

cat $AUTOZONEFILE.new > $AUTOZONEFILE
rm $AUTOZONEFILE.new
rndc reload

Try something like that out.

1
  • something like this was the backup solution.. just thought i could take the easy way out... :)
    – alexcepoi
    Feb 8, 2011 at 2:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .