]> pere.pagekite.me Git - homepage.git/commitdiff
Ny oppføring.
authorPetter Reinholdtsen <pere@hungry.com>
Mon, 12 Jul 2010 08:56:40 +0000 (08:56 +0000)
committerPetter Reinholdtsen <pere@hungry.com>
Mon, 12 Jul 2010 08:56:40 +0000 (08:56 +0000)
blog/data/2010-07-11-ltsp-ldap.txt [new file with mode: 0644]

diff --git a/blog/data/2010-07-11-ltsp-ldap.txt b/blog/data/2010-07-11-ltsp-ldap.txt
new file mode 100644 (file)
index 0000000..63c5269
--- /dev/null
@@ -0,0 +1,71 @@
+Title: Idea for storing LTSP configuration in LDAP
+Tags: english, debian, debian edu, nuug, ldap
+Date: 2010-07-11 22:00
+
+<p>Vagrant mentioned on IRC today that ltsp_config now support
+sourcing files from /usr/share/ltsp/ltsp_config.d/ on the thin
+clients, and that this can be used to fetch configuration from LDAP if
+Debian Edu choose to store configuration there.</p>
+
+<p>Armed with this information, I got inspired and wrote a test module
+to get configuration from LDAP.  The idea is to look up the MAC
+address of the client in LDAP, and look for attributes on the form
+ltspconfigsetting=value, and use this to export SETTING=value to the
+LTSP clients.</p>
+
+<p>The goal is to be able to store the LTSP configuration attributes
+in a "computer" LDAP object used by both DNS and DHCP, and thus
+allowing us to store all information about a computer in one place.</p>
+
+<p>This is a untested draft implementation, and I welcome feedback on
+this approach.  A real LDAP schema for the ltspClientAux objectclass
+need to be written.  Comments, suggestions, etc?</p>
+
+<blockquote><pre>
+# Store in /opt/ltsp/$arch/usr/share/ltsp/ltsp_config.d/ldap-config
+#
+# Fetch LTSP client settings from LDAP based on MAC address
+#
+# Uses ethernet address as stored in the dhcpHost objectclass using
+# the dhcpHWAddress attribute or ethernet address stored in the
+# ieee802Device objectclass with the macAddress attribute.
+#
+# This module is written to be schema agnostic, and only depend on the
+# existence of attribute names.
+#
+# The LTSP configuration variables are saved directly using a
+# ltspConfig prefix and uppercasing the rest of the attribute name.
+# To set the SERVER variable, set the ltspConfigServer attribute.
+#
+# Some LDAP schema should be created with all the relevant
+# configuration settings.  Something like this should work:
+# 
+# objectclass ( 1.1.2.2 NAME 'ltspClientAux'
+#     SUP top
+#     AUXILIARY
+#     MAY ( ltspConfigServer $ ltsConfigSound $ ... )
+
+LDAPSERVER=$(debian-edu-ldapserver)
+if [ "$LDAPSERVER" ] ; then
+    LDAPBASE=$(debian-edu-ldapserver -b)
+    for MAC in $(LANG=C ifconfig |grep -i hwaddr| awk '{print $5}'|sort -u) ; do
+       filter="(|(dhcpHWAddress=ethernet $MAC)(macAddress=$MAC))"
+       ldapsearch -h "$LDAPSERVER" -b "$LDAPBASE" -v -x "$filter" | \
+           grep '^ltspConfig' | while read attr value ; do
+           # Remove prefix and convert to upper case
+           attr=$(echo $attr | sed 's/^ltspConfig//i' | tr a-z A-Z)
+           # bass value on to clients
+           eval "$attr=$value; export $attr"
+       done
+    done
+fi
+</pre></blockquote>
+
+<p>I'm not sure this shell construction will work, because I suspect
+the while block might end up in a subshell causing the variables set
+there to not show up in ltsp-config, but if that is the case I am sure
+the code can be restructured to make sure the variables are passed on.
+I expect that can be solved with some testing. :)</p>
+
+<p>If you want to help out with implementing this for Debian Edu,
+please contact us on debian-edu@lists.debian.org.</p>