2002-07-13 15:20:38 +08:00
|
|
|
LDAP auxprop plugin for SASL-enabled servers.
|
2003-10-20 03:41:14 +08:00
|
|
|
Copyright (C) 2002,2003 by Howard Chu, hyc@symas.com
|
2002-07-13 15:20:38 +08:00
|
|
|
|
2003-10-20 03:41:14 +08:00
|
|
|
This software is licensed under the terms of the OpenLDAP license.
|
2002-07-13 15:20:38 +08:00
|
|
|
|
|
|
|
The file ldapdb.c was written for Cyrus SASL 2.1.3 and OpenLDAP 2.1.3.
|
2003-10-20 03:41:14 +08:00
|
|
|
Due to various bugs in the Cyrus source you should use Cyrus SASL 2.1.15
|
|
|
|
or newer. The version of ldapdb bundled with OpenLDAP 2.1.22 and older
|
|
|
|
will work with all OpenLDAP releases 2.1.3 and up. The ldapdb in
|
|
|
|
OpenLDAP 2.1.23 uses a different LDAP request and requires the server
|
|
|
|
to be 2.1.23 or newer.
|
|
|
|
|
2002-07-13 15:20:38 +08:00
|
|
|
It can be compiled by copying into the Cyrus SASL source tree, in the
|
|
|
|
plugins subdirectory. No configuration or build script is provided.
|
|
|
|
|
|
|
|
To compile, type "make ldapdb.lo". To link, you'll have to copy the
|
|
|
|
link rule for one of the other plugins. Below is a sample on my Linux
|
|
|
|
system:
|
|
|
|
|
2003-10-20 03:41:14 +08:00
|
|
|
/bin/sh ../libtool --mode=link gcc -Wall -W -g -O2 -L/usr/local/lib -Wl,-rpath,/usr/local/lib -module -export-dynamic -rpath /usr/lib/sasl2 -o libldapdb.la -version-info 2:4:0 ldapdb.lo -lldap -llber -lssl -lcrypto
|
2002-07-13 15:20:38 +08:00
|
|
|
|
|
|
|
Once installed, you need to add some config items to the SASL server's
|
|
|
|
config file in /usr/lib/sasl2. For example:
|
|
|
|
|
2003-10-20 03:41:14 +08:00
|
|
|
ldapdb_uri: ldap://ldap.example.com
|
2002-07-13 15:20:38 +08:00
|
|
|
ldapdb_id: root
|
|
|
|
ldapdb_pw: secret
|
2003-10-20 03:41:14 +08:00
|
|
|
ldapdb_mech: DIGEST-MD5
|
2002-07-13 15:20:38 +08:00
|
|
|
|
|
|
|
This config assumes an LDAP server on the same machine as the server
|
|
|
|
that is using SASL. The LDAP server must be configured to map the SASL
|
|
|
|
authcId "root" into a DN that has proxy authorization privileges to
|
|
|
|
every account that is allowed to login to this server. (See the OpenLDAP
|
2003-10-20 03:41:14 +08:00
|
|
|
Admin Guide section 10 for details.)
|
2002-07-13 15:20:38 +08:00
|
|
|
|
|
|
|
Unlike other LDAP-enabled plugins for other services that are common
|
|
|
|
on the web, this plugin does not require you to configure DN search
|
|
|
|
patterns to map usernames to LDAP DNs. This plugin requires SASL name
|
|
|
|
mapping to be configured on the target slapd. This approach keeps the
|
|
|
|
LDAP-specific configuration details in one place, the slapd.conf, and
|
|
|
|
makes the configuration of remote services much simpler.
|
|
|
|
|
2003-10-20 03:41:14 +08:00
|
|
|
An additional keyword "ldapdb_rc" may be specified in the config file.
|
2002-07-13 15:20:38 +08:00
|
|
|
The filename specified here will be put into the server's LDAPRC
|
|
|
|
environment variable, and libldap-specific config options may be set
|
|
|
|
in that ldaprc file. The main purpose behind this option is to allow
|
|
|
|
a client TLS certificate to be configured, so that SASL/EXTERNAL may
|
|
|
|
be used between the SASL server and the LDAP server. This is the most
|
|
|
|
optimal way to use this plugin when the servers are on separate machines.
|
|
|
|
|
2003-10-20 06:45:00 +08:00
|
|
|
Note: this plugin is not for use with slapd itself. When OpenLDAP is
|
|
|
|
built with SASL support, slapd uses its own internal auxprop module.
|
|
|
|
By default, without configuring anything else, slapd will fail to load
|
|
|
|
the ldapdb module when it's present. This is as it should be. If you
|
|
|
|
don't like the "auxpropfunc: error -7" message that is sent to syslog
|
|
|
|
by slapd, you can stop it by creating /usr/lib/sasl2/slapd.conf with:
|
|
|
|
|
|
|
|
auxprop_plugin: slapd
|
|
|
|
|
|
|
|
which will force the SASL library to ignore all other auxprop modules.
|
|
|
|
|
2003-10-20 03:41:14 +08:00
|
|
|
This plugin has been in use for over a year at many sites with good
|
|
|
|
results. If you have questions or problems, please send feedback via
|
|
|
|
the openldap-software mailing list.
|
2002-07-13 15:20:38 +08:00
|
|
|
|
2003-10-20 03:41:14 +08:00
|
|
|
-- Howard Chu
|
2003-02-27 01:14:06 +08:00
|
|
|
|
|
|
|
Update... With OpenLDAP 2.1.13 you can use SASL/EXTERNAL on ldapi://.
|
|
|
|
This is fast and secure, and needs no username or password to be stored.
|
|
|
|
The SASL config file is just
|
|
|
|
|
|
|
|
ldapdb_uri: ldapi://
|
|
|
|
ldapdb_mech: EXTERNAL
|
|
|
|
|
|
|
|
The slapd.conf will need to map these usernames to LDAP DNs:
|
|
|
|
|
|
|
|
sasl-regexp uidNumber=(.*)\\+gidNumber=(.*),cn=peercred,cn=external,cn=auth
|
|
|
|
ldap:///dc=example,dc=com??sub?(&(uidNumber=$1)(gidNumber=$2))
|
|
|
|
|
|
|
|
sasl-regexp uid=(.*),cn=external,cn=auth
|
|
|
|
ldap:///dc=example,dc=com??sub?(uid=$1)
|
|
|
|
|
2003-10-20 03:41:14 +08:00
|
|
|
Update... With OpenLDAP 2.1.23 you can use the ldapdb_starttls keyword
|
|
|
|
to use the StartTLS extended operation on an LDAP session. This item
|
|
|
|
may be set to either "try" or "demand", e.g.:
|
2003-10-07 08:19:36 +08:00
|
|
|
|
|
|
|
ldapdb_uri: ldap://ldap.example.com
|
|
|
|
ldapdb_starttls: try
|
|
|
|
|
|
|
|
When set to "try" any failure in StartTLS is ignored. When set to "demand"
|
|
|
|
then any failure aborts the connection.
|