1 <?xml version=
"1.0" encoding=
"utf-8"?>
2 <rss version='
2.0' xmlns:lj='http://www.livejournal.org/rss/lj/
1.0/'
>
4 <title>Petter Reinholdtsen - Entries tagged ldap
</title>
5 <description>Entries tagged ldap
</description>
6 <link>http://people.skolelinux.org/pere/blog/
</link>
10 <title>Time for new LDAP schemas replacing RFC
2307?
</title>
11 <link>http://people.skolelinux.org/pere/blog/Time_for_new__LDAP_schemas_replacing_RFC_2307_.html
</link>
12 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Time_for_new__LDAP_schemas_replacing_RFC_2307_.html
</guid>
13 <pubDate>Sun,
29 Mar
2009 20:
30:
00 +
0200</pubDate>
15 <p
>The state of standardized LDAP schemas on Linux is far from
16 optimal. There is RFC
2307 documenting one way to store NIS maps in
17 LDAP, and a modified version of this normally called RFC
2307bis, with
18 some modifications to be compatible with Active Directory. The RFC
19 specification handle the content of a lot of system databases, but do
20 not handle DNS zones and DHCP configuration.
</p
>
22 <p
>In
<a href=
"http://www.skolelinux.org/
">Debian Edu/Skolelinux
</a
>,
23 we would like to store information about users, SMB clients/hosts,
24 filegroups, netgroups (users and hosts), DHCP and DNS configuration,
25 and LTSP configuration in LDAP. These objects have a lot in common,
26 but with the current LDAP schemas it is not possible to have one
27 object per entity. For example, one need to have at least three LDAP
28 objects for a given computer, one with the SMB related stuff, one with
29 DNS information and another with DHCP information. The schemas
30 provided for DNS and DHCP are impossible to combine into one LDAP
31 object. In addition, it is impossible to implement quick queries for
32 netgroup membership, because of the way NIS triples are implemented.
33 It just do not scale. I believe it is time for a few RFC
34 specifications to cleam up this mess.
</p
>
36 <p
>I would like to have one LDAP object representing each computer in
37 the network, and this object can then keep the SMB (ie host key), DHCP
38 (mac address/name) and DNS (name/IP address) settings in one place.
39 It need to be efficently stored to make sure it scale well.
</p
>
41 <p
>I would also like to have a quick way to map from a user or
42 computer and to the net group this user or computer is a member.
</p
>
44 <p
>Active Directory have done a better job than unix heads like myself
45 in this regard, and the unix side need to catch up. Time to start a
46 new IETF work group?
</p
>
51 <title>Idea for a change to LDAP schemas allowing DNS and DHCP info to be combined into one object
</title>
52 <link>http://people.skolelinux.org/pere/blog/Idea_for_a_change_to_LDAP_schemas_allowing_DNS_and_DHCP_info_to_be_combined_into_one_object.html
</link>
53 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Idea_for_a_change_to_LDAP_schemas_allowing_DNS_and_DHCP_info_to_be_combined_into_one_object.html
</guid>
54 <pubDate>Thu,
24 Jun
2010 00:
35:
00 +
0200</pubDate>
56 <p
>A while back, I
57 <a href=
"http://people.skolelinux.org/pere/blog/Time_for_new__LDAP_schemas_replacing_RFC_2307_.html
">complained
58 about the fact
</a
> that it is not possible with the provided schemas
59 for storing DNS and DHCP information in LDAP to combine the two sets
60 of information into one LDAP object representing a computer.
</p
>
62 <p
>In the mean time, I discovered that a simple fix would be to make
63 the dhcpHost object class auxiliary, to allow it to be combined with
64 the dNSDomain object class, and thus forming one object for one
65 computer when storing both DHCP and DNS information in LDAP.
</p
>
67 <p
>If I understand this correctly, it is not safe to do this change
68 without also changing the assigned number for the object class, and I
69 do not know enough about LDAP schema design to do that properly for
72 <p
>Anyway, for future reference, this is how I believe we could change
74 <a href=
"http://tools.ietf.org/html/draft-ietf-dhc-ldap-schema-
00">DHCP
75 schema
</a
> to solve at least part of the problem with the LDAP schemas
76 available today from IETF.
</p
>
79 --- dhcp.schema (revision
65192)
80 +++ dhcp.schema (working copy)
82 objectclass (
2.16.840.1.113719.1.203.6.6
83 NAME
'dhcpHost
'
84 DESC
'This represents information about a particular client
'
88 MAY (dhcpLeaseDN $ dhcpHWAddress $ dhcpOptionsDN $ dhcpStatements $ dhcpComments $ dhcpOption)
89 X-NDS_CONTAINMENT (
'dhcpService
' 'dhcpSubnet
' 'dhcpGroup
') )
92 <p
>I very much welcome clues on how to do this properly for Debian
93 Edu/Squeeze. We provide the DHCP schema in our debian-edu-config
94 package, and should thus be free to rewrite it as we see fit.
</p
>
96 <p
>If you want to help out with implementing this for Debian Edu,
97 please contact us on debian-edu@lists.debian.org.
</p
>
102 <title>LUMA, a very nice LDAP GUI
</title>
103 <link>http://people.skolelinux.org/pere/blog/LUMA__a_very_nice_LDAP_GUI.html
</link>
104 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/LUMA__a_very_nice_LDAP_GUI.html
</guid>
105 <pubDate>Mon,
28 Jun
2010 00:
30:
00 +
0200</pubDate>
107 <p
>The last few days I have been looking into the status of the LDAP
108 directory in Debian Edu, and in the process I started to miss a GUI
109 tool to browse the LDAP tree. The only one I was able to find in
110 Debian/Squeeze and Lenny is
111 <a href=
"http://luma.sourceforge.net/
">LUMA
</a
>, which has proved to
112 be a great tool to get a overview of the current LDAP directory
113 populated by default in Skolelinux. Thanks to it, I have been able to
114 find empty and obsolete subtrees, misplaced objects and duplicate
115 objects. It will be installed by default in Debian/Squeeze. If you
116 are working with LDAP, give it a go. :)
</p
>
118 <p
>I did notice one problem with it I have not had time to report to
119 the BTS yet. There is no .desktop file in the package, so the tool do
120 not show up in the Gnome and KDE menus, but only deep down in in the
121 Debian submenu in KDE. I hope that can be fixed before Squeeze is
124 <p
>I have not yet been able to get it to modify the tree yet. I would
125 like to move objects and remove subtrees directly in the GUI, but have
126 not found a way to do that with LUMA yet. So in the mean time, I use
127 <a href=
"http://www.lichteblau.com/ldapvi/
">ldapvi
</a
> for that.
</p
>
129 <p
>If you have tips on other GUI tools for LDAP that might be useful
130 in Debian Edu, please contact us on debian-edu@lists.debian.org.
</p
>
132 <p
>Update
2010-
06-
29: Ross Reedstrom tipped us about the
133 <a href=
"http://packages.qa.debian.org/g/gq.html
">gq
</a
> package as a
134 useful GUI alternative. It seem like a good tool, but is unmaintained
135 in Debian and got a RC bug keeping it out of Squeeze. Unless that
136 changes, it will not be an option for Debian Edu based on Squeeze.
</p
>
141 <title>Caching password, user and group on a roaming Debian laptop
</title>
142 <link>http://people.skolelinux.org/pere/blog/Caching_password__user_and_group_on_a_roaming_Debian_laptop.html
</link>
143 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Caching_password__user_and_group_on_a_roaming_Debian_laptop.html
</guid>
144 <pubDate>Thu,
1 Jul
2010 11:
40:
00 +
0200</pubDate>
146 <p
>For a laptop, centralized user directories and password checking is
147 a bit troubling. Laptops are typically used also when not connected
148 to the network, and it is vital for a user to be able to log in or
149 unlock the screen saver also when a central server is unavailable.
150 This is possible by caching passwords and directory information (user
151 and group attributes) locally, and the packages to do so are available
152 in Debian. Here follow two recipes to set this up in Debian/Squeeze.
153 It is also possible to set up in Debian/Lenny, but require more manual
154 setup there because pam-auth-update is missing in Lenny.
</p
>
156 <h2
>LDAP/Kerberos + nscd + libpam-ccreds + libpam-mklocaluser/pam_mkhomedir
</h2
>
158 This is the traditional method with a twist. The password caching is
159 provided by libpam-ccreds (version
10-
4 or later is needed on
160 Squeeze), and the directory caching is done by nscd. The directory
161 lookup and password checking is done using LDAP. If one want to use
162 Kerberos for password checking the libpam-ldapd package can be
163 replaced with libpam-krb5 or libpam-heimdal. If one is happy having a
164 local home directory with the path listed in LDAP, one can use the
165 pam_mkhomedir module from pam-modules to make this happen instead of
166 using libpam-mklocaluser. A setup for pam-auth-update to enable
167 pam_mkhomedir will have to be written until a fix for
168 <a href=
"http://bugs.debian.org/
568577">bug #
568577</a
> is in the
169 archive. Because I believe it is a bad idea to have local home
170 directories using misleading paths like /site/server/partition/, I
171 prefer to create a local user with the home directory in /home/. This
172 is done using the libpam-mklocaluser package.
</p
>
174 <p
>These packages need to be installed and configured
</p
>
176 <blockquote
><pre
>
177 libnss-ldapd libpam-ldapd nscd libpam-ccreds libpam-mklocaluser
178 </pre
></blockquote
>
180 <p
>The ldapd packages will ask for LDAP connection information, and
181 one have to fill in the values that fits ones own site. Make sure the
182 PAM part uses encrypted connections, to make sure the password is not
183 sent in clear text to the LDAP server. I
've been unable to get TLS
184 certificate checking for a self signed certificate working, which make
185 LDAP authentication unsafe for Debian Edu (nslcd is not checking if it
186 is talking to the correct LDAP server), and very much welcome feedback
187 on how to get this working.
</p
>
189 <p
>Because nscd do not have a default configuration fit for offline
190 caching until
<a href=
"http://bugs.debian.org/
485282">bug #
485282</a
>
191 is fixed, this configuration should be used instead of the one
192 currently in /etc/nscd.conf. The changes are in the fields
193 reload-count and positive-time-to-live, and is based on the
194 instructions I found in the
195 <a href=
"http://www.flyn.org/laptopldap/
">LDAP for Mobile Laptops
</a
>
196 instructions by Flyn Computing.
</p
>
198 <blockquote
><pre
>
200 reload-count unlimited
203 enable-cache passwd yes
204 positive-time-to-live passwd
2592000
205 negative-time-to-live passwd
20
206 suggested-size passwd
211
207 check-files passwd yes
208 persistent passwd yes
210 max-db-size passwd
33554432
211 auto-propagate passwd yes
213 enable-cache group yes
214 positive-time-to-live group
2592000
215 negative-time-to-live group
20
216 suggested-size group
211
217 check-files group yes
220 max-db-size group
33554432
221 auto-propagate group yes
223 enable-cache hosts no
224 positive-time-to-live hosts
2592000
225 negative-time-to-live hosts
20
226 suggested-size hosts
211
227 check-files hosts yes
230 max-db-size hosts
33554432
232 enable-cache services yes
233 positive-time-to-live services
2592000
234 negative-time-to-live services
20
235 suggested-size services
211
236 check-files services yes
237 persistent services yes
239 max-db-size services
33554432
240 </pre
></blockquote
>
242 <p
>While we wait for a mechanism to update /etc/nsswitch.conf
243 automatically like the one provided in
244 <a href=
"http://bugs.debian.org/
496915">bug #
496915</a
>, the file
245 content need to be manually replaced to ensure LDAP is used as the
246 directory service on the machine. /etc/nsswitch.conf should normally
247 look like this:
</p
>
249 <blockquote
><pre
>
253 hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
260 </pre
></blockquote
>
262 <p
>The important parts are that ldap is listed last for passwd, group,
263 shadow and netgroup.
</p
>
265 <p
>With these changes in place, any user in LDAP will be able to log
266 in locally on the machine using for example kdm, get a local home
267 directory created and have the password as well as user and group
270 <h2
>LDAP/Kerberos + nss-updatedb + libpam-ccreds +
271 libpam-mklocaluser/pam_mkhomedir
</h2
>
273 <p
>Because nscd have had its share of problems, and seem to have
274 problems doing proper caching, I
've seen suggestions and recipes to
275 use nss-updatedb to copy parts of the LDAP database locally when the
276 LDAP database is available. I have not tested such setup, because I
277 discovered sssd.
</p
>
279 <h2
>LDAP/Kerberos + sssd + libpam-mklocaluser
</h2
>
281 <p
>A more flexible and robust setup than the nscd combination
282 mentioned earlier that has shown up recently, is the
283 <a href=
"https://fedorahosted.org/sssd/
">sssd
</a
> package from Redhat.
284 It is part of the
<a href=
"http://www.freeipa.org/
">FreeIPA
</A
> project
285 to provide a Active Directory like directory service for Linux
286 machines. The sssd system combines the caching of passwords and user
287 information into one package, and remove the need for nscd and
288 libpam-ccreds. It support LDAP and Kerberos, but not NIS. Version
289 1.2 do not support netgroups, but it is said that it will support this
290 in version
1.5 expected to show up later in
2010. Because the
291 <a href=
"http://packages.qa.debian.org/s/sssd.html
">sssd package
</a
>
292 was missing in Debian, I ended up co-maintaining it with Werner, and
293 version
1.2 is now in testing.
295 <p
>These packages need to be installed and configured to get the
296 roaming setup I want
</p
>
298 <blockquote
><pre
>
299 libpam-sss libnss-sss libpam-mklocaluser
300 </pre
></blockquote
>
302 The complete setup of sssd is done by editing/creating
303 <tt
>/etc/sssd/sssd.conf
</tt
>.
305 <blockquote
><pre
>
307 config_file_version =
2
308 reconnection_retries =
3
316 reconnection_retries =
3
319 reconnection_retries =
3
323 cache_credentials = true
327 chpass_provider = ldap
329 ldap_uri = ldap://ldap
330 ldap_search_base = dc=skole,dc=skolelinux,dc=no
331 ldap_tls_reqcert = never
332 ldap_tls_cacert = /etc/ssl/certs/ca-certificates.crt
333 </pre
></blockquote
>
335 <p
>I got the same problem here with certificate checking. Had to set
336 "ldap_tls_reqcert = never
" to get it working.
</p
>
338 <p
>With the libnss-sss package in testing at the moment, the
339 nsswitch.conf file is update automatically, so there is no need to
340 modify it manually.
</p
>
342 <p
>If you want to help out with implementing this for Debian Edu,
343 please contact us on debian-edu@lists.debian.org.
</p
>
348 <title>jXplorer, a very nice LDAP GUI
</title>
349 <link>http://people.skolelinux.org/pere/blog/jXplorer__a_very_nice_LDAP_GUI.html
</link>
350 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/jXplorer__a_very_nice_LDAP_GUI.html
</guid>
351 <pubDate>Fri,
9 Jul
2010 12:
55:
00 +
0200</pubDate>
354 <a href=
"http://people.skolelinux.org/pere/blog/LUMA__a_very_nice_LDAP_GUI.html
">my
355 last post
</a
> about available LDAP tools in Debian, I was told about a
356 LDAP GUI that is even better than luma. The java application
357 <a href=
"http://jxplorer.org/
">jXplorer
</a
> is claimed to be capable of
358 moving LDAP objects and subtrees using drag-and-drop, and can
359 authenticate using Kerberos. I have only tested the Kerberos
360 authentication, but do not have a LDAP setup allowing me to rewrite
361 LDAP with my test user yet. It is
362 <a href=
"http://packages.qa.debian.org/j/jxplorer.html
">available in
363 Debian
</a
> testing and unstable at the moment. The only problem I
364 have with it is how it handle errors. If something go wrong, its
365 non-intuitive behaviour require me to go through some query work list
366 and remove the failing query. Nothing big, but very annoying.
</p
>
371 <title>Idea for storing LTSP configuration in LDAP
</title>
372 <link>http://people.skolelinux.org/pere/blog/Idea_for_storing_LTSP_configuration_in_LDAP.html
</link>
373 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Idea_for_storing_LTSP_configuration_in_LDAP.html
</guid>
374 <pubDate>Sun,
11 Jul
2010 22:
00:
00 +
0200</pubDate>
376 <p
>Vagrant mentioned on IRC today that ltsp_config now support
377 sourcing files from /usr/share/ltsp/ltsp_config.d/ on the thin
378 clients, and that this can be used to fetch configuration from LDAP if
379 Debian Edu choose to store configuration there.
</p
>
381 <p
>Armed with this information, I got inspired and wrote a test module
382 to get configuration from LDAP. The idea is to look up the MAC
383 address of the client in LDAP, and look for attributes on the form
384 ltspconfigsetting=value, and use this to export SETTING=value to the
385 LTSP clients.
</p
>
387 <p
>The goal is to be able to store the LTSP configuration attributes
388 in a
"computer
" LDAP object used by both DNS and DHCP, and thus
389 allowing us to store all information about a computer in one place.
</p
>
391 <p
>This is a untested draft implementation, and I welcome feedback on
392 this approach. A real LDAP schema for the ltspClientAux objectclass
393 need to be written. Comments, suggestions, etc?
</p
>
395 <blockquote
><pre
>
396 # Store in /opt/ltsp/$arch/usr/share/ltsp/ltsp_config.d/ldap-config
398 # Fetch LTSP client settings from LDAP based on MAC address
400 # Uses ethernet address as stored in the dhcpHost objectclass using
401 # the dhcpHWAddress attribute or ethernet address stored in the
402 # ieee802Device objectclass with the macAddress attribute.
404 # This module is written to be schema agnostic, and only depend on the
405 # existence of attribute names.
407 # The LTSP configuration variables are saved directly using a
408 # ltspConfig prefix and uppercasing the rest of the attribute name.
409 # To set the SERVER variable, set the ltspConfigServer attribute.
411 # Some LDAP schema should be created with all the relevant
412 # configuration settings. Something like this should work:
414 # objectclass (
1.1.2.2 NAME
'ltspClientAux
'
417 # MAY ( ltspConfigServer $ ltsConfigSound $ ... )
419 LDAPSERVER=$(debian-edu-ldapserver)
420 if [
"$LDAPSERVER
" ] ; then
421 LDAPBASE=$(debian-edu-ldapserver -b)
422 for MAC in $(LANG=C ifconfig |grep -i hwaddr| awk
'{print $
5}
'|sort -u) ; do
423 filter=
"(|(dhcpHWAddress=ethernet $MAC)(macAddress=$MAC))
"
424 ldapsearch -h
"$LDAPSERVER
" -b
"$LDAPBASE
" -v -x
"$filter
" | \
425 grep
'^ltspConfig
' | while read attr value ; do
426 # Remove prefix and convert to upper case
427 attr=$(echo $attr | sed
's/^ltspConfig//i
' | tr a-z A-Z)
428 # bass value on to clients
429 eval
"$attr=$value; export $attr
"
433 </pre
></blockquote
>
435 <p
>I
'm not sure this shell construction will work, because I suspect
436 the while block might end up in a subshell causing the variables set
437 there to not show up in ltsp-config, but if that is the case I am sure
438 the code can be restructured to make sure the variables are passed on.
439 I expect that can be solved with some testing. :)
</p
>
441 <p
>If you want to help out with implementing this for Debian Edu,
442 please contact us on debian-edu@lists.debian.org.
</p
>
444 <p
>Update
2010-
07-
17: I am aware of another effort to store LTSP
445 configuration in LDAP that was created around year
2000 by
446 <a href=
"http://www.pcxperience.com/thinclient/documentation/ldap.html
">PC
447 Xperience, Inc.,
2000</a
>. I found its
448 <a href=
"http://people.redhat.com/alikins/ltsp/ldap/
">files
</a
> on a
449 personal home page over at redhat.com.
</p
>
454 <title>Combining PowerDNS and ISC DHCP LDAP objects
</title>
455 <link>http://people.skolelinux.org/pere/blog/Combining_PowerDNS_and_ISC_DHCP_LDAP_objects.html
</link>
456 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Combining_PowerDNS_and_ISC_DHCP_LDAP_objects.html
</guid>
457 <pubDate>Wed,
14 Jul
2010 23:
45:
00 +
0200</pubDate>
459 <p
>For a while now, I have wanted to find a way to change the DNS and
460 DHCP services in Debian Edu to use the same LDAP objects for a given
461 computer, to avoid the possibility of having a inconsistent state for
462 a computer in LDAP (as in DHCP but no DNS entry or the other way
463 around) and make it easier to add computers to LDAP.
</p
>
465 <p
>I
've looked at how powerdns and dhcpd is using LDAP, and using this
466 information finally found a solution that seem to work.
</p
>
468 <p
>The old setup required three LDAP objects for a given computer.
469 One forward DNS entry, one reverse DNS entry and one DHCP entry. If
470 we switch powerdns to use its strict LDAP method (ldap-method=strict
471 in pdns-debian-edu.conf), the forward and reverse DNS entries are
472 merged into one while making it impossible to transfer the reverse map
473 to a slave DNS server.
</p
>
475 <p
>If we also replace the object class used to get the DNS related
476 attributes to one allowing these attributes to be combined with the
477 dhcphost object class, we can merge the DNS and DHCP entries into one.
478 I
've written such object class in the dnsdomainaux.schema file (need
479 proper OIDs, but that is a minor issue), and tested the setup. It
480 seem to work.
</p
>
482 <p
>With this test setup in place, we can get away with one LDAP object
483 for both DNS and DHCP, and even the LTSP configuration I suggested in
484 an earlier email. The combined LDAP object will look something like
487 <blockquote
><pre
>
488 dn: cn=hostname,cn=group1,cn=THINCLIENTS,cn=DHCP Config,dc=skole,dc=skolelinux,dc=no
490 objectClass: dhcphost
491 objectclass: domainrelatedobject
492 objectclass: dnsdomainaux
493 associateddomain: hostname.intern
495 dhcphwaddress: ethernet
00:
00:
00:
00:
00:
00
496 dhcpstatements: fixed-address hostname
498 </pre
></blockquote
>
500 <p
>The DNS server uses the associateddomain and arecord entries, while
501 the DHCP server uses the dhcphwaddress and dhcpstatements entries
502 before asking DNS to resolve the fixed-adddress. LTSP will use
503 dhcphwaddress or associateddomain and the ldapconfig* attributes.
</p
>
505 <p
>I am not yet sure if I can get the DHCP server to look for its
506 dhcphost in a different location, to allow us to put the objects
507 outside the
"DHCP Config
" subtree, but hope to figure out a way to do
508 that. If I can
't figure out a way to do that, we can still get rid of
509 the hosts subtree and move all its content into the DHCP Config tree
510 (which probably should be renamed to be more related to the new
511 content. I suspect cn=dnsdhcp,ou=services or something like that
512 might be a good place to put it.
</p
>
514 <p
>If you want to help out with implementing this for Debian Edu,
515 please contact us on debian-edu@lists.debian.org.
</p
>
520 <title>What are they searching for - PowerDNS and ISC DHCP in LDAP
</title>
521 <link>http://people.skolelinux.org/pere/blog/What_are_they_searching_for___PowerDNS_and_ISC_DHCP_in_LDAP.html
</link>
522 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/What_are_they_searching_for___PowerDNS_and_ISC_DHCP_in_LDAP.html
</guid>
523 <pubDate>Sat,
17 Jul
2010 21:
00:
00 +
0200</pubDate>
526 <a href=
"http://people.skolelinux.org/pere/blog/Time_for_new__LDAP_schemas_replacing_RFC_2307_.html
">followup
</a
>
528 <a href=
"http://people.skolelinux.org/pere/blog/Idea_for_a_change_to_LDAP_schemas_allowing_DNS_and_DHCP_info_to_be_combined_into_one_object.html
">previous
530 <a href=
"http://people.skolelinux.org/pere/blog/Combining_PowerDNS_and_ISC_DHCP_LDAP_objects.html
">merging
531 all
</a
> the computer related LDAP objects in Debian Edu.
</p
>
533 <p
>As a step to try to see if it possible to merge the DNS and DHCP
534 LDAP objects, I have had a look at how the packages pdns-backend-ldap
535 and dhcp3-server-ldap in Debian use the LDAP server. The two
536 implementations are quite different in how they use LDAP.
</p
>
538 To get this information, I started slapd with debugging enabled and
539 dumped the debug output to a file to get the LDAP searches performed
540 on a Debian Edu main-server. Here is a summary.
542 <p
><strong
>powerdns
</strong
></p
>
544 <a href=
"http://www.linuxnetworks.de/doc/index.php/PowerDNS_LDAP_Backend
">Clues
545 on how to
</a
> set up PowerDNS to use a LDAP backend is available on
548 <p
>PowerDNS have two modes of operation using LDAP as its backend.
549 One
"strict
" mode where the forward and reverse DNS lookups are done
550 using the same LDAP objects, and a
"tree
" mode where the forward and
551 reverse entries are in two different subtrees in LDAP with a structure
552 based on the DNS names, as in tjener.intern and
553 2.2.0.10.in-addr.arpa.
</p
>
555 <p
>In tree mode, the server is set up to use a LDAP subtree as its
556 base, and uses a
"base
" scoped search for the DNS name by adding
557 "dc=tjener,dc=intern,
" to the base with a filter for
558 "(associateddomain=tjener.intern)
" for the forward entry and
559 "dc=
2,dc=
2,dc=
0,dc=
10,dc=in-addr,dc=arpa,
" with a filter for
560 "(associateddomain=
2.2.0.10.in-addr.arpa)
" for the reverse entry. For
561 forward entries, it is looking for attributes named dnsttl, arecord,
562 nsrecord, cnamerecord, soarecord, ptrrecord, hinforecord, mxrecord,
563 txtrecord, rprecord, afsdbrecord, keyrecord, aaaarecord, locrecord,
564 srvrecord, naptrrecord, kxrecord, certrecord, dsrecord, sshfprecord,
565 ipseckeyrecord, rrsigrecord, nsecrecord, dnskeyrecord, dhcidrecord,
566 spfrecord and modifytimestamp. For reverse entries it is looking for
567 the attributes dnsttl, arecord, nsrecord, cnamerecord, soarecord,
568 ptrrecord, hinforecord, mxrecord, txtrecord, rprecord, aaaarecord,
569 locrecord, srvrecord, naptrrecord and modifytimestamp. The equivalent
570 ldapsearch commands could look like this:
</p
>
572 <blockquote
><pre
>
574 -b dc=tjener,dc=intern,ou=hosts,dc=skole,dc=skolelinux,dc=no \
575 -s base -x
'(associateddomain=tjener.intern)
' dNSTTL aRecord nSRecord \
576 cNAMERecord sOARecord pTRRecord hInfoRecord mXRecord tXTRecord \
577 rPRecord aFSDBRecord KeyRecord aAAARecord lOCRecord sRVRecord \
578 nAPTRRecord kXRecord certRecord dSRecord sSHFPRecord iPSecKeyRecord \
579 rRSIGRecord nSECRecord dNSKeyRecord dHCIDRecord sPFRecord modifyTimestamp
582 -b dc=
2,dc=
2,dc=
0,dc=
10,dc=in-addr,dc=arpa,ou=hosts,dc=skole,dc=skolelinux,dc=no \
583 -s base -x
'(associateddomain=
2.2.0.10.in-addr.arpa)
'
584 dnsttl, arecord, nsrecord, cnamerecord soarecord ptrrecord \
585 hinforecord mxrecord txtrecord rprecord aaaarecord locrecord \
586 srvrecord naptrrecord modifytimestamp
587 </pre
></blockquote
>
589 <p
>In Debian Edu/Lenny, the PowerDNS tree mode is used with
590 ou=hosts,dc=skole,dc=skolelinux,dc=no as the base, and these are two
591 example LDAP objects used there. In addition to these objects, the
592 parent objects all th way up to ou=hosts,dc=skole,dc=skolelinux,dc=no
593 also exist.
</p
>
595 <blockquote
><pre
>
596 dn: dc=tjener,dc=intern,ou=hosts,dc=skole,dc=skolelinux,dc=no
598 objectclass: dnsdomain
599 objectclass: domainrelatedobject
602 associateddomain: tjener.intern
604 dn: dc=
2,dc=
2,dc=
0,dc=
10,dc=in-addr,dc=arpa,ou=hosts,dc=skole,dc=skolelinux,dc=no
606 objectclass: dnsdomain2
607 objectclass: domainrelatedobject
609 ptrrecord: tjener.intern
610 associateddomain:
2.2.0.10.in-addr.arpa
611 </pre
></blockquote
>
613 <p
>In strict mode, the server behaves differently. When looking for
614 forward DNS entries, it is doing a
"subtree
" scoped search with the
615 same base as in the tree mode for a object with filter
616 "(associateddomain=tjener.intern)
" and requests the attributes dnsttl,
617 arecord, nsrecord, cnamerecord, soarecord, ptrrecord, hinforecord,
618 mxrecord, txtrecord, rprecord, aaaarecord, locrecord, srvrecord,
619 naptrrecord and modifytimestamp. For reverse entires it also do a
620 subtree scoped search but this time the filter is
"(arecord=
10.0.2.2)
"
621 and the requested attributes are associateddomain, dnsttl and
622 modifytimestamp. In short, in strict mode the objects with ptrrecord
623 go away, and the arecord attribute in the forward object is used
626 <p
>The forward and reverse searches can be simulated using ldapsearch
629 <blockquote
><pre
>
630 ldapsearch -h ldap -b ou=hosts,dc=skole,dc=skolelinux,dc=no -s sub -x \
631 '(associateddomain=tjener.intern)
' dNSTTL aRecord nSRecord \
632 cNAMERecord sOARecord pTRRecord hInfoRecord mXRecord tXTRecord \
633 rPRecord aFSDBRecord KeyRecord aAAARecord lOCRecord sRVRecord \
634 nAPTRRecord kXRecord certRecord dSRecord sSHFPRecord iPSecKeyRecord \
635 rRSIGRecord nSECRecord dNSKeyRecord dHCIDRecord sPFRecord modifyTimestamp
637 ldapsearch -h ldap -b ou=hosts,dc=skole,dc=skolelinux,dc=no -s sub -x \
638 '(arecord=
10.0.2.2)
' associateddomain dnsttl modifytimestamp
639 </pre
></blockquote
>
641 <p
>In addition to the forward and reverse searches , there is also a
642 search for SOA records, which behave similar to the forward and
643 reverse lookups.
</p
>
645 <p
>A thing to note with the PowerDNS behaviour is that it do not
646 specify any objectclass names, and instead look for the attributes it
647 need to generate a DNS reply. This make it able to work with any
648 objectclass that provide the needed attributes.
</p
>
650 <p
>The attributes are normally provided in the cosine (RFC
1274) and
651 dnsdomain2 schemas. The latter is used for reverse entries like
652 ptrrecord and recent DNS additions like aaaarecord and srvrecord.
</p
>
654 <p
>In Debian Edu, we have created DNS objects using the object classes
655 dcobject (for dc), dnsdomain or dnsdomain2 (structural, for the DNS
656 attributes) and domainrelatedobject (for associatedDomain). The use
657 of structural object classes make it impossible to combine these
658 classes with the object classes used by DHCP.
</p
>
660 <p
>There are other schemas that could be used too, for example the
661 dnszone structural object class used by Gosa and bind-sdb for the DNS
662 attributes combined with the domainrelatedobject object class, but in
663 this case some unused attributes would have to be included as well
664 (zonename and relativedomainname).
</p
>
666 <p
>My proposal for Debian Edu would be to switch PowerDNS to strict
667 mode and not use any of the existing objectclasses (dnsdomain,
668 dnsdomain2 and dnszone) when one want to combine the DNS information
669 with DHCP information, and instead create a auxiliary object class
670 defined something like this (using the attributes defined for
671 dnsdomain and dnsdomain2 or dnszone):
</p
>
673 <blockquote
><pre
>
674 objectclass ( some-oid NAME
'dnsDomainAux
'
677 MAY ( ARecord $ MDRecord $ MXRecord $ NSRecord $ SOARecord $ CNAMERecord $
678 DNSTTL $ DNSClass $ PTRRecord $ HINFORecord $ MINFORecord $
679 TXTRecord $ SIGRecord $ KEYRecord $ AAAARecord $ LOCRecord $
680 NXTRecord $ SRVRecord $ NAPTRRecord $ KXRecord $ CERTRecord $
681 A6Record $ DNAMERecord
683 </pre
></blockquote
>
685 <p
>This will allow any object to become a DNS entry when combined with
686 the domainrelatedobject object class, and allow any entity to include
687 all the attributes PowerDNS wants. I
've sent an email to the PowerDNS
688 developers asking for their view on this schema and if they are
689 interested in providing such schema with PowerDNS, and I hope my
690 message will be accepted into their mailing list soon.
</p
>
692 <p
><strong
>ISC dhcp
</strong
></p
>
694 <p
>The DHCP server searches for specific objectclass and requests all
695 the object attributes, and then uses the attributes it want. This
696 make it harder to figure out exactly what attributes are used, but
697 thanks to the working example in Debian Edu I can at least get an idea
698 what is needed without having to read the source code.
</p
>
700 <p
>In the DHCP server configuration, the LDAP base to use and the
701 search filter to use to locate the correct dhcpServer entity is
702 stored. These are the relevant entries from
703 /etc/dhcp3/dhcpd.conf:
</p
>
705 <blockquote
><pre
>
706 ldap-base-dn
"dc=skole,dc=skolelinux,dc=no
";
707 ldap-dhcp-server-cn
"dhcp
";
708 </pre
></blockquote
>
710 <p
>The DHCP server uses this information to nest all the DHCP
711 configuration it need. The cn
"dhcp
" is located using the given LDAP
712 base and the filter
"(
&(objectClass=dhcpServer)(cn=dhcp))
". The
713 search result is this entry:
</p
>
715 <blockquote
><pre
>
716 dn: cn=dhcp,dc=skole,dc=skolelinux,dc=no
719 objectClass: dhcpServer
720 dhcpServiceDN: cn=DHCP Config,dc=skole,dc=skolelinux,dc=no
721 </pre
></blockquote
>
723 <p
>The content of the dhcpServiceDN attribute is next used to locate the
724 subtree with DHCP configuration. The DHCP configuration subtree base
725 is located using a base scope search with base
"cn=DHCP
726 Config,dc=skole,dc=skolelinux,dc=no
" and filter
727 "(
&(objectClass=dhcpService)(|(dhcpPrimaryDN=cn=dhcp,dc=skole,dc=skolelinux,dc=no)(dhcpSecondaryDN=cn=dhcp,dc=skole,dc=skolelinux,dc=no)))
".
728 The search result is this entry:
</p
>
730 <blockquote
><pre
>
731 dn: cn=DHCP Config,dc=skole,dc=skolelinux,dc=no
734 objectClass: dhcpService
735 objectClass: dhcpOptions
736 dhcpPrimaryDN: cn=dhcp, dc=skole,dc=skolelinux,dc=no
737 dhcpStatements: ddns-update-style none
738 dhcpStatements: authoritative
739 dhcpOption: smtp-server code
69 = array of ip-address
740 dhcpOption: www-server code
72 = array of ip-address
741 dhcpOption: wpad-url code
252 = text
742 </pre
></blockquote
>
744 <p
>Next, the entire subtree is processed, one level at the time. When
745 all the DHCP configuration is loaded, it is ready to receive requests.
746 The subtree in Debian Edu contain objects with object classes
747 top/dhcpService/dhcpOptions, top/dhcpSharedNetwork/dhcpOptions,
748 top/dhcpSubnet, top/dhcpGroup and top/dhcpHost. These provide options
749 and information about netmasks, dynamic range etc. Leaving out the
750 details here because it is not relevant for the focus of my
751 investigation, which is to see if it is possible to merge dns and dhcp
752 related computer objects.
</p
>
754 <p
>When a DHCP request come in, LDAP is searched for the MAC address
755 of the client (
00:
00:
00:
00:
00:
00 in this example), using a subtree
756 scoped search with
"cn=DHCP Config,dc=skole,dc=skolelinux,dc=no
" as
757 the base and
"(
&(objectClass=dhcpHost)(dhcpHWAddress=ethernet
758 00:
00:
00:
00:
00:
00))
" as the filter. This is what a host object look
761 <blockquote
><pre
>
762 dn: cn=hostname,cn=group1,cn=THINCLIENTS,cn=DHCP Config,dc=skole,dc=skolelinux,dc=no
765 objectClass: dhcpHost
766 dhcpHWAddress: ethernet
00:
00:
00:
00:
00:
00
767 dhcpStatements: fixed-address hostname
768 </pre
></blockquote
>
770 <p
>There is less flexiblity in the way LDAP searches are done here.
771 The object classes need to have fixed names, and the configuration
772 need to be stored in a fairly specific LDAP structure. On the
773 positive side, the invidiual dhcpHost entires can be anywhere without
774 the DN pointed to by the dhcpServer entries. The latter should make
775 it possible to group all host entries in a subtree next to the
776 configuration entries, and this subtree can also be shared with the
777 DNS server if the schema proposed above is combined with the dhcpHost
778 structural object class.
780 <p
><strong
>Conclusion
</strong
></p
>
782 <p
>The PowerDNS implementation seem to be very flexible when it come
783 to which LDAP schemas to use. While its
"tree
" mode is rigid when it
784 come to the the LDAP structure, the
"strict
" mode is very flexible,
785 allowing DNS objects to be stored anywhere under the base cn specified
786 in the configuration.
</p
>
788 <p
>The DHCP implementation on the other hand is very inflexible, both
789 regarding which LDAP schemas to use and which LDAP structure to use.
790 I guess one could implement ones own schema, as long as the
791 objectclasses and attributes have the names used, but this do not
792 really help when the DHCP subtree need to have a fairly fixed
795 <p
>Based on the observed behaviour, I suspect a LDAP structure like
796 this might work for Debian Edu:
</p
>
798 <blockquote
><pre
>
800 cn=machine-info (dhcpService) - dhcpServiceDN points here
802 cn=dhcp-internal (dhcpSharedNetwork/dhcpOptions)
803 cn=
10.0.2.0 (dhcpSubnet)
804 cn=group1 (dhcpGroup/dhcpOptions)
805 cn=dhcp-thinclients (dhcpSharedNetwork/dhcpOptions)
806 cn=
192.168.0.0 (dhcpSubnet)
807 cn=group1 (dhcpGroup/dhcpOptions)
808 ou=machines - PowerDNS base points here
809 cn=hostname (dhcpHost/domainrelatedobject/dnsDomainAux)
810 </pre
></blockquote
>
812 <P
>This is not tested yet. If the DHCP server require the dhcpHost
813 entries to be in the dhcpGroup subtrees, the entries can be stored
814 there instead of a common machines subtree, and the PowerDNS base
815 would have to be moved one level up to the machine-info subtree.
</p
>
817 <p
>The combined object under the machines subtree would look something
820 <blockquote
><pre
>
821 dn: dc=hostname,ou=machines,cn=machine-info,dc=skole,dc=skolelinux,dc=no
824 objectClass: dhcpHost
825 objectclass: domainrelatedobject
826 objectclass: dnsDomainAux
827 associateddomain: hostname.intern
829 dhcpHWAddress: ethernet
00:
00:
00:
00:
00:
00
830 dhcpStatements: fixed-address hostname.intern
831 </pre
></blockquote
>
833 </p
>One could even add the LTSP configuration associated with a given
834 machine, as long as the required attributes are available in a
835 auxiliary object class.
</p
>