1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5 <title>Petter Reinholdtsen: entries from July
2010</title>
6 <link rel=
"stylesheet" type=
"text/css" media=
"screen" href=
"http://people.skolelinux.org/pere/blog/style.css">
7 <link rel=
"alternate" title=
"RSS Feed" href=
"07.rss" type=
"application/rss+xml">
14 <a href=
"http://people.skolelinux.org/pere/blog/">Petter Reinholdtsen
</a>
20 <p>Entries from July
2010.
</p>
25 <a href=
"http://people.skolelinux.org/pere/blog/Caching_password__user_and_group_on_a_roaming_Debian_laptop.html">Caching password, user and group on a roaming Debian laptop
</a>
33 <p>For a laptop, centralized user directories and password checking is
34 a bit troubling. Laptops are typically used also when not connected
35 to the network, and it is vital for a user to be able to log in or
36 unlock the screen saver also when a central server is unavailable.
37 This is possible by caching passwords and directory information (user
38 and group attributes) locally, and the packages to do so are available
39 in Debian. Here follow two recipes to set this up in Debian/Squeeze.
40 It is also possible to set up in Debian/Lenny, but require more manual
41 setup there because pam-auth-update is missing in Lenny.
</p>
43 <h2>LDAP/Kerberos + nscd + libpam-ccreds + libpam-mklocaluser/pam_mkhomedir
</h2>
45 This is the traditional method with a twist. The password caching is
46 provided by libpam-ccreds (version
10-
4 or later is needed on
47 Squeeze), and the directory caching is done by nscd. The directory
48 lookup and password checking is done using LDAP. If one want to use
49 Kerberos for password checking the libpam-ldapd package can be
50 replaced with libpam-krb5 or libpam-heimdal. If one is happy having a
51 local home directory with the path listed in LDAP, one can use the
52 pam_mkhomedir module from pam-modules to make this happen instead of
53 using libpam-mklocaluser. A setup for pam-auth-update to enable
54 pam_mkhomedir will have to be written until a fix for
55 <a href=
"http://bugs.debian.org/568577">bug #
568577</a> is in the
56 archive. Because I believe it is a bad idea to have local home
57 directories using misleading paths like /site/server/partition/, I
58 prefer to create a local user with the home directory in /home/. This
59 is done using the libpam-mklocaluser package.
</p>
61 <p>These packages need to be installed and configured
</p>
64 libnss-ldapd libpam-ldapd nscd libpam-ccreds libpam-mklocaluser
67 <p>The ldapd packages will ask for LDAP connection information, and
68 one have to fill in the values that fits ones own site. Make sure the
69 PAM part uses encrypted connections, to make sure the password is not
70 sent in clear text to the LDAP server. I've been unable to get TLS
71 certificate checking for a self signed certificate working, which make
72 LDAP authentication unsafe for Debian Edu (nslcd is not checking if it
73 is talking to the correct LDAP server), and very much welcome feedback
74 on how to get this working.
</p>
76 <p>Because nscd do not have a default configuration fit for offline
77 caching until
<a href=
"http://bugs.debian.org/485282">bug #
485282</a>
78 is fixed, this configuration should be used instead of the one
79 currently in /etc/nscd.conf. The changes are in the fields
80 reload-count and positive-time-to-live, and is based on the
81 instructions I found in the
82 <a href=
"http://www.flyn.org/laptopldap/">LDAP for Mobile Laptops
</a>
83 instructions by Flyn Computing.
</p>
87 reload-count unlimited
90 enable-cache passwd yes
91 positive-time-to-live passwd
2592000
92 negative-time-to-live passwd
20
93 suggested-size passwd
211
94 check-files passwd yes
97 max-db-size passwd
33554432
98 auto-propagate passwd yes
100 enable-cache group yes
101 positive-time-to-live group
2592000
102 negative-time-to-live group
20
103 suggested-size group
211
104 check-files group yes
107 max-db-size group
33554432
108 auto-propagate group yes
110 enable-cache hosts no
111 positive-time-to-live hosts
2592000
112 negative-time-to-live hosts
20
113 suggested-size hosts
211
114 check-files hosts yes
117 max-db-size hosts
33554432
119 enable-cache services yes
120 positive-time-to-live services
2592000
121 negative-time-to-live services
20
122 suggested-size services
211
123 check-files services yes
124 persistent services yes
126 max-db-size services
33554432
129 <p>While we wait for a mechanism to update /etc/nsswitch.conf
130 automatically like the one provided in
131 <a href=
"http://bugs.debian.org/496915">bug #
496915</a>, the file
132 content need to be manually replaced to ensure LDAP is used as the
133 directory service on the machine. /etc/nsswitch.conf should normally
140 hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
149 <p>The important parts are that ldap is listed last for passwd, group,
150 shadow and netgroup.
</p>
152 <p>With these changes in place, any user in LDAP will be able to log
153 in locally on the machine using for example kdm, get a local home
154 directory created and have the password as well as user and group
157 <h2>LDAP/Kerberos + nss-updatedb + libpam-ccreds +
158 libpam-mklocaluser/pam_mkhomedir
</h2>
160 <p>Because nscd have had its share of problems, and seem to have
161 problems doing proper caching, I've seen suggestions and recipes to
162 use nss-updatedb to copy parts of the LDAP database locally when the
163 LDAP database is available. I have not tested such setup, because I
166 <h2>LDAP/Kerberos + sssd + libpam-mklocaluser
</h2>
168 <p>A more flexible and robust setup than the nscd combination
169 mentioned earlier that has shown up recently, is the
170 <a href=
"https://fedorahosted.org/sssd/">sssd
</a> package from Redhat.
171 It is part of the
<a href=
"http://www.freeipa.org/">FreeIPA
</A> project
172 to provide a Active Directory like directory service for Linux
173 machines. The sssd system combines the caching of passwords and user
174 information into one package, and remove the need for nscd and
175 libpam-ccreds. It support LDAP and Kerberos, but not NIS. Version
176 1.2 do not support netgroups, but it is said that it will support this
177 in version
1.5 expected to show up later in
2010. Because the
178 <a href=
"http://packages.qa.debian.org/s/sssd.html">sssd package
</a>
179 was missing in Debian, I ended up co-maintaining it with Werner, and
180 version
1.2 is now in testing.
182 <p>These packages need to be installed and configured to get the
183 roaming setup I want
</p>
186 libpam-sss libnss-sss libpam-mklocaluser
189 The complete setup of sssd is done by editing/creating
190 <tt>/etc/sssd/sssd.conf
</tt>.
194 config_file_version =
2
195 reconnection_retries =
3
203 reconnection_retries =
3
206 reconnection_retries =
3
210 cache_credentials = true
214 chpass_provider = ldap
216 ldap_uri = ldap://ldap
217 ldap_search_base = dc=skole,dc=skolelinux,dc=no
218 ldap_tls_reqcert = never
219 ldap_tls_cacert = /etc/ssl/certs/ca-certificates.crt
222 <p>I got the same problem here with certificate checking. Had to set
223 "ldap_tls_reqcert = never" to get it working.
</p>
225 <p>With the libnss-sss package in testing at the moment, the
226 nsswitch.conf file is update automatically, so there is no need to
227 modify it manually.
</p>
229 <p>If you want to help out with implementing this for Debian Edu,
230 please contact us on debian-edu@lists.debian.org.
</p>
237 Tags:
<a href=
"http://people.skolelinux.org/pere/blog/tags/debian edu">debian edu
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/english">english
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/ldap">ldap
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/nuug">nuug
</a>.
241 <div class=
"padding"></div>
245 <a href=
"http://people.skolelinux.org/pere/blog/Lenny__Squeeze_upgrades__apt_vs_aptitude_with_the_Gnome_desktop.html">Lenny-
>Squeeze upgrades, apt vs aptitude with the Gnome desktop
</a>
253 <p>Here is a short update on my
<a
254 href=
"http://people.skolelinux.org/~pere/debian-upgrade-testing/">my
255 Debian Lenny-
>Squeeze upgrade testing
</a>. Here is a summary of the
256 difference for Gnome when it is upgraded by apt-get and aptitude. I'm
257 not reporting the status for KDE, because the upgrade crashes when
258 aptitude try because of missing conflicts
259 (
<a href=
"http://bugs.debian.org/584861">#
584861</a> and
260 <a href=
"http://bugs.debian.org/585716">#
585716</a>).
</p>
262 <p>At the end of the upgrade test script, dpkg -l is executed to get a
263 complete list of the installed packages. Based on this I see these
264 differences when I did a test run today. As usual, I do not really
265 know what the correct set of packages would be, but thought it best to
266 publish the difference.
</p>
268 <p>Installed using apt-get, missing with aptitude
</p>
271 at-spi cpp-
4.3 finger gnome-spell gstreamer0.10-gnomevfs
272 libatspi1.0-
0 libcupsys2 libeel2-data libgail-common libgdl-
1-common
273 libgnomeprint2.2-data libgnomeprintui2.2-common libgnomevfs2-bin
274 libgtksourceview-common libpt-
1.10.10-plugins-alsa
275 libpt-
1.10.10-plugins-v4l libservlet2.4-java libxalan2-java
276 libxerces2-java openoffice.org-writer2latex openssl-blacklist p7zip
277 python-
4suite-xml python-eggtrayicon python-gtkhtml2
278 python-gtkmozembed svgalibg1 xserver-xephyr zip
281 <p>Installed using apt-get, removed with aptitude
</p>
284 bluez-utils dhcdbd djvulibre-desktop epiphany-gecko
285 gnome-app-install gnome-mount gnome-vfs-obexftp gnome-volume-manager
286 libao2 libavahi-compat-libdnssd1 libavahi-core5 libbind9-
50
287 libbluetooth2 libcamel1.2-
11 libcdio7 libcucul0 libcurl3
288 libdirectfb-
1.0-
0 libdvdread3 libedata-cal1.2-
6 libedataserver1.2-
9
289 libeel2-
2.20 libepc-
1.0-
1 libepc-ui-
1.0-
1 libexchange-storage1.2-
3
290 libfaad0 libgd2-noxpm libgda3-
3 libgda3-common libggz2 libggzcore9
291 libggzmod4 libgksu1.2-
0 libgksuui1.0-
1 libgmyth0 libgnome-desktop-
2
292 libgnome-pilot2 libgnomecups1.0-
1 libgnomeprint2.2-
0
293 libgnomeprintui2.2-
0 libgpod3 libgraphviz4 libgtkhtml2-
0
294 libgtksourceview1.0-
0 libgucharmap6 libhesiod0 libicu38 libisccc50
295 libisccfg50 libiw29 libkpathsea4 libltdl3 liblwres50 libmagick++
10
296 libmagick10 libmalaga7 libmtp7 libmysqlclient15off libnautilus-burn4
297 libneon27 libnm-glib0 libnm-util0 libopal-
2.2 libosp5
298 libparted1.8-
10 libpisock9 libpisync1 libpoppler-glib3 libpoppler3
299 libpt-
1.10.10 libraw1394-
8 libsensors3 libsmbios2 libsoup2.2-
8
300 libssh2-
1 libsuitesparse-
3.1.0 libswfdec-
0.6-
90 libtalloc1
301 libtotem-plparser10 libtrackerclient0 libvoikko1 libxalan2-java-gcj
302 libxerces2-java-gcj libxklavier12 libxtrap6 libxxf86misc1 libzephyr3
303 mysql-common swfdec-gnome totem-gstreamer wodim
306 <p>Installed using aptitude, missing with apt-get
</p>
309 gnome gnome-desktop-environment hamster-applet python-gnomeapplet
310 python-gnomekeyring python-wnck rhythmbox-plugins xorg
311 xserver-xorg-input-all xserver-xorg-input-evdev
312 xserver-xorg-input-kbd xserver-xorg-input-mouse
313 xserver-xorg-input-synaptics xserver-xorg-video-all
314 xserver-xorg-video-apm xserver-xorg-video-ark xserver-xorg-video-ati
315 xserver-xorg-video-chips xserver-xorg-video-cirrus
316 xserver-xorg-video-dummy xserver-xorg-video-fbdev
317 xserver-xorg-video-glint xserver-xorg-video-i128
318 xserver-xorg-video-i740 xserver-xorg-video-mach64
319 xserver-xorg-video-mga xserver-xorg-video-neomagic
320 xserver-xorg-video-nouveau xserver-xorg-video-nv
321 xserver-xorg-video-r128 xserver-xorg-video-radeon
322 xserver-xorg-video-radeonhd xserver-xorg-video-rendition
323 xserver-xorg-video-s3 xserver-xorg-video-s3virge
324 xserver-xorg-video-savage xserver-xorg-video-siliconmotion
325 xserver-xorg-video-sis xserver-xorg-video-sisusb
326 xserver-xorg-video-tdfx xserver-xorg-video-tga
327 xserver-xorg-video-trident xserver-xorg-video-tseng
328 xserver-xorg-video-vesa xserver-xorg-video-vmware
329 xserver-xorg-video-voodoo
332 <p>Installed using aptitude, removed with apt-get
</p>
335 deskbar-applet xserver-xorg xserver-xorg-core
336 xserver-xorg-input-wacom xserver-xorg-video-intel
337 xserver-xorg-video-openchrome
340 <p>I was told on IRC that the xorg-xserver package was
341 <a href=
"http://git.debian.org/?p=pkg-xorg/xserver/xorg-server.git;a=commit;h=9c8080d06c457932d3bfec021c69ac000aa60120">changed
342 in git
</a> today to try to get apt-get to not remove xorg completely.
343 No idea when it hits Squeeze, but when it does I hope it will reduce
344 the difference somewhat.
351 Tags:
<a href=
"http://people.skolelinux.org/pere/blog/tags/debian">debian
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/debian edu">debian edu
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/english">english
</a>.
355 <div class=
"padding"></div>
359 <a href=
"http://people.skolelinux.org/pere/blog/MS_Word_kr__ller_det_til_for_politiet_.html">MS Word krøller det til for politiet?
</a>
367 <p>De siste dagene har Aftenposten
368 <a href=
"http://www.aftenposten.no/nyheter/iriks/article3718597.ece">fortalt
</a>
369 <a href=
"http://www.aftenposten.no/nyheter/iriks/article3724249.ece">hvordan
</a>
370 politet har brukt skriveverktøy som ikke håndterer arabisk tekst og
371 tekst som skal skrives fra høyre mot venstre når de har laget
372 løpeseddel for å be om informasjon fra publikum. Resultatet har vært
373 en uleselig arabisk-bit på løpeseddelen. Feilen har oppstått når
374 teksten har blitt "kopiert inn i programvare som ikke har støtte for
375 språk som skrives fra høyre mot venstre", og jeg er ganske sikker på
376 at det er snakk om Microsoft Office i dette tilfellet. Er det slik at
377 MS Office i norsk språkdrakt ikke har støtte for tekst som skal
378 skrives fra høyre mot venstre? Jeg tror alle utgaver av
379 OpenOffice.org har slik støtte, og det er jo ikke veldig vanskelig å
380 la slik støtte finnes i alle utgaver av et program hvis støtten først
381 er utviklet. Aftenpostens melding får meg til å undre om problemet
382 ville vært unngått hvis politiet brukte OpenOffice.org i stedet for MS
385 <p>Mon tro om det er flere eksempler på at MS Office har ødelagt for
386 offentlig myndighet?
</p>
393 Tags:
<a href=
"http://people.skolelinux.org/pere/blog/tags/norsk">norsk
</a>.
397 <div class=
"padding"></div>
401 <a href=
"http://people.skolelinux.org/pere/blog/jXplorer__a_very_nice_LDAP_GUI.html">jXplorer, a very nice LDAP GUI
</a>
410 <a href=
"http://people.skolelinux.org/pere/blog/LUMA__a_very_nice_LDAP_GUI.html">my
411 last post
</a> about available LDAP tools in Debian, I was told about a
412 LDAP GUI that is even better than luma. The java application
413 <a href=
"http://jxplorer.org/">jXplorer
</a> is claimed to be capable of
414 moving LDAP objects and subtrees using drag-and-drop, and can
415 authenticate using Kerberos. I have only tested the Kerberos
416 authentication, but do not have a LDAP setup allowing me to rewrite
417 LDAP with my test user yet. It is
418 <a href=
"http://packages.qa.debian.org/j/jxplorer.html">available in
419 Debian
</a> testing and unstable at the moment. The only problem I
420 have with it is how it handle errors. If something go wrong, its
421 non-intuitive behaviour require me to go through some query work list
422 and remove the failing query. Nothing big, but very annoying.
</p>
429 Tags:
<a href=
"http://people.skolelinux.org/pere/blog/tags/debian">debian
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/debian edu">debian edu
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/english">english
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/ldap">ldap
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/nuug">nuug
</a>.
433 <div class=
"padding"></div>
437 <a href=
"http://people.skolelinux.org/pere/blog/Idea_for_storing_LTSP_configuration_in_LDAP.html">Idea for storing LTSP configuration in LDAP
</a>
445 <p>Vagrant mentioned on IRC today that ltsp_config now support
446 sourcing files from /usr/share/ltsp/ltsp_config.d/ on the thin
447 clients, and that this can be used to fetch configuration from LDAP if
448 Debian Edu choose to store configuration there.
</p>
450 <p>Armed with this information, I got inspired and wrote a test module
451 to get configuration from LDAP. The idea is to look up the MAC
452 address of the client in LDAP, and look for attributes on the form
453 ltspconfigsetting=value, and use this to export SETTING=value to the
456 <p>The goal is to be able to store the LTSP configuration attributes
457 in a "computer" LDAP object used by both DNS and DHCP, and thus
458 allowing us to store all information about a computer in one place.
</p>
460 <p>This is a untested draft implementation, and I welcome feedback on
461 this approach. A real LDAP schema for the ltspClientAux objectclass
462 need to be written. Comments, suggestions, etc?
</p>
465 # Store in /opt/ltsp/$arch/usr/share/ltsp/ltsp_config.d/ldap-config
467 # Fetch LTSP client settings from LDAP based on MAC address
469 # Uses ethernet address as stored in the dhcpHost objectclass using
470 # the dhcpHWAddress attribute or ethernet address stored in the
471 # ieee802Device objectclass with the macAddress attribute.
473 # This module is written to be schema agnostic, and only depend on the
474 # existence of attribute names.
476 # The LTSP configuration variables are saved directly using a
477 # ltspConfig prefix and uppercasing the rest of the attribute name.
478 # To set the SERVER variable, set the ltspConfigServer attribute.
480 # Some LDAP schema should be created with all the relevant
481 # configuration settings. Something like this should work:
483 # objectclass (
1.1.2.2 NAME 'ltspClientAux'
486 # MAY ( ltspConfigServer $ ltsConfigSound $ ... )
488 LDAPSERVER=$(debian-edu-ldapserver)
489 if [ "$LDAPSERVER" ] ; then
490 LDAPBASE=$(debian-edu-ldapserver -b)
491 for MAC in $(LANG=C ifconfig |grep -i hwaddr| awk '{print $
5}'|sort -u) ; do
492 filter="(|(dhcpHWAddress=ethernet $MAC)(macAddress=$MAC))"
493 ldapsearch -h "$LDAPSERVER" -b "$LDAPBASE" -v -x "$filter" | \
494 grep '^ltspConfig' | while read attr value ; do
495 # Remove prefix and convert to upper case
496 attr=$(echo $attr | sed 's/^ltspConfig//i' | tr a-z A-Z)
497 # bass value on to clients
498 eval "$attr=$value; export $attr"
504 <p>I'm not sure this shell construction will work, because I suspect
505 the while block might end up in a subshell causing the variables set
506 there to not show up in ltsp-config, but if that is the case I am sure
507 the code can be restructured to make sure the variables are passed on.
508 I expect that can be solved with some testing. :)
</p>
510 <p>If you want to help out with implementing this for Debian Edu,
511 please contact us on debian-edu@lists.debian.org.
</p>
518 Tags:
<a href=
"http://people.skolelinux.org/pere/blog/tags/debian">debian
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/debian edu">debian edu
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/english">english
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/ldap">ldap
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/nuug">nuug
</a>.
522 <div class=
"padding"></div>
526 <a href=
"http://people.skolelinux.org/pere/blog/Combining_PowerDNS_and_ISC_DHCP_LDAP_objects.html">Combining PowerDNS and ISC DHCP LDAP objects
</a>
534 <p>For a while now, I have wanted to find a way to change the DNS and
535 DHCP services in Debian Edu to use the same LDAP objects for a given
536 computer, to avoid the possibility of having a inconsistent state for
537 a computer in LDAP (as in DHCP but no DNS entry or the other way
538 around) and make it easier to add computers to LDAP.
</p>
540 <p>I've looked at how powerdns and dhcpd is using LDAP, and using this
541 information finally found a solution that seem to work.
</p>
543 <p>The old setup required three LDAP objects for a given computer.
544 One forward DNS entry, one reverse DNS entry and one DHCP entry. If
545 we switch powerdns to use its strict LDAP method (ldap-method=strict
546 in pdns-debian-edu.conf), the forward and reverse DNS entries are
547 merged into one while making it impossible to transfer the reverse map
548 to a slave DNS server.
</p>
550 <p>If we also replace the object class used to get the DNS related
551 attributes to one allowing these attributes to be combined with the
552 dhcphost object class, we can merge the DNS and DHCP entries into one.
553 I've written such object class in the dnsdomainaux.schema file (need
554 proper OIDs, but that is a minor issue), and tested the setup. It
557 <p>With this test setup in place, we can get away with one LDAP object
558 for both DNS and DHCP, and even the LTSP configuration I suggested in
559 an earlier email. The combined LDAP object will look something like
563 dn: cn=hostname,cn=group1,cn=THINCLIENTS,cn=DHCP Config,dc=skole,dc=skolelinux,dc=no
565 objectClass: dhcphost
566 objectclass: domainrelatedobject
567 objectclass: dnsdomainaux
568 associateddomain: hostname.intern
570 dhcphwaddress: ethernet
00:
00:
00:
00:
00:
00
571 dhcpstatements: fixed-address hostname
575 <p>The DNS server uses the associateddomain and arecord entries, while
576 the DHCP server uses the dhcphwaddress and dhcpstatements entries
577 before asking DNS to resolve the fixed-adddress. LTSP will use
578 dhcphwaddress or associateddomain and the ldapconfig* attributes.
</p>
580 <p>I am not yet sure if I can get the DHCP server to look for its
581 dhcphost in a different location, to allow us to put the objects
582 outside the "DHCP Config" subtree, but hope to figure out a way to do
583 that. If I can't figure out a way to do that, we can still get rid of
584 the hosts subtree and move all its content into the DHCP Config tree
585 (which probably should be renamed to be more related to the new
586 content. I suspect cn=dnsdhcp,ou=services or something like that
587 might be a good place to put it.
</p>
589 <p>If you want to help out with implementing this for Debian Edu,
590 please contact us on debian-edu@lists.debian.org.
</p>
597 Tags:
<a href=
"http://people.skolelinux.org/pere/blog/tags/debian">debian
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/debian edu">debian edu
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/english">english
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/ldap">ldap
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/nuug">nuug
</a>.
601 <div class=
"padding"></div>
605 <a href=
"http://people.skolelinux.org/pere/blog/What_are_they_searching_for___PowerDNS_and_ISC_DHCP_in_LDAP.html">What are they searching for - PowerDNS and ISC DHCP in LDAP
</a>
614 <a href=
"http://people.skolelinux.org/pere/blog/Time_for_new__LDAP_schemas_replacing_RFC_2307_.html">followup
</a>
616 <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
618 <a href=
"http://people.skolelinux.org/pere/blog/Combining_PowerDNS_and_ISC_DHCP_LDAP_objects.html">merging
619 all
</a> the computer related LDAP objects in Debian Edu.
</p>
621 <p>As a step to try to see if it possible to merge the DNS and DHCP
622 LDAP objects, I have had a look at how the packages pdns-backend-ldap
623 and dhcp3-server-ldap in Debian use the LDAP server. The two
624 implementations are quite different in how they use LDAP.
</p>
626 To get this information, I started slapd with debugging enabled and
627 dumped the debug output to a file to get the LDAP searches performed
628 on a Debian Edu main-server. Here is a summary.
630 <p><strong>powerdns
</strong></p>
632 <a href=
"http://www.linuxnetworks.de/doc/index.php/PowerDNS_LDAP_Backend">Clues
633 on how to
</a> set up PowerDNS to use a LDAP backend is available on
636 <p>PowerDNS have two modes of operation using LDAP as its backend.
637 One "strict" mode where the forward and reverse DNS lookups are done
638 using the same LDAP objects, and a "tree" mode where the forward and
639 reverse entries are in two different subtrees in LDAP with a structure
640 based on the DNS names, as in tjener.intern and
641 2.2.0.10.in-addr.arpa.
</p>
643 <p>In tree mode, the server is set up to use a LDAP subtree as its
644 base, and uses a "base" scoped search for the DNS name by adding
645 "dc=tjener,dc=intern," to the base with a filter for
646 "(associateddomain=tjener.intern)" for the forward entry and
647 "dc=
2,dc=
2,dc=
0,dc=
10,dc=in-addr,dc=arpa," with a filter for
648 "(associateddomain=
2.2.0.10.in-addr.arpa)" for the reverse entry. For
649 forward entries, it is looking for attributes named dnsttl, arecord,
650 nsrecord, cnamerecord, soarecord, ptrrecord, hinforecord, mxrecord,
651 txtrecord, rprecord, afsdbrecord, keyrecord, aaaarecord, locrecord,
652 srvrecord, naptrrecord, kxrecord, certrecord, dsrecord, sshfprecord,
653 ipseckeyrecord, rrsigrecord, nsecrecord, dnskeyrecord, dhcidrecord,
654 spfrecord and modifytimestamp. For reverse entries it is looking for
655 the attributes dnsttl, arecord, nsrecord, cnamerecord, soarecord,
656 ptrrecord, hinforecord, mxrecord, txtrecord, rprecord, aaaarecord,
657 locrecord, srvrecord, naptrrecord and modifytimestamp. The equivalent
658 ldapsearch commands could look like this:
</p>
662 -b dc=tjener,dc=intern,ou=hosts,dc=skole,dc=skolelinux,dc=no \
663 -s base -x '(associateddomain=tjener.intern)' dNSTTL aRecord nSRecord \
664 cNAMERecord sOARecord pTRRecord hInfoRecord mXRecord tXTRecord \
665 rPRecord aFSDBRecord KeyRecord aAAARecord lOCRecord sRVRecord \
666 nAPTRRecord kXRecord certRecord dSRecord sSHFPRecord iPSecKeyRecord \
667 rRSIGRecord nSECRecord dNSKeyRecord dHCIDRecord sPFRecord modifyTimestamp
670 -b dc=
2,dc=
2,dc=
0,dc=
10,dc=in-addr,dc=arpa,ou=hosts,dc=skole,dc=skolelinux,dc=no \
671 -s base -x '(associateddomain=
2.2.0.10.in-addr.arpa)'
672 dnsttl, arecord, nsrecord, cnamerecord soarecord ptrrecord \
673 hinforecord mxrecord txtrecord rprecord aaaarecord locrecord \
674 srvrecord naptrrecord modifytimestamp
677 <p>In Debian Edu/Lenny, the PowerDNS tree mode is used with
678 ou=hosts,dc=skole,dc=skolelinux,dc=no as the base, and these are two
679 example LDAP objects used there. In addition to these objects, the
680 parent objects all th way up to ou=hosts,dc=skole,dc=skolelinux,dc=no
684 dn: dc=tjener,dc=intern,ou=hosts,dc=skole,dc=skolelinux,dc=no
686 objectclass: dnsdomain
687 objectclass: domainrelatedobject
690 associateddomain: tjener.intern
692 dn: dc=
2,dc=
2,dc=
0,dc=
10,dc=in-addr,dc=arpa,ou=hosts,dc=skole,dc=skolelinux,dc=no
694 objectclass: dnsdomain2
695 objectclass: domainrelatedobject
697 ptrrecord: tjener.intern
698 associateddomain:
2.2.0.10.in-addr.arpa
701 <p>In strict mode, the server behaves differently. When looking for
702 forward DNS entries, it is doing a "subtree" scoped search with the
703 same base as in the tree mode for a object with filter
704 "(associateddomain=tjener.intern)" and requests the attributes dnsttl,
705 arecord, nsrecord, cnamerecord, soarecord, ptrrecord, hinforecord,
706 mxrecord, txtrecord, rprecord, aaaarecord, locrecord, srvrecord,
707 naptrrecord and modifytimestamp. For reverse entires it also do a
708 subtree scoped search but this time the filter is "(arecord=
10.0.2.2)"
709 and the requested attributes are associateddomain, dnsttl and
710 modifytimestamp. In short, in strict mode the objects with ptrrecord
711 go away, and the arecord attribute in the forward object is used
714 <p>The forward and reverse searches can be simulated using ldapsearch
718 ldapsearch -h ldap -b ou=hosts,dc=skole,dc=skolelinux,dc=no -s sub -x \
719 '(associateddomain=tjener.intern)' dNSTTL aRecord nSRecord \
720 cNAMERecord sOARecord pTRRecord hInfoRecord mXRecord tXTRecord \
721 rPRecord aFSDBRecord KeyRecord aAAARecord lOCRecord sRVRecord \
722 nAPTRRecord kXRecord certRecord dSRecord sSHFPRecord iPSecKeyRecord \
723 rRSIGRecord nSECRecord dNSKeyRecord dHCIDRecord sPFRecord modifyTimestamp
725 ldapsearch -h ldap -b ou=hosts,dc=skole,dc=skolelinux,dc=no -s sub -x \
726 '(arecord=
10.0.2.2)' associateddomain dnsttl modifytimestamp
729 <p>In addition to the forward and reverse searches , there is also a
730 search for SOA records, which behave similar to the forward and
733 <p>A thing to note with the PowerDNS behaviour is that it do not
734 specify any objectclass names, and instead look for the attributes it
735 need to generate a DNS reply. This make it able to work with any
736 objectclass that provide the needed attributes.
</p>
738 <p>The attributes are normally provided in the cosine (RFC
1274) and
739 dnsdomain2 schemas. The latter is used for reverse entries like
740 ptrrecord and recent DNS additions like aaaarecord and srvrecord.
</p>
742 <p>In Debian Edu, we have created DNS objects using the object classes
743 dcobject (for dc), dnsdomain or dnsdomain2 (structural, for the DNS
744 attributes) and domainrelatedobject (for associatedDomain). The use
745 of structural object classes make it impossible to combine these
746 classes with the object classes used by DHCP.
</p>
748 <p>There are other schemas that could be used too, for example the
749 dnszone structural object class used by Gosa and bind-sdb for the DNS
750 attributes combined with the domainrelatedobject object class, but in
751 this case some unused attributes would have to be included as well
752 (zonename and relativedomainname).
</p>
754 <p>My proposal for Debian Edu would be to switch PowerDNS to strict
755 mode and not use any of the existing objectclasses (dnsdomain,
756 dnsdomain2 and dnszone) when one want to combine the DNS information
757 with DHCP information, and instead create a auxiliary object class
758 defined something like this (using the attributes defined for
759 dnsdomain and dnsdomain2 or dnszone):
</p>
762 objectclass ( some-oid NAME 'dnsDomainAux'
765 MAY ( ARecord $ MDRecord $ MXRecord $ NSRecord $ SOARecord $ CNAMERecord $
766 DNSTTL $ DNSClass $ PTRRecord $ HINFORecord $ MINFORecord $
767 TXTRecord $ SIGRecord $ KEYRecord $ AAAARecord $ LOCRecord $
768 NXTRecord $ SRVRecord $ NAPTRRecord $ KXRecord $ CERTRecord $
769 A6Record $ DNAMERecord
773 <p>This will allow any object to become a DNS entry when combined with
774 the domainrelatedobject object class, and allow any entity to include
775 all the attributes PowerDNS wants. I've sent an email to the PowerDNS
776 developers asking for their view on this schema and if they are
777 interested in providing such schema with PowerDNS, and I hope my
778 message will be accepted into their mailing list soon.
</p>
780 <p><strong>ISC dhcp
</strong></p>
782 <p>The DHCP server searches for specific objectclass and requests all
783 the object attributes, and then uses the attributes it want. This
784 make it harder to figure out exactly what attributes are used, but
785 thanks to the working example in Debian Edu I can at least get an idea
786 what is needed without having to read the source code.
</p>
788 <p>In the DHCP server configuration, the LDAP base to use and the
789 search filter to use to locate the correct dhcpServer entity is
790 stored. These are the relevant entries from
791 /etc/dhcp3/dhcpd.conf:
</p>
794 ldap-base-dn "dc=skole,dc=skolelinux,dc=no";
795 ldap-dhcp-server-cn "dhcp";
798 <p>The DHCP server uses this information to nest all the DHCP
799 configuration it need. The cn "dhcp" is located using the given LDAP
800 base and the filter "(&(objectClass=dhcpServer)(cn=dhcp))". The
801 search result is this entry:
</p>
804 dn: cn=dhcp,dc=skole,dc=skolelinux,dc=no
807 objectClass: dhcpServer
808 dhcpServiceDN: cn=DHCP Config,dc=skole,dc=skolelinux,dc=no
811 <p>The content of the dhcpServiceDN attribute is next used to locate the
812 subtree with DHCP configuration. The DHCP configuration subtree base
813 is located using a base scope search with base "cn=DHCP
814 Config,dc=skole,dc=skolelinux,dc=no" and filter
815 "(&(objectClass=dhcpService)(|(dhcpPrimaryDN=cn=dhcp,dc=skole,dc=skolelinux,dc=no)(dhcpSecondaryDN=cn=dhcp,dc=skole,dc=skolelinux,dc=no)))".
816 The search result is this entry:
</p>
819 dn: cn=DHCP Config,dc=skole,dc=skolelinux,dc=no
822 objectClass: dhcpService
823 objectClass: dhcpOptions
824 dhcpPrimaryDN: cn=dhcp, dc=skole,dc=skolelinux,dc=no
825 dhcpStatements: ddns-update-style none
826 dhcpStatements: authoritative
827 dhcpOption: smtp-server code
69 = array of ip-address
828 dhcpOption: www-server code
72 = array of ip-address
829 dhcpOption: wpad-url code
252 = text
832 <p>Next, the entire subtree is processed, one level at the time. When
833 all the DHCP configuration is loaded, it is ready to receive requests.
834 The subtree in Debian Edu contain objects with object classes
835 top/dhcpService/dhcpOptions, top/dhcpSharedNetwork/dhcpOptions,
836 top/dhcpSubnet, top/dhcpGroup and top/dhcpHost. These provide options
837 and information about netmasks, dynamic range etc. Leaving out the
838 details here because it is not relevant for the focus of my
839 investigation, which is to see if it is possible to merge dns and dhcp
840 related computer objects.
</p>
842 <p>When a DHCP request come in, LDAP is searched for the MAC address
843 of the client (
00:
00:
00:
00:
00:
00 in this example), using a subtree
844 scoped search with "cn=DHCP Config,dc=skole,dc=skolelinux,dc=no" as
845 the base and "(&(objectClass=dhcpHost)(dhcpHWAddress=ethernet
846 00:
00:
00:
00:
00:
00))" as the filter. This is what a host object look
850 dn: cn=hostname,cn=group1,cn=THINCLIENTS,cn=DHCP Config,dc=skole,dc=skolelinux,dc=no
853 objectClass: dhcpHost
854 dhcpHWAddress: ethernet
00:
00:
00:
00:
00:
00
855 dhcpStatements: fixed-address hostname
858 <p>There is less flexiblity in the way LDAP searches are done here.
859 The object classes need to have fixed names, and the configuration
860 need to be stored in a fairly specific LDAP structure. On the
861 positive side, the invidiual dhcpHost entires can be anywhere without
862 the DN pointed to by the dhcpServer entries. The latter should make
863 it possible to group all host entries in a subtree next to the
864 configuration entries, and this subtree can also be shared with the
865 DNS server if the schema proposed above is combined with the dhcpHost
866 structural object class.
868 <p><strong>Conclusion
</strong></p>
870 <p>The PowerDNS implementation seem to be very flexible when it come
871 to which LDAP schemas to use. While its "tree" mode is rigid when it
872 come to the the LDAP structure, the "strict" mode is very flexible,
873 allowing DNS objects to be stored anywhere under the base cn specified
874 in the configuration.
</p>
876 <p>The DHCP implementation on the other hand is very inflexible, both
877 regarding which LDAP schemas to use and which LDAP structure to use.
878 I guess one could implement ones own schema, as long as the
879 objectclasses and attributes have the names used, but this do not
880 really help when the DHCP subtree need to have a fairly fixed
883 <p>Based on the observed behaviour, I suspect a LDAP structure like
884 this might work for Debian Edu:
</p>
888 cn=machine-info (dhcpService) - dhcpServiceDN points here
890 cn=dhcp-internal (dhcpSharedNetwork/dhcpOptions)
891 cn=
10.0.2.0 (dhcpSubnet)
892 cn=group1 (dhcpGroup/dhcpOptions)
893 cn=dhcp-thinclients (dhcpSharedNetwork/dhcpOptions)
894 cn=
192.168.0.0 (dhcpSubnet)
895 cn=group1 (dhcpGroup/dhcpOptions)
896 ou=machines - PowerDNS base points here
897 cn=hostname (dhcpHost/domainrelatedobject/dnsDomainAux)
900 <P>This is not tested yet. If the DHCP server require the dhcpHost
901 entries to be in the dhcpGroup subtrees, the entries can be stored
902 there instead of a common machines subtree, and the PowerDNS base
903 would have to be moved one level up to the machine-info subtree.
</p>
905 <p>The combined object under the machines subtree would look something
909 dn: dc=hostname,ou=machines,cn=machine-info,dc=skole,dc=skolelinux,dc=no
912 objectClass: dhcpHost
913 objectclass: domainrelatedobject
914 objectclass: dnsDomainAux
915 associateddomain: hostname.intern
917 dhcpHWAddress: ethernet
00:
00:
00:
00:
00:
00
918 dhcpStatements: fixed-address hostname.intern
921 </p>One could even add the LTSP configuration associated with a given
922 machine, as long as the required attributes are available in a
923 auxiliary object class.
</p>
930 Tags:
<a href=
"http://people.skolelinux.org/pere/blog/tags/debian">debian
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/debian edu">debian edu
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/english">english
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/ldap">ldap
</a>,
<a href=
"http://people.skolelinux.org/pere/blog/tags/nuug">nuug
</a>.
934 <div class=
"padding"></div>
936 <p style=
"text-align: right;"><a href=
"07.rss"><img src=
"http://people.skolelinux.org/pere/blog/xml.gif" alt=
"RSS Feed" width=
"36" height=
"14"></a></p>
948 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/01/">January (
2)
</a></li>
950 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/02/">February (
1)
</a></li>
952 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/03/">March (
3)
</a></li>
954 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/04/">April (
3)
</a></li>
956 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/05/">May (
9)
</a></li>
958 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/06/">June (
14)
</a></li>
960 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/07/">July (
7)
</a></li>
967 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/01/">January (
8)
</a></li>
969 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/02/">February (
8)
</a></li>
971 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/03/">March (
12)
</a></li>
973 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/04/">April (
10)
</a></li>
975 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/05/">May (
9)
</a></li>
977 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/06/">June (
3)
</a></li>
979 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/07/">July (
4)
</a></li>
981 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/08/">August (
3)
</a></li>
983 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/09/">September (
1)
</a></li>
985 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/10/">October (
2)
</a></li>
987 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/11/">November (
3)
</a></li>
989 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/12/">December (
3)
</a></li>
996 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2008/11/">November (
5)
</a></li>
998 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2008/12/">December (
7)
</a></li>
1009 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/3d-printer">3d-printer (
11)
</a></li>
1011 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/amiga">amiga (
1)
</a></li>
1013 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/aros">aros (
1)
</a></li>
1015 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/bootsystem">bootsystem (
10)
</a></li>
1017 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/debian">debian (
34)
</a></li>
1019 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/debian edu">debian edu (
34)
</a></li>
1021 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/english">english (
47)
</a></li>
1023 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/fiksgatami">fiksgatami (
1)
</a></li>
1025 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/fildeling">fildeling (
7)
</a></li>
1027 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/kart">kart (
2)
</a></li>
1029 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/ldap">ldap (
8)
</a></li>
1031 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/lenker">lenker (
1)
</a></li>
1033 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/ltsp">ltsp (
1)
</a></li>
1035 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/multimedia">multimedia (
5)
</a></li>
1037 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/norsk">norsk (
70)
</a></li>
1039 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/nuug">nuug (
84)
</a></li>
1041 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/opphavsrett">opphavsrett (
13)
</a></li>
1043 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/personvern">personvern (
13)
</a></li>
1045 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/reprap">reprap (
10)
</a></li>
1047 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/rss">rss (
1)
</a></li>
1049 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/sikkerhet">sikkerhet (
9)
</a></li>
1051 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/sitesummary">sitesummary (
3)
</a></li>
1053 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/standard">standard (
13)
</a></li>
1055 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/stavekontroll">stavekontroll (
1)
</a></li>
1057 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/video">video (
10)
</a></li>
1059 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/vitenskap">vitenskap (
1)
</a></li>
1061 <li><a href=
"http://people.skolelinux.org/pere/blog/tags/web">web (
6)
</a></li>