This patch will allow ldap-map names in (almost) the form of LDAP URLs as defined in rfc2255:
[[scheme:]//server[:port]][/basedn][?attr[?scope[?filter[?ext]]]]]
The main reason for using this patch is its greater flexibility: e.g., you can use your own LDAP schema, you can apply arbitrary filters, and you can connect with TLS. Also, clients can authenticate to the server, either via LDAP simple authentication, or via SASL (though only the "external" SASL mechanism is tested and likely to work at this time).
--with-openldap, and you will also need the
OpenLDAP client libraries installed.
--with-sasl,
and you must have the Cyrus-SASL
client libraries installed.
Every component of the map name can contain characters escaped by the % method
described in rfc1738. In particular, every % must be escaped as
%25. Syntactical elements separating the components of the URL
must not be escaped in this way.
ldap. Use ldaps to get TLS
(which can provide server authentication and strong encryption of the connection).
ldap
and 636 for ldaps.
ldap.conf.
ldap.conf.
cn,automountInformation and cn,nisMapEntry
are both tried,
to support the popular schemas autofs.schema and nis.schema.
sub.
(|(objectclass=automount)(objectclass=nisObject))
which again supports both autofs.schema and nis.schema.
[!]name=value pairs,
with the ! indicating critical extensions.
Currently supported extensions are listed below.
Unsupported extensions will be ignored unless they are marked as critical
(see rfc2255).
timeout=n
binddn=dn
bindpwfile extension.
binddn does not apply, as the client's identity
is determined in the SASL layer.
%2c.
bindpwfile=file
binddn extension.
sasl_mech=mechanism
external,
i.e., client authentication in the TLS layer.
You may need to also specify tls_cert and tls_key
extensions.
--with-sasl.
sasl_mech=external and don't
specify valid tls_cert and tls_key extensions, binding
will fail with an "unknown authentication method" error, which can be
misleading.
ldaps in the URL.
tls_cert=file
tls_key=file
& is special and gets expanded in
SUN-style maps: avoid it, in particular in the filter!
(how? ask Augustus De Morgan...)
: is special, too, but this can be switched off by
giving the option --no-slashify-colons to the automount command.
[//host/]basedn
protocol="ldap"
server="ldap.acme.bla"
port="389"
base="ou=automounts,o=acme,c=bla"
attr="cn,automountInformation"
scope="one"
filter="(objectclass=automount)"
ext="timeout=8"
automount /some/where ldap \
"$protocol://$server:$port/$base?$attr?$scope?$filter?$ext" --no-slashify-colons
protocol="ldaps"
server="ldap.acme.bla"
port="636"
base="ou=automounts,o=acme,c=bla"
attr="cn,nisMapEntry"
scope="one"
filter="(objectclass=nisobject)"
ext="timeout=8"
automount /some/where ldap \
"$protocol://$server:$port/$base?$attr?$scope?$filter?$ext" --no-slashify-colons
protocol="ldaps"
server="ldap.physik.uni-potsdam.de"
base="ou=people,ou=physik,o=uni-potsdam,c=de"
attr="uid,automountInformation"
scope="one"
filter="(!(|(!(objectclass=physikAccount))(!(accountdomain=quantum))))"
ext="timeout=8"
automount /nfshomes ldap \
"$protocol://$server/$base?$attr?$scope?$filter?$ext" --no-slashify-colons
uid
attribute in the user database entry (rather than from a separate subtree,
which is an administrative mess). The automountInformation attribute
specifies the physical location of the home directory.
Only accounts with the attribute
accountdomain=quantum are eligible for automounting on this host.
Account entries look approximately like this:
dn: cn=Hans-Heinz Müller-Lüdenscheidt,ou=people,ou=physik,o=uni-potsdam,c=de
objectClass: physikPerson
objectClass: physikAccount
objectClass: shadowAccount
objectClass: physikAutomount
cn: Hans-Heinz Müller-Lüdenscheidt
title: Herr
givenName: Hans-Heinz
sn: Müller-Lüdenscheidt
memberOf: institute
memberOf: quantum
roomNumber: 107
telephoneNumber: +49 331 977 1793
facsimileTelephoneNumber: +49 331 977 1767
mail: Hans-Heinz.Mueller-Luedenscheidt@physik.uni-potsdam.de
physikMaildrop: hhmuell@loriot.qipc.org
uid: hhmuell
uidNumber: 123
gidNumber: 456
loginShell: /bin/bash
userPassword:: R3VtbWllbnRlCg==
homeDirectory: /nfshomes/hhmuell
accountDomain: quantum
PhysikExportInformation: quantum
automountInformation: -nosuid,nodev loriot.qipc.org:/Users/hhmuell
userPassword attribute
which the client must send to prove his identity.
binddn=cn=Joe Average%2cou=people%2co=acme%2cc=bla,bindpwfile=/etc/joes.password
ldaps),
"LDAP simple authentication" may transmit the password in clear text from client
to server, and the session may also be vulnerable to other kinds of attacks
(like hijacking); you have been warned!
sasl_mech extension.
sasl_mech=external,tls_key=/etc/ssh_host_rsa_key,tls_cert=/etc/cert.myself.pem
/etc/cert.myself.pem is a X509 certificate which must be
acceptable to the LDAP server and contain the public part of the host key pair.
(of course, you can use any RSA key pair for this purpose. ssh host keys may
be a convenient choice because they are already installed on most client hosts
anyway).
ldaps in the URL).
Timo Felbinger
Quantum Optics Group
Institut für Physik
University of Potsdam
This is free software and comes with NO WARRANTY.