1 <?xml version=
"1.0" encoding=
"ISO-8859-1"?>
2 <rss version='
2.0' xmlns:lj='http://www.livejournal.org/rss/lj/
1.0/'
>
4 <title>Petter Reinholdtsen - Entries from July
2010</title>
5 <description>Entries from July
2010</description>
6 <link>http://people.skolelinux.org/pere/blog/
</link>
10 <title>Caching password, user and group on a roaming Debian laptop
</title>
11 <link>http://people.skolelinux.org/pere/blog/Caching_password__user_and_group_on_a_roaming_Debian_laptop.html
</link>
12 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Caching_password__user_and_group_on_a_roaming_Debian_laptop.html
</guid>
13 <pubDate>Thu,
1 Jul
2010 11:
40:
00 +
0200</pubDate>
15 <p
>For a laptop, centralized user directories and password checking is
16 a bit troubling. Laptops are typically used also when not connected
17 to the network, and it is vital for a user to be able to log in or
18 unlock the screen saver also when a central server is unavailable.
19 This is possible by caching passwords and directory information (user
20 and group attributes) locally, and the packages to do so are available
21 in Debian. Here follow two recipes to set this up in Debian/Squeeze.
22 It is also possible to set up in Debian/Lenny, but require more manual
23 setup there because pam-auth-update is missing in Lenny.
</p
>
25 <h2
>LDAP/Kerberos + nscd + libpam-ccreds + libpam-mklocaluser/pam_mkhomedir
</h2
>
27 This is the traditional method with a twist. The password caching is
28 provided by libpam-ccreds (version
10-
4 or later is needed on
29 Squeeze), and the directory caching is done by nscd. The directory
30 lookup and password checking is done using LDAP. If one want to use
31 Kerberos for password checking the libpam-ldapd package can be
32 replaced with libpam-krb5 or libpam-heimdal. If one is happy having a
33 local home directory with the path listed in LDAP, one can use the
34 pam_mkhomedir module from pam-modules to make this happen instead of
35 using libpam-mklocaluser. A setup for pam-auth-update to enable
36 pam_mkhomedir will have to be written until a fix for
37 <a href=
"http://bugs.debian.org/
568577">bug #
568577</a
> is in the
38 archive. Because I believe it is a bad idea to have local home
39 directories using misleading paths like /site/server/partition/, I
40 prefer to create a local user with the home directory in /home/. This
41 is done using the libpam-mklocaluser package.
</p
>
43 <p
>These packages need to be installed and configured
</p
>
45 <blockquote
><pre
>
46 libnss-ldapd libpam-ldapd nscd libpam-ccreds libpam-mklocaluser
47 </pre
></blockquote
>
49 <p
>The ldapd packages will ask for LDAP connection information, and
50 one have to fill in the values that fits ones own site. Make sure the
51 PAM part uses encrypted connections, to make sure the password is not
52 sent in clear text to the LDAP server. I
've been unable to get TLS
53 certificate checking for a self signed certificate working, which make
54 LDAP authentication unsafe for Debian Edu (nslcd is not checking if it
55 is talking to the correct LDAP server), and very much welcome feedback
56 on how to get this working.
</p
>
58 <p
>Because nscd do not have a default configuration fit for offline
59 caching until
<a href=
"http://bugs.debian.org/
485282">bug #
485282</a
>
60 is fixed, this configuration should be used instead of the one
61 currently in /etc/nscd.conf. The changes are in the fields
62 reload-count and positive-time-to-live, and is based on the
63 instructions I found in the
64 <a href=
"http://www.flyn.org/laptopldap/
">LDAP for Mobile Laptops
</a
>
65 instructions by Flyn Computing.
</p
>
67 <blockquote
><pre
>
69 reload-count unlimited
72 enable-cache passwd yes
73 positive-time-to-live passwd
2592000
74 negative-time-to-live passwd
20
75 suggested-size passwd
211
76 check-files passwd yes
79 max-db-size passwd
33554432
80 auto-propagate passwd yes
82 enable-cache group yes
83 positive-time-to-live group
2592000
84 negative-time-to-live group
20
85 suggested-size group
211
89 max-db-size group
33554432
90 auto-propagate group yes
93 positive-time-to-live hosts
2592000
94 negative-time-to-live hosts
20
95 suggested-size hosts
211
99 max-db-size hosts
33554432
101 enable-cache services yes
102 positive-time-to-live services
2592000
103 negative-time-to-live services
20
104 suggested-size services
211
105 check-files services yes
106 persistent services yes
108 max-db-size services
33554432
109 </pre
></blockquote
>
111 <p
>While we wait for a mechanism to update /etc/nsswitch.conf
112 automatically like the one provided in
113 <a href=
"http://bugs.debian.org/
496915">bug #
496915</a
>, the file
114 content need to be manually replaced to ensure LDAP is used as the
115 directory service on the machine. /etc/nsswitch.conf should normally
116 look like this:
</p
>
118 <blockquote
><pre
>
122 hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
129 </pre
></blockquote
>
131 <p
>The important parts are that ldap is listed last for passwd, group,
132 shadow and netgroup.
</p
>
134 <p
>With these changes in place, any user in LDAP will be able to log
135 in locally on the machine using for example kdm, get a local home
136 directory created and have the password as well as user and group
139 <h2
>LDAP/Kerberos + nss-updatedb + libpam-ccreds +
140 libpam-mklocaluser/pam_mkhomedir
</h2
>
142 <p
>Because nscd have had its share of problems, and seem to have
143 problems doing proper caching, I
've seen suggestions and recipes to
144 use nss-updatedb to copy parts of the LDAP database locally when the
145 LDAP database is available. I have not tested such setup, because I
146 discovered sssd.
</p
>
148 <h2
>LDAP/Kerberos + sssd + libpam-mklocaluser
</h2
>
150 <p
>A more flexible and robust setup than the nscd combination
151 mentioned earlier that has shown up recently, is the
152 <a href=
"https://fedorahosted.org/sssd/
">sssd
</a
> package from Redhat.
153 It is part of the
<a href=
"http://www.freeipa.org/
">FreeIPA
</A
> project
154 to provide a Active Directory like directory service for Linux
155 machines. The sssd system combines the caching of passwords and user
156 information into one package, and remove the need for nscd and
157 libpam-ccreds. It support LDAP and Kerberos, but not NIS. Version
158 1.2 do not support netgroups, but it is said that it will support this
159 in version
1.5 expected to show up later in
2010. Because the
160 <a href=
"http://packages.qa.debian.org/s/sssd.html
">sssd package
</a
>
161 was missing in Debian, I ended up co-maintaining it with Werner, and
162 version
1.2 is now in testing.
164 <p
>These packages need to be installed and configured to get the
165 roaming setup I want
</p
>
167 <blockquote
><pre
>
168 libpam-sss libnss-sss libpam-mklocaluser
169 </pre
></blockquote
>
171 The complete setup of sssd is done by editing/creating
172 <tt
>/etc/sssd/sssd.conf
</tt
>.
174 <blockquote
><pre
>
176 config_file_version =
2
177 reconnection_retries =
3
185 reconnection_retries =
3
188 reconnection_retries =
3
192 cache_credentials = true
196 chpass_provider = ldap
198 ldap_uri = ldap://ldap
199 ldap_search_base = dc=skole,dc=skolelinux,dc=no
200 ldap_tls_reqcert = never
201 ldap_tls_cacert = /etc/ssl/certs/ca-certificates.crt
202 </pre
></blockquote
>
204 <p
>I got the same problem here with certificate checking. Had to set
205 "ldap_tls_reqcert = never
" to get it working.
</p
>
207 <p
>With the libnss-sss package in testing at the moment, the
208 nsswitch.conf file is update automatically, so there is no need to
209 modify it manually.
</p
>
211 <p
>If you want to help out with implementing this for Debian Edu,
212 please contact us on debian-edu@lists.debian.org.
</p
>
217 <title>Lenny-
>Squeeze upgrades, apt vs aptitude with the Gnome desktop
</title>
218 <link>http://people.skolelinux.org/pere/blog/Lenny__Squeeze_upgrades__apt_vs_aptitude_with_the_Gnome_desktop.html
</link>
219 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Lenny__Squeeze_upgrades__apt_vs_aptitude_with_the_Gnome_desktop.html
</guid>
220 <pubDate>Sat,
3 Jul
2010 23:
55:
00 +
0200</pubDate>
222 <p
>Here is a short update on my
<a
223 href=
"http://people.skolelinux.org/~pere/debian-upgrade-testing/
">my
224 Debian Lenny-
>Squeeze upgrade testing
</a
>. Here is a summary of the
225 difference for Gnome when it is upgraded by apt-get and aptitude. I
'm
226 not reporting the status for KDE, because the upgrade crashes when
227 aptitude try because of missing conflicts
228 (
<a href=
"http://bugs.debian.org/
584861">#
584861</a
> and
229 <a href=
"http://bugs.debian.org/
585716">#
585716</a
>).
</p
>
231 <p
>At the end of the upgrade test script, dpkg -l is executed to get a
232 complete list of the installed packages. Based on this I see these
233 differences when I did a test run today. As usual, I do not really
234 know what the correct set of packages would be, but thought it best to
235 publish the difference.
</p
>
237 <p
>Installed using apt-get, missing with aptitude
</p
>
239 <blockquote
><p
>
240 at-spi cpp-
4.3 finger gnome-spell gstreamer0.10-gnomevfs
241 libatspi1.0-
0 libcupsys2 libeel2-data libgail-common libgdl-
1-common
242 libgnomeprint2.2-data libgnomeprintui2.2-common libgnomevfs2-bin
243 libgtksourceview-common libpt-
1.10.10-plugins-alsa
244 libpt-
1.10.10-plugins-v4l libservlet2.4-java libxalan2-java
245 libxerces2-java openoffice.org-writer2latex openssl-blacklist p7zip
246 python-
4suite-xml python-eggtrayicon python-gtkhtml2
247 python-gtkmozembed svgalibg1 xserver-xephyr zip
248 </p
></blockquote
>
250 <p
>Installed using apt-get, removed with aptitude
</p
>
252 <blockquote
><p
>
253 bluez-utils dhcdbd djvulibre-desktop epiphany-gecko
254 gnome-app-install gnome-mount gnome-vfs-obexftp gnome-volume-manager
255 libao2 libavahi-compat-libdnssd1 libavahi-core5 libbind9-
50
256 libbluetooth2 libcamel1.2-
11 libcdio7 libcucul0 libcurl3
257 libdirectfb-
1.0-
0 libdvdread3 libedata-cal1.2-
6 libedataserver1.2-
9
258 libeel2-
2.20 libepc-
1.0-
1 libepc-ui-
1.0-
1 libexchange-storage1.2-
3
259 libfaad0 libgd2-noxpm libgda3-
3 libgda3-common libggz2 libggzcore9
260 libggzmod4 libgksu1.2-
0 libgksuui1.0-
1 libgmyth0 libgnome-desktop-
2
261 libgnome-pilot2 libgnomecups1.0-
1 libgnomeprint2.2-
0
262 libgnomeprintui2.2-
0 libgpod3 libgraphviz4 libgtkhtml2-
0
263 libgtksourceview1.0-
0 libgucharmap6 libhesiod0 libicu38 libisccc50
264 libisccfg50 libiw29 libkpathsea4 libltdl3 liblwres50 libmagick++
10
265 libmagick10 libmalaga7 libmtp7 libmysqlclient15off libnautilus-burn4
266 libneon27 libnm-glib0 libnm-util0 libopal-
2.2 libosp5
267 libparted1.8-
10 libpisock9 libpisync1 libpoppler-glib3 libpoppler3
268 libpt-
1.10.10 libraw1394-
8 libsensors3 libsmbios2 libsoup2.2-
8
269 libssh2-
1 libsuitesparse-
3.1.0 libswfdec-
0.6-
90 libtalloc1
270 libtotem-plparser10 libtrackerclient0 libvoikko1 libxalan2-java-gcj
271 libxerces2-java-gcj libxklavier12 libxtrap6 libxxf86misc1 libzephyr3
272 mysql-common swfdec-gnome totem-gstreamer wodim
273 </p
></blockquote
>
275 <p
>Installed using aptitude, missing with apt-get
</p
>
277 <blockquote
><p
>
278 gnome gnome-desktop-environment hamster-applet python-gnomeapplet
279 python-gnomekeyring python-wnck rhythmbox-plugins xorg
280 xserver-xorg-input-all xserver-xorg-input-evdev
281 xserver-xorg-input-kbd xserver-xorg-input-mouse
282 xserver-xorg-input-synaptics xserver-xorg-video-all
283 xserver-xorg-video-apm xserver-xorg-video-ark xserver-xorg-video-ati
284 xserver-xorg-video-chips xserver-xorg-video-cirrus
285 xserver-xorg-video-dummy xserver-xorg-video-fbdev
286 xserver-xorg-video-glint xserver-xorg-video-i128
287 xserver-xorg-video-i740 xserver-xorg-video-mach64
288 xserver-xorg-video-mga xserver-xorg-video-neomagic
289 xserver-xorg-video-nouveau xserver-xorg-video-nv
290 xserver-xorg-video-r128 xserver-xorg-video-radeon
291 xserver-xorg-video-radeonhd xserver-xorg-video-rendition
292 xserver-xorg-video-s3 xserver-xorg-video-s3virge
293 xserver-xorg-video-savage xserver-xorg-video-siliconmotion
294 xserver-xorg-video-sis xserver-xorg-video-sisusb
295 xserver-xorg-video-tdfx xserver-xorg-video-tga
296 xserver-xorg-video-trident xserver-xorg-video-tseng
297 xserver-xorg-video-vesa xserver-xorg-video-vmware
298 xserver-xorg-video-voodoo
299 </p
></blockquote
>
301 <p
>Installed using aptitude, removed with apt-get
</p
>
303 <blockquote
><p
>
304 deskbar-applet xserver-xorg xserver-xorg-core
305 xserver-xorg-input-wacom xserver-xorg-video-intel
306 xserver-xorg-video-openchrome
307 </p
></blockquote
>
309 <p
>I was told on IRC that the xorg-xserver package was
310 <a href=
"http://git.debian.org/?p=pkg-xorg/xserver/xorg-server.git;a=commit;h=
9c8080d06c457932d3bfec021c69ac000aa60120
">changed
311 in git
</a
> today to try to get apt-get to not remove xorg completely.
312 No idea when it hits Squeeze, but when it does I hope it will reduce
313 the difference somewhat.
318 <title>MS Word krøller det til for politiet?
</title>
319 <link>http://people.skolelinux.org/pere/blog/MS_Word_kr__ller_det_til_for_politiet_.html
</link>
320 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/MS_Word_kr__ller_det_til_for_politiet_.html
</guid>
321 <pubDate>Thu,
8 Jul
2010 14:
00:
00 +
0200</pubDate>
323 <p
>De siste dagene har Aftenposten
324 <a href=
"http://www.aftenposten.no/nyheter/iriks/article3718597.ece
">fortalt
</a
>
325 <a href=
"http://www.aftenposten.no/nyheter/iriks/article3724249.ece
">hvordan
</a
>
326 politet har brukt skriveverktøy som ikke håndterer arabisk tekst og
327 tekst som skal skrives fra høyre mot venstre når de har laget
328 løpeseddel for å be om informasjon fra publikum. Resultatet har vært
329 en uleselig arabisk-bit på løpeseddelen. Feilen har oppstått når
330 teksten har blitt
"kopiert inn i programvare som ikke har støtte for
331 språk som skrives fra høyre mot venstre
", og jeg er ganske sikker på
332 at det er snakk om Microsoft Office i dette tilfellet. Er det slik at
333 MS Office i norsk språkdrakt ikke har støtte for tekst som skal
334 skrives fra høyre mot venstre? Jeg tror alle utgaver av
335 OpenOffice.org har slik støtte, og det er jo ikke veldig vanskelig å
336 la slik støtte finnes i alle utgaver av et program hvis støtten først
337 er utviklet. Aftenpostens melding får meg til å undre om problemet
338 ville vært unngått hvis politiet brukte OpenOffice.org i stedet for MS
341 <p
>Mon tro om det er flere eksempler på at MS Office har ødelagt for
342 offentlig myndighet?
</p
>
347 <title>jXplorer, a very nice LDAP GUI
</title>
348 <link>http://people.skolelinux.org/pere/blog/jXplorer__a_very_nice_LDAP_GUI.html
</link>
349 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/jXplorer__a_very_nice_LDAP_GUI.html
</guid>
350 <pubDate>Fri,
9 Jul
2010 12:
55:
00 +
0200</pubDate>
353 <a href=
"http://people.skolelinux.org/pere/blog/LUMA__a_very_nice_LDAP_GUI.html
">my
354 last post
</a
> about available LDAP tools in Debian, I was told about a
355 LDAP GUI that is even better than luma. The java application
356 <a href=
"http://jxplorer.org/
">jXplorer
</a
> is claimed to be capable of
357 moving LDAP objects and subtrees using drag-and-drop, and can
358 authenticate using Kerberos. I have only tested the Kerberos
359 authentication, but do not have a LDAP setup allowing me to rewrite
360 LDAP with my test user yet. It is
361 <a href=
"http://packages.qa.debian.org/j/jxplorer.html
">available in
362 Debian
</a
> testing and unstable at the moment. The only problem I
363 have with it is how it handle errors. If something go wrong, its
364 non-intuitive behaviour require me to go through some query work list
365 and remove the failing query. Nothing big, but very annoying.
</p
>
370 <title>Idea for storing LTSP configuration in LDAP
</title>
371 <link>http://people.skolelinux.org/pere/blog/Idea_for_storing_LTSP_configuration_in_LDAP.html
</link>
372 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Idea_for_storing_LTSP_configuration_in_LDAP.html
</guid>
373 <pubDate>Sun,
11 Jul
2010 22:
00:
00 +
0200</pubDate>
375 <p
>Vagrant mentioned on IRC today that ltsp_config now support
376 sourcing files from /usr/share/ltsp/ltsp_config.d/ on the thin
377 clients, and that this can be used to fetch configuration from LDAP if
378 Debian Edu choose to store configuration there.
</p
>
380 <p
>Armed with this information, I got inspired and wrote a test module
381 to get configuration from LDAP. The idea is to look up the MAC
382 address of the client in LDAP, and look for attributes on the form
383 ltspconfigsetting=value, and use this to export SETTING=value to the
384 LTSP clients.
</p
>
386 <p
>The goal is to be able to store the LTSP configuration attributes
387 in a
"computer
" LDAP object used by both DNS and DHCP, and thus
388 allowing us to store all information about a computer in one place.
</p
>
390 <p
>This is a untested draft implementation, and I welcome feedback on
391 this approach. A real LDAP schema for the ltspClientAux objectclass
392 need to be written. Comments, suggestions, etc?
</p
>
394 <blockquote
><pre
>
395 # Store in /opt/ltsp/$arch/usr/share/ltsp/ltsp_config.d/ldap-config
397 # Fetch LTSP client settings from LDAP based on MAC address
399 # Uses ethernet address as stored in the dhcpHost objectclass using
400 # the dhcpHWAddress attribute or ethernet address stored in the
401 # ieee802Device objectclass with the macAddress attribute.
403 # This module is written to be schema agnostic, and only depend on the
404 # existence of attribute names.
406 # The LTSP configuration variables are saved directly using a
407 # ltspConfig prefix and uppercasing the rest of the attribute name.
408 # To set the SERVER variable, set the ltspConfigServer attribute.
410 # Some LDAP schema should be created with all the relevant
411 # configuration settings. Something like this should work:
413 # objectclass (
1.1.2.2 NAME
'ltspClientAux
'
416 # MAY ( ltspConfigServer $ ltsConfigSound $ ... )
418 LDAPSERVER=$(debian-edu-ldapserver)
419 if [
"$LDAPSERVER
" ] ; then
420 LDAPBASE=$(debian-edu-ldapserver -b)
421 for MAC in $(LANG=C ifconfig |grep -i hwaddr| awk
'{print $
5}
'|sort -u) ; do
422 filter=
"(|(dhcpHWAddress=ethernet $MAC)(macAddress=$MAC))
"
423 ldapsearch -h
"$LDAPSERVER
" -b
"$LDAPBASE
" -v -x
"$filter
" | \
424 grep
'^ltspConfig
' | while read attr value ; do
425 # Remove prefix and convert to upper case
426 attr=$(echo $attr | sed
's/^ltspConfig//i
' | tr a-z A-Z)
427 # bass value on to clients
428 eval
"$attr=$value; export $attr
"
432 </pre
></blockquote
>
434 <p
>I
'm not sure this shell construction will work, because I suspect
435 the while block might end up in a subshell causing the variables set
436 there to not show up in ltsp-config, but if that is the case I am sure
437 the code can be restructured to make sure the variables are passed on.
438 I expect that can be solved with some testing. :)
</p
>
440 <p
>If you want to help out with implementing this for Debian Edu,
441 please contact us on debian-edu@lists.debian.org.
</p
>
446 <title>Combining PowerDNS and ISC DHCP LDAP objects
</title>
447 <link>http://people.skolelinux.org/pere/blog/Combining_PowerDNS_and_ISC_DHCP_LDAP_objects.html
</link>
448 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Combining_PowerDNS_and_ISC_DHCP_LDAP_objects.html
</guid>
449 <pubDate>Wed,
14 Jul
2010 23:
45:
00 +
0200</pubDate>
451 <p
>For a while now, I have wanted to find a way to change the DNS and
452 DHCP services in Debian Edu to use the same LDAP objects for a given
453 computer, to avoid the possibility of having a inconsistent state for
454 a computer in LDAP (as in DHCP but no DNS entry or the other way
455 around) and make it easier to add computers to LDAP.
</p
>
457 <p
>I
've looked at how powerdns and dhcpd is using LDAP, and using this
458 information finally found a solution that seem to work.
</p
>
460 <p
>The old setup required three LDAP objects for a given computer.
461 One forward DNS entry, one reverse DNS entry and one DHCP entry. If
462 we switch powerdns to use its strict LDAP method (ldap-method=strict
463 in pdns-debian-edu.conf), the forward and reverse DNS entries are
464 merged into one while making it impossible to transfer the reverse map
465 to a slave DNS server.
</p
>
467 <p
>If we also replace the object class used to get the DNS related
468 attributes to one allowing these attributes to be combined with the
469 dhcphost object class, we can merge the DNS and DHCP entries into one.
470 I
've written such object class in the dnsdomainaux.schema file (need
471 proper OIDs, but that is a minor issue), and tested the setup. It
472 seem to work.
</p
>
474 <p
>With this test setup in place, we can get away with one LDAP object
475 for both DNS and DHCP, and even the LTSP configuration I suggested in
476 an earlier email. The combined LDAP object will look something like
479 <blockquote
><pre
>
480 dn: cn=hostname,cn=group1,cn=THINCLIENTS,cn=DHCP Config,dc=skole,dc=skolelinux,dc=no
482 objectClass: dhcphost
483 objectclass: domainrelatedobject
484 objectclass: dnsdomainaux
485 associateddomain: hostname.intern
487 dhcphwaddress: ethernet
00:
00:
00:
00:
00:
00
488 dhcpstatements: fixed-address hostname
490 </pre
></blockquote
>
492 <p
>The DNS server uses the associateddomain and arecord entries, while
493 the DHCP server uses the dhcphwaddress and dhcpstatements entries
494 before asking DNS to resolve the fixed-adddress. LTSP will use
495 dhcphwaddress or associateddomain and the ldapconfig* attributes.
</p
>
497 <p
>I am not yet sure if I can get the DHCP server to look for its
498 dhcphost in a different location, to allow us to put the objects
499 outside the
"DHCP Config
" subtree, but hope to figure out a way to do
500 that. If I can
't figure out a way to do that, we can still get rid of
501 the hosts subtree and move all its content into the DHCP Config tree
502 (which probably should be renamed to be more related to the new
503 content. I suspect cn=dnsdhcp,ou=services or something like that
504 might be a good place to put it.
</p
>
506 <p
>If you want to help out with implementing this for Debian Edu,
507 please contact us on debian-edu@lists.debian.org.
</p
>
512 <title>What are they searching for - PowerDNS and ISC DHCP in LDAP
</title>
513 <link>http://people.skolelinux.org/pere/blog/What_are_they_searching_for___PowerDNS_and_ISC_DHCP_in_LDAP.html
</link>
514 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/What_are_they_searching_for___PowerDNS_and_ISC_DHCP_in_LDAP.html
</guid>
515 <pubDate>Sat,
17 Jul
2010 21:
00:
00 +
0200</pubDate>
518 <a href=
"http://people.skolelinux.org/pere/blog/Time_for_new__LDAP_schemas_replacing_RFC_2307_.html
">followup
</a
>
520 <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
522 <a href=
"http://people.skolelinux.org/pere/blog/Combining_PowerDNS_and_ISC_DHCP_LDAP_objects.html
">merging
523 all
</a
> the computer related LDAP objects in Debian Edu.
</p
>
525 <p
>As a step to try to see if it possible to merge the DNS and DHCP
526 LDAP objects, I have had a look at how the packages pdns-backend-ldap
527 and dhcp3-server-ldap in Debian use the LDAP server. The two
528 implementations are quite different in how they use LDAP.
</p
>
530 To get this information, I started slapd with debugging enabled and
531 dumped the debug output to a file to get the LDAP searches performed
532 on a Debian Edu main-server. Here is a summary.
534 <p
><strong
>powerdns
</strong
></p
>
536 <a href=
"http://www.linuxnetworks.de/doc/index.php/PowerDNS_LDAP_Backend
">Clues
537 on how to
</a
> set up PowerDNS to use a LDAP backend is available on
540 <p
>PowerDNS have two modes of operation using LDAP as its backend.
541 One
"strict
" mode where the forward and reverse DNS lookups are done
542 using the same LDAP objects, and a
"tree
" mode where the forward and
543 reverse entries are in two different subtrees in LDAP with a structure
544 based on the DNS names, as in tjener.intern and
545 2.2.0.10.in-addr.arpa.
</p
>
547 <p
>In tree mode, the server is set up to use a LDAP subtree as its
548 base, and uses a
"base
" scoped search for the DNS name by adding
549 "dc=tjener,dc=intern,
" to the base with a filter for
550 "(associateddomain=tjener.intern)
" for the forward entry and
551 "dc=
2,dc=
2,dc=
0,dc=
10,dc=in-addr,dc=arpa,
" with a filter for
552 "(associateddomain=
2.2.0.10.in-addr.arpa)
" for the reverse entry. For
553 forward entries, it is looking for attributes named dnsttl, arecord,
554 nsrecord, cnamerecord, soarecord, ptrrecord, hinforecord, mxrecord,
555 txtrecord, rprecord, afsdbrecord, keyrecord, aaaarecord, locrecord,
556 srvrecord, naptrrecord, kxrecord, certrecord, dsrecord, sshfprecord,
557 ipseckeyrecord, rrsigrecord, nsecrecord, dnskeyrecord, dhcidrecord,
558 spfrecord and modifytimestamp. For reverse entries it is looking for
559 the attributes dnsttl, arecord, nsrecord, cnamerecord, soarecord,
560 ptrrecord, hinforecord, mxrecord, txtrecord, rprecord, aaaarecord,
561 locrecord, srvrecord, naptrrecord and modifytimestamp. The equivalent
562 ldapsearch commands could look like this:
</p
>
564 <blockquote
><pre
>
566 -b dc=tjener,dc=intern,ou=hosts,dc=skole,dc=skolelinux,dc=no \
567 -s base -x
'(associateddomain=tjener.intern)
' dNSTTL aRecord nSRecord \
568 cNAMERecord sOARecord pTRRecord hInfoRecord mXRecord tXTRecord \
569 rPRecord aFSDBRecord KeyRecord aAAARecord lOCRecord sRVRecord \
570 nAPTRRecord kXRecord certRecord dSRecord sSHFPRecord iPSecKeyRecord \
571 rRSIGRecord nSECRecord dNSKeyRecord dHCIDRecord sPFRecord modifyTimestamp
574 -b dc=
2,dc=
2,dc=
0,dc=
10,dc=in-addr,dc=arpa,ou=hosts,dc=skole,dc=skolelinux,dc=no \
575 -s base -x
'(associateddomain=
2.2.0.10.in-addr.arpa)
'
576 dnsttl, arecord, nsrecord, cnamerecord soarecord ptrrecord \
577 hinforecord mxrecord txtrecord rprecord aaaarecord locrecord \
578 srvrecord naptrrecord modifytimestamp
579 </pre
></blockquote
>
581 <p
>In Debian Edu/Lenny, the PowerDNS tree mode is used with
582 ou=hosts,dc=skole,dc=skolelinux,dc=no as the base, and these are two
583 example LDAP objects used there. In addition to these objects, the
584 parent objects all th way up to ou=hosts,dc=skole,dc=skolelinux,dc=no
585 also exist.
</p
>
587 <blockquote
><pre
>
588 dn: dc=tjener,dc=intern,ou=hosts,dc=skole,dc=skolelinux,dc=no
590 objectclass: dnsdomain
591 objectclass: domainrelatedobject
594 associateddomain: tjener.intern
596 dn: dc=
2,dc=
2,dc=
0,dc=
10,dc=in-addr,dc=arpa,ou=hosts,dc=skole,dc=skolelinux,dc=no
598 objectclass: dnsdomain2
599 objectclass: domainrelatedobject
601 ptrrecord: tjener.intern
602 associateddomain:
2.2.0.10.in-addr.arpa
603 </pre
></blockquote
>
605 <p
>In strict mode, the server behaves differently. When looking for
606 forward DNS entries, it is doing a
"subtree
" scoped search with the
607 same base as in the tree mode for a object with filter
608 "(associateddomain=tjener.intern)
" and requests the attributes dnsttl,
609 arecord, nsrecord, cnamerecord, soarecord, ptrrecord, hinforecord,
610 mxrecord, txtrecord, rprecord, aaaarecord, locrecord, srvrecord,
611 naptrrecord and modifytimestamp. For reverse entires it also do a
612 subtree scoped search but this time the filter is
"(arecord=
10.0.2.2)
"
613 and the requested attributes are associateddomain, dnsttl and
614 modifytimestamp. In short, in strict mode the objects with ptrrecord
615 go away, and the arecord attribute in the forward object is used
618 <p
>The forward and reverse searches can be simulated using ldapsearch
621 <blockquote
><pre
>
622 ldapsearch -h ldap -b ou=hosts,dc=skole,dc=skolelinux,dc=no -s sub -x \
623 '(associateddomain=tjener.intern)
' dNSTTL aRecord nSRecord \
624 cNAMERecord sOARecord pTRRecord hInfoRecord mXRecord tXTRecord \
625 rPRecord aFSDBRecord KeyRecord aAAARecord lOCRecord sRVRecord \
626 nAPTRRecord kXRecord certRecord dSRecord sSHFPRecord iPSecKeyRecord \
627 rRSIGRecord nSECRecord dNSKeyRecord dHCIDRecord sPFRecord modifyTimestamp
629 ldapsearch -h ldap -b ou=hosts,dc=skole,dc=skolelinux,dc=no -s sub -x \
630 '(arecord=
10.0.2.2)
' associateddomain dnsttl modifytimestamp
631 </pre
></blockquote
>
633 <p
>In addition to the forward and reverse searches , there is also a
634 search for SOA records, which behave similar to the forward and
635 reverse lookups.
</p
>
637 <p
>A thing to note with the PowerDNS behaviour is that it do not
638 specify any objectclass names, and instead look for the attributes it
639 need to generate a DNS reply. This make it able to work with any
640 objectclass that provide the needed attributes.
</p
>
642 <p
>The attributes are normally provided in the cosine (RFC
1274) and
643 dnsdomain2 schemas. The latter is used for reverse entries like
644 ptrrecord and recent DNS additions like aaaarecord and srvrecord.
</p
>
646 <p
>In Debian Edu, we have created DNS objects using the object classes
647 dcobject (for dc), dnsdomain or dnsdomain2 (structural, for the DNS
648 attributes) and domainrelatedobject (for associatedDomain). The use
649 of structural object classes make it impossible to combine these
650 classes with the object classes used by DHCP.
</p
>
652 <p
>There are other schemas that could be used too, for example the
653 dnszone structural object class used by Gosa and bind-sdb for the DNS
654 attributes combined with the domainrelatedobject object class, but in
655 this case some unused attributes would have to be included as well
656 (zonename and relativedomainname).
</p
>
658 <p
>My proposal for Debian Edu would be to switch PowerDNS to strict
659 mode and not use any of the existing objectclasses (dnsdomain,
660 dnsdomain2 and dnszone) when one want to combine the DNS information
661 with DHCP information, and instead create a auxiliary object class
662 defined something like this (using the attributes defined for
663 dnsdomain and dnsdomain2 or dnszone):
</p
>
665 <blockquote
><pre
>
666 objectclass ( some-oid NAME
'dnsDomainAux
'
669 MAY ( ARecord $ MDRecord $ MXRecord $ NSRecord $ SOARecord $ CNAMERecord $
670 DNSTTL $ DNSClass $ PTRRecord $ HINFORecord $ MINFORecord $
671 TXTRecord $ SIGRecord $ KEYRecord $ AAAARecord $ LOCRecord $
672 NXTRecord $ SRVRecord $ NAPTRRecord $ KXRecord $ CERTRecord $
673 A6Record $ DNAMERecord
675 </pre
></blockquote
>
677 <p
>This will allow any object to become a DNS entry when combined with
678 the domainrelatedobject object class, and allow any entity to include
679 all the attributes PowerDNS wants. I
've sent an email to the PowerDNS
680 developers asking for their view on this schema and if they are
681 interested in providing such schema with PowerDNS, and I hope my
682 message will be accepted into their mailing list soon.
</p
>
684 <p
><strong
>ISC dhcp
</strong
></p
>
686 <p
>The DHCP server searches for specific objectclass and requests all
687 the object attributes, and then uses the attributes it want. This
688 make it harder to figure out exactly what attributes are used, but
689 thanks to the working example in Debian Edu I can at least get an idea
690 what is needed without having to read the source code.
</p
>
692 <p
>In the DHCP server configuration, the LDAP base to use and the
693 search filter to use to locate the correct dhcpServer entity is
694 stored. These are the relevant entries from
695 /etc/dhcp3/dhcpd.conf:
</p
>
697 <blockquote
><pre
>
698 ldap-base-dn
"dc=skole,dc=skolelinux,dc=no
";
699 ldap-dhcp-server-cn
"dhcp
";
700 </pre
></blockquote
>
702 <p
>The DHCP server uses this information to nest all the DHCP
703 configuration it need. The cn
"dhcp
" is located using the given LDAP
704 base and the filter
"(
&(objectClass=dhcpServer)(cn=dhcp))
". The
705 search result is this entry:
</p
>
707 <blockquote
><pre
>
708 dn: cn=dhcp,dc=skole,dc=skolelinux,dc=no
711 objectClass: dhcpServer
712 dhcpServiceDN: cn=DHCP Config,dc=skole,dc=skolelinux,dc=no
713 </pre
></blockquote
>
715 <p
>The content of the dhcpServiceDN attribute is next used to locate the
716 subtree with DHCP configuration. The DHCP configuration subtree base
717 is located using a base scope search with base
"cn=DHCP
718 Config,dc=skole,dc=skolelinux,dc=no
" and filter
719 "(
&(objectClass=dhcpService)(|(dhcpPrimaryDN=cn=dhcp,dc=skole,dc=skolelinux,dc=no)(dhcpSecondaryDN=cn=dhcp,dc=skole,dc=skolelinux,dc=no)))
".
720 The search result is this entry:
</p
>
722 <blockquote
><pre
>
723 dn: cn=DHCP Config,dc=skole,dc=skolelinux,dc=no
726 objectClass: dhcpService
727 objectClass: dhcpOptions
728 dhcpPrimaryDN: cn=dhcp, dc=skole,dc=skolelinux,dc=no
729 dhcpStatements: ddns-update-style none
730 dhcpStatements: authoritative
731 dhcpOption: smtp-server code
69 = array of ip-address
732 dhcpOption: www-server code
72 = array of ip-address
733 dhcpOption: wpad-url code
252 = text
734 </pre
></blockquote
>
736 <p
>Next, the entire subtree is processed, one level at the time. When
737 all the DHCP configuration is loaded, it is ready to receive requests.
738 The subtree in Debian Edu contain objects with object classes
739 top/dhcpService/dhcpOptions, top/dhcpSharedNetwork/dhcpOptions,
740 top/dhcpSubnet, top/dhcpGroup and top/dhcpHost. These provide options
741 and information about netmasks, dynamic range etc. Leaving out the
742 details here because it is not relevant for the focus of my
743 investigation, which is to see if it is possible to merge dns and dhcp
744 related computer objects.
</p
>
746 <p
>When a DHCP request come in, LDAP is searched for the MAC address
747 of the client (
00:
00:
00:
00:
00:
00 in this example), using a subtree
748 scoped search with
"cn=DHCP Config,dc=skole,dc=skolelinux,dc=no
" as
749 the base and
"(
&(objectClass=dhcpHost)(dhcpHWAddress=ethernet
750 00:
00:
00:
00:
00:
00))
" as the filter. This is what a host object look
753 <blockquote
><pre
>
754 dn: cn=hostname,cn=group1,cn=THINCLIENTS,cn=DHCP Config,dc=skole,dc=skolelinux,dc=no
757 objectClass: dhcpHost
758 dhcpHWAddress: ethernet
00:
00:
00:
00:
00:
00
759 dhcpStatements: fixed-address hostname
760 </pre
></blockquote
>
762 <p
>There is less flexiblity in the way LDAP searches are done here.
763 The object classes need to have fixed names, and the configuration
764 need to be stored in a fairly specific LDAP structure. On the
765 positive side, the invidiual dhcpHost entires can be anywhere without
766 the DN pointed to by the dhcpServer entries. The latter should make
767 it possible to group all host entries in a subtree next to the
768 configuration entries, and this subtree can also be shared with the
769 DNS server if the schema proposed above is combined with the dhcpHost
770 structural object class.
772 <p
><strong
>Conclusion
</strong
></p
>
774 <p
>The PowerDNS implementation seem to be very flexible when it come
775 to which LDAP schemas to use. While its
"tree
" mode is rigid when it
776 come to the the LDAP structure, the
"strict
" mode is very flexible,
777 allowing DNS objects to be stored anywhere under the base cn specified
778 in the configuration.
</p
>
780 <p
>The DHCP implementation on the other hand is very inflexible, both
781 regarding which LDAP schemas to use and which LDAP structure to use.
782 I guess one could implement ones own schema, as long as the
783 objectclasses and attributes have the names used, but this do not
784 really help when the DHCP subtree need to have a fairly fixed
787 <p
>Based on the observed behaviour, I suspect a LDAP structure like
788 this might work for Debian Edu:
</p
>
790 <blockquote
><pre
>
792 cn=machine-info (dhcpService) - dhcpServiceDN points here
794 cn=dhcp-internal (dhcpSharedNetwork/dhcpOptions)
795 cn=
10.0.2.0 (dhcpSubnet)
796 cn=group1 (dhcpGroup/dhcpOptions)
797 cn=dhcp-thinclients (dhcpSharedNetwork/dhcpOptions)
798 cn=
192.168.0.0 (dhcpSubnet)
799 cn=group1 (dhcpGroup/dhcpOptions)
800 ou=machines - PowerDNS base points here
801 cn=hostname (dhcpHost/domainrelatedobject/dnsDomainAux)
802 </pre
></blockquote
>
804 <P
>This is not tested yet. If the DHCP server require the dhcpHost
805 entries to be in the dhcpGroup subtrees, the entries can be stored
806 there instead of a common machines subtree, and the PowerDNS base
807 would have to be moved one level up to the machine-info subtree.
</p
>
809 <p
>The combined object under the machines subtree would look something
812 <blockquote
><pre
>
813 dn: dc=hostname,ou=machines,cn=machine-info,dc=skole,dc=skolelinux,dc=no
816 objectClass: dhcpHost
817 objectclass: domainrelatedobject
818 objectclass: dnsDomainAux
819 associateddomain: hostname.intern
821 dhcpHWAddress: ethernet
00:
00:
00:
00:
00:
00
822 dhcpStatements: fixed-address hostname.intern
823 </pre
></blockquote
>
825 </p
>One could even add the LTSP configuration associated with a given
826 machine, as long as the required attributes are available in a
827 auxiliary object class.
</p
>