[dhcwg] bind zones and dhcpd configuration from ldap

Yannick Majoros <majoros@inma.ucl.ac.be> Tue, 15 November 2005 15:52 UTC

Received: from localhost.cnri.reston.va.us ([127.0.0.1] helo=megatron.ietf.org) by megatron.ietf.org with esmtp (Exim 4.32) id 1Ec373-0006Cj-4V; Tue, 15 Nov 2005 10:52:49 -0500
Received: from odin.ietf.org ([132.151.1.176] helo=ietf.org) by megatron.ietf.org with esmtp (Exim 4.32) id 1Ec371-0006CN-9L for dhcwg@megatron.ietf.org; Tue, 15 Nov 2005 10:52:47 -0500
Received: from ietf-mx.ietf.org (ietf-mx [132.151.6.1]) by ietf.org (8.9.1a/8.9.1a) with ESMTP id KAA02129 for <dhcwg@ietf.org>; Tue, 15 Nov 2005 10:52:14 -0500 (EST)
Received: from sprbodj.inma.ucl.ac.be ([130.104.239.239]) by ietf-mx.ietf.org with esmtp (Exim 4.43) id 1Ec3OG-0000CX-OA for dhcwg@ietf.org; Tue, 15 Nov 2005 11:10:37 -0500
Received: from localhost (localhost.localdomain [127.0.0.1]) by sprbodj.inma.ucl.ac.be (Postfix) with ESMTP id 08FA119C8228; Tue, 15 Nov 2005 16:52:45 +0100 (CET)
Received: from sprbodj.inma.ucl.ac.be ([127.0.0.1]) by localhost (sprbodj.inma.ucl.ac.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 04721-07; Tue, 15 Nov 2005 16:52:42 +0100 (CET)
Received: from [130.104.239.194] (pc-sanzot.inma.ucl.ac.be [130.104.239.194]) by sprbodj.inma.ucl.ac.be (Postfix) with ESMTP id 7354919C814E; Tue, 15 Nov 2005 16:52:42 +0100 (CET)
Message-ID: <437A0448.6030606@inma.ucl.ac.be>
Date: Tue, 15 Nov 2005 16:52:40 +0100
From: Yannick Majoros <majoros@inma.ucl.ac.be>
User-Agent: Thunderbird 1.4.1 (Windows/20051006)
MIME-Version: 1.0
Newsgroups: comp.protocols.dns.bind
Content-Type: multipart/mixed; boundary="------------070501080501000906020506"
X-Virus-Scanned: amavisd-new at csam.ucl.ac.be
X-Spam-Score: 0.0 (/)
X-Scan-Signature: dd7e0c3fd18d19cffdd4de99a114001d
Cc: dhcwg@ietf.org, openldap-software@OpenLDAP.org
Subject: [dhcwg] bind zones and dhcpd configuration from ldap
X-BeenThere: dhcwg@ietf.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: dhcwg.ietf.org
List-Unsubscribe: <https://www1.ietf.org/mailman/listinfo/dhcwg>, <mailto:dhcwg-request@ietf.org?subject=unsubscribe>
List-Post: <mailto:dhcwg@ietf.org>
List-Help: <mailto:dhcwg-request@ietf.org?subject=help>
List-Subscribe: <https://www1.ietf.org/mailman/listinfo/dhcwg>, <mailto:dhcwg-request@ietf.org?subject=subscribe>
Sender: dhcwg-bounces@ietf.org
Errors-To: dhcwg-bounces@ietf.org

  Hi,

  This is not a question, just for information. So, I hope not to 
disturb anyone by crossposting (sorry if I do)...

  I just wrote a script to create a configuration file and zone files 
from our openldap machine list, and restart the servers when 
appropriate. I thought it could be of interest for other people, so here 
it goes.

  I know other scripts exist, but I needed a different solution for the 
following reasons:

1. I didn't want to just write the dns records in our ldap base. 
Instead, these should be generated
2. I didn't want bind to just access the ldap base, because I want it to 
be independent of openldap and because of 1

  Instead, I wanted to just put all user workstations, servers, 
switchers and routers, and let a script generate the zone and dhcpd 
files. Please note that it is configurable: I use it myself to generate 
the files for multiple domains/subnets from the same base. Just change a 
couple of lines (I should put it in an independent config file when I'll 
have time).

  I wrote these scripts to suit my needs, but you should be able to 
adapt them to other infrastructures without too much hassle.

  A few details:

  - ldap_hosts is the main script. Just adjust the settings to your 
need. Some are optional; sorry for the poor doc, but the whole script is 
300 lines, so just have a look. 'NAMED' stuff is optional.
  - serials is a little script I wrote to update the serials of the zone 
files. Adjust your zones list in the script. It needs to access a file 
named 'serial' which contains your last serial (date/time format), and 
will update it itself.
  - I run these things in crontab, every minute. So, dns and dhcp are 
automatically updated whenever I change the ldap base, and I'm notified 
by mail about success/failures.
  - In case of failure, it generates temp files which are only 
deleted/changed when you change something. So, you won't receive a mail 
every minute for the same failure.
  - I use the script to generate only the parts of the zone/dhcpd files 
I need. I then use "include" directives in dhcpd.conf (include 
"/etc/dhcpd_ldap.conf";) and in the zone files ($INCLUDE machines.lst).
  - It works for me but could need some local adjustements!

  Ok, I think it's all your need. I hope it will be useful to someone 
someday, feel free to modify it (just tell me, please). Please give me 
your feedback.

  Yannick Majoros
_______________________________________________
dhcwg mailing list
dhcwg@ietf.org
https://www1.ietf.org/mailman/listinfo/dhcwg