ldap2zone
This is a tool that reads info for a zone from LDAP and constructs a
standard plain ascii zone file. The LDAP information has to be stored
using the dnszone schema.
For more
information on how to use the schema, see
this howto. The schema
is also used by BIND with this LDAP back-end.
This first version is pretty basic and may contain some bugs, reports
welcome. It also requires the OpenLDAP LDAP library. I might generalize
this if people want.
Usage
The basic usage is just
ldap2zone test.com ldap://ldapserver/base 172800.
It will then write a zone file to standard out.
You can also specify a serial number as a 4th argument. It will
then check if the serial number matches the serial number in
LDAP. The program will return different exit codes depending on
whether they match, and only write the zone to standard out if
they are different.
This can be used in a script that reloads the zone in the name
server if it has changed. The script would be something like:
#!/bin/sh
DIR = /local/domain/pz
ZONE = test.no
SERIAL = $(grep " ; serial" $DIR/$ZONE"| cut....)
ldap2zone $ZONE ldap://ldapserver/base 172800 $SERIAL > /tmp/$ZONE &&
{
mv /tmp/$ZONE $DIR/$ZONE
rndc ... reload $ZONE
}
This is not a complete working script but should give you some idea.
Mailing list
If you have questions, problems etc., please check my mailing list for
issues related to DNS and LDAP.
To join the list, go
here.
There is also an
archive.
Releases
ldap2zone-0.1 2005-04-24
This is the very first release and consists of just the file
ldap2zone.c.
venaas@uninett.no
Last modified: 2005-05-10