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: Idea for storing LTSP configuration in LDAP
</title> 
   6   <link rel=
"stylesheet" type=
"text/css" media=
"screen" href=
"http://people.skolelinux.org/pere/blog/style.css"> 
  12        <a href=
"http://people.skolelinux.org/pere/blog/">Petter Reinholdtsen
</a> 
  20   <div class=
"title">Idea for storing LTSP configuration in LDAP
</div> 
  21   <div class=
"date">2010-
07-
11 22:
00</div> 
  23 <p>Vagrant mentioned on IRC today that ltsp_config now support
 
  24 sourcing files from /usr/share/ltsp/ltsp_config.d/ on the thin
 
  25 clients, and that this can be used to fetch configuration from LDAP if
 
  26 Debian Edu choose to store configuration there.
</p> 
  28 <p>Armed with this information, I got inspired and wrote a test module
 
  29 to get configuration from LDAP.  The idea is to look up the MAC
 
  30 address of the client in LDAP, and look for attributes on the form
 
  31 ltspconfigsetting=value, and use this to export SETTING=value to the
 
  34 <p>The goal is to be able to store the LTSP configuration attributes
 
  35 in a "computer" LDAP object used by both DNS and DHCP, and thus
 
  36 allowing us to store all information about a computer in one place.
</p> 
  38 <p>This is a untested draft implementation, and I welcome feedback on
 
  39 this approach.  A real LDAP schema for the ltspClientAux objectclass
 
  40 need to be written.  Comments, suggestions, etc?
</p> 
  43 # Store in /opt/ltsp/$arch/usr/share/ltsp/ltsp_config.d/ldap-config
 
  45 # Fetch LTSP client settings from LDAP based on MAC address
 
  47 # Uses ethernet address as stored in the dhcpHost objectclass using
 
  48 # the dhcpHWAddress attribute or ethernet address stored in the
 
  49 # ieee802Device objectclass with the macAddress attribute.
 
  51 # This module is written to be schema agnostic, and only depend on the
 
  52 # existence of attribute names.
 
  54 # The LTSP configuration variables are saved directly using a
 
  55 # ltspConfig prefix and uppercasing the rest of the attribute name.
 
  56 # To set the SERVER variable, set the ltspConfigServer attribute.
 
  58 # Some LDAP schema should be created with all the relevant
 
  59 # configuration settings.  Something like this should work:
 
  61 # objectclass ( 
1.1.2.2 NAME 'ltspClientAux'
 
  64 #     MAY ( ltspConfigServer $ ltsConfigSound $ ... )
 
  66 LDAPSERVER=$(debian-edu-ldapserver)
 
  67 if [ "$LDAPSERVER" ] ; then
 
  68     LDAPBASE=$(debian-edu-ldapserver -b)
 
  69     for MAC in $(LANG=C ifconfig |grep -i hwaddr| awk '{print $
5}'|sort -u) ; do
 
  70         filter="(|(dhcpHWAddress=ethernet $MAC)(macAddress=$MAC))"
 
  71         ldapsearch -h "$LDAPSERVER" -b "$LDAPBASE" -v -x "$filter" | \
 
  72             grep '^ltspConfig' | while read attr value ; do
 
  73             # Remove prefix and convert to upper case
 
  74             attr=$(echo $attr | sed 's/^ltspConfig//i' | tr a-z A-Z)
 
  75             # bass value on to clients
 
  76             eval "$attr=$value; export $attr"
 
  82 <p>I'm not sure this shell construction will work, because I suspect
 
  83 the while block might end up in a subshell causing the variables set
 
  84 there to not show up in ltsp-config, but if that is the case I am sure
 
  85 the code can be restructured to make sure the variables are passed on.
 
  86 I expect that can be solved with some testing. :)
</p> 
  88 <p>If you want to help out with implementing this for Debian Edu,
 
  89 please contact us on debian-edu@lists.debian.org.
</p> 
  91 <p>Update 
2010-
07-
17: I am aware of another effort to store LTSP
 
  92 configuration in LDAP that was created around year 
2000 by
 
  93 <a href=
"http://www.pcxperience.com/thinclient/documentation/ldap.html">PC
 
  94 Xperience, Inc., 
2000</a>.  I found its
 
  95 <a href=
"http://people.redhat.com/alikins/ltsp/ldap/">files
</a> on a
 
  96 personal home page over at redhat.com.
</p> 
  99   <div class=
"tags">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>.
</div> 
 116 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/01/">January (
2)
</a></li> 
 118 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/02/">February (
1)
</a></li> 
 120 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/03/">March (
3)
</a></li> 
 122 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/04/">April (
3)
</a></li> 
 124 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/05/">May (
9)
</a></li> 
 126 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/06/">June (
14)
</a></li> 
 128 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/07/">July (
12)
</a></li> 
 130 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/08/">August (
13)
</a></li> 
 132 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/09/">September (
7)
</a></li> 
 134 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/10/">October (
9)
</a></li> 
 136 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2010/11/">November (
10)
</a></li> 
 143 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/01/">January (
8)
</a></li> 
 145 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/02/">February (
8)
</a></li> 
 147 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/03/">March (
12)
</a></li> 
 149 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/04/">April (
10)
</a></li> 
 151 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/05/">May (
9)
</a></li> 
 153 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/06/">June (
3)
</a></li> 
 155 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/07/">July (
4)
</a></li> 
 157 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/08/">August (
3)
</a></li> 
 159 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/09/">September (
1)
</a></li> 
 161 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/10/">October (
2)
</a></li> 
 163 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/11/">November (
3)
</a></li> 
 165 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2009/12/">December (
3)
</a></li> 
 172 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2008/11/">November (
5)
</a></li> 
 174 <li><a href=
"http://people.skolelinux.org/pere/blog/archive/2008/12/">December (
7)
</a></li> 
 185  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/3d-printer">3d-printer (
12)
</a></li> 
 187  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/amiga">amiga (
1)
</a></li> 
 189  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/aros">aros (
1)
</a></li> 
 191  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/bootsystem">bootsystem (
10)
</a></li> 
 193  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/debian">debian (
42)
</a></li> 
 195  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/debian edu">debian edu (
50)
</a></li> 
 197  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/english">english (
71)
</a></li> 
 199  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/fiksgatami">fiksgatami (
1)
</a></li> 
 201  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/fildeling">fildeling (
11)
</a></li> 
 203  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/kart">kart (
5)
</a></li> 
 205  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/ldap">ldap (
8)
</a></li> 
 207  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/lenker">lenker (
4)
</a></li> 
 209  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/ltsp">ltsp (
1)
</a></li> 
 211  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/multimedia">multimedia (
10)
</a></li> 
 213  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/norsk">norsk (
90)
</a></li> 
 215  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/nuug">nuug (
113)
</a></li> 
 217  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/opphavsrett">opphavsrett (
18)
</a></li> 
 219  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/personvern">personvern (
25)
</a></li> 
 221  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/reprap">reprap (
10)
</a></li> 
 223  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/robot">robot (
4)
</a></li> 
 225  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/rss">rss (
1)
</a></li> 
 227  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/sikkerhet">sikkerhet (
18)
</a></li> 
 229  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/sitesummary">sitesummary (
3)
</a></li> 
 231  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/standard">standard (
16)
</a></li> 
 233  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/stavekontroll">stavekontroll (
1)
</a></li> 
 235  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/video">video (
15)
</a></li> 
 237  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/vitenskap">vitenskap (
1)
</a></li> 
 239  <li><a href=
"http://people.skolelinux.org/pere/blog/tags/web">web (
13)
</a></li>