2007-06-04 07:57:58 +08:00
|
|
|
# $OpenLDAP$
|
2007-01-03 04:00:42 +08:00
|
|
|
# Copyright 1999-2007 The OpenLDAP Foundation, All Rights Reserved.
|
2001-01-18 07:48:53 +08:00
|
|
|
# COPYING RESTRICTIONS APPLY, see COPYRIGHT.
|
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
H1: Using SASL
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2001-05-12 14:15:42 +08:00
|
|
|
OpenLDAP clients and servers are capable of authenticating via the
|
|
|
|
{{TERM[expand]SASL}} ({{TERM:SASL}}) framework, which is detailed
|
2006-06-10 01:20:38 +08:00
|
|
|
in {{REF:RFC4422}}. This chapter describes how to make use of
|
2001-05-12 14:15:42 +08:00
|
|
|
SASL in OpenLDAP.
|
|
|
|
|
|
|
|
There are several industry standard authentication mechanisms that
|
2003-12-05 03:34:02 +08:00
|
|
|
can be used with SASL, including {{TERM:GSSAPI}} for {{TERM:Kerberos}}
|
2006-12-08 09:57:07 +08:00
|
|
|
V, {{TERM:DIGEST-MD5}}, and {{TERM:PLAIN}} and {{TERM:EXTERNAL}}
|
|
|
|
for use with {{TERM[expand]TLS}} (TLS).
|
2003-12-05 03:34:02 +08:00
|
|
|
|
|
|
|
The standard client tools provided with OpenLDAP Software, such as
|
|
|
|
{{ldapsearch}}(1) and {{ldapmodify}}(1), will by default attempt
|
2006-12-08 09:57:07 +08:00
|
|
|
to authenticate the user to the {{TERM:LDAP}} directory server using
|
|
|
|
SASL. Basic authentication service can be set up by the LDAP
|
|
|
|
administrator with a few steps, allowing users to be authenticated
|
|
|
|
to the slapd server as their LDAP entry. With a few extra steps,
|
|
|
|
some users and services can be allowed to exploit SASL's proxy
|
|
|
|
authorization feature, allowing them to authenticate themselves and
|
|
|
|
then switch their identity to that of another user or service.
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2001-01-18 16:25:10 +08:00
|
|
|
This chapter assumes you have read {{Cyrus SASL for System
|
2006-12-08 04:31:18 +08:00
|
|
|
Administrators}}, provided with the {{PRD:Cyrus SASL}}
|
2002-08-29 12:56:05 +08:00
|
|
|
package (in {{FILE:doc/sysadmin.html}}) and have a working Cyrus
|
|
|
|
SASL installation. You should use the Cyrus SASL {{EX:sample_client}}
|
|
|
|
and {{EX:sample_server}} to test your SASL installation before
|
2003-12-05 03:34:02 +08:00
|
|
|
attempting to make use of it with OpenLDAP Software.
|
2001-01-18 16:25:10 +08:00
|
|
|
|
|
|
|
Note that in the following text the term {{user}} is used to describe
|
|
|
|
a person or application entity who is connecting to the LDAP server
|
|
|
|
via an LDAP client, such as {{ldapsearch}}(1). That is, the term
|
2002-06-15 05:19:42 +08:00
|
|
|
{{user}} not only applies to both an individual using an LDAP client,
|
2001-01-18 16:25:10 +08:00
|
|
|
but to an application entity which issues LDAP client operations
|
|
|
|
without direct user control. For example, an e-mail server which
|
|
|
|
uses LDAP operations to access information held in an LDAP server
|
|
|
|
is an application entity.
|
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
|
2001-05-12 14:15:42 +08:00
|
|
|
H2: SASL Security Considerations
|
2001-01-18 10:18:29 +08:00
|
|
|
|
|
|
|
SASL offers many different authentication mechanisms. This section
|
2001-01-19 06:36:20 +08:00
|
|
|
briefly outlines security considerations.
|
2001-01-18 10:18:29 +08:00
|
|
|
|
2003-12-05 03:34:02 +08:00
|
|
|
Some mechanisms, such as PLAIN and LOGIN, offer no greater security
|
|
|
|
over LDAP {{simple}} authentication. Like LDAP {{simple}}
|
|
|
|
authentication, such mechanisms should not be used unless you have
|
|
|
|
adequate security protections in place. It is recommended that
|
|
|
|
these mechanisms be used only in conjunction with {{TERM[expand]TLS}}
|
|
|
|
(TLS). Use of PLAIN and LOGIN are not discussed further in this
|
|
|
|
document.
|
2001-01-18 10:18:29 +08:00
|
|
|
|
|
|
|
The DIGEST-MD5 mechanism is the mandatory-to-implement authentication
|
|
|
|
mechanism for LDAPv3. Though DIGEST-MD5 is not a strong authentication
|
|
|
|
mechanism in comparison with trusted third party authentication
|
2006-12-08 09:57:07 +08:00
|
|
|
systems (such as {{TERM:Kerberos}} or public key systems), it does
|
|
|
|
offer significant protections against a number of attacks. Unlike
|
|
|
|
the {{TERM:CRAM-MD5}} mechanism, it prevents chosen plaintext
|
|
|
|
attacks. DIGEST-MD5 is favored over the use of plaintext password
|
|
|
|
mechanisms. The CRAM-MD5 mechanism is deprecated in favor of
|
|
|
|
DIGEST-MD5. Use of {{SECT:DIGEST-MD5}} is discussed below.
|
|
|
|
|
|
|
|
The GSSAPI mechanism utilizes {{TERM:GSS-API}} {{TERM:Kerberos}} V
|
|
|
|
to provide secure authentication services. The KERBEROS_V4 mechanism
|
|
|
|
is available for those using Kerberos IV. Kerberos is viewed as a
|
|
|
|
secure, distributed authentication system suitable for both small
|
|
|
|
and large enterprises. Use of {{SECT:GSSAPI}} and {{SECT:KERBEROS_V4}}
|
|
|
|
are discussed below.
|
2001-01-18 10:18:29 +08:00
|
|
|
|
|
|
|
The EXTERNAL mechanism utilizes authentication services provided
|
|
|
|
by lower level network services such as {{TERM:TLS}} (TLS). When
|
2002-08-29 12:56:05 +08:00
|
|
|
used in conjunction with {{TERM:TLS}} {{TERM:X.509}}-based public
|
|
|
|
key technology, EXTERNAL offers strong authentication. Use of
|
|
|
|
EXTERNAL is discussed in the {{SECT:Using TLS}} chapter.
|
2001-01-18 10:18:29 +08:00
|
|
|
|
|
|
|
There are other strong authentication mechanisms to choose from,
|
2003-12-05 03:34:02 +08:00
|
|
|
including {{TERM:OTP}} (one time passwords) and {{TERM:SRP}} (secure
|
|
|
|
remote passwords). These mechanisms are not discussed in this
|
|
|
|
document.
|
2001-01-18 07:48:53 +08:00
|
|
|
|
|
|
|
|
|
|
|
H2: SASL Authentication
|
|
|
|
|
2001-01-18 16:25:10 +08:00
|
|
|
Getting basic SASL authentication running involves a few steps.
|
2006-12-08 09:57:07 +08:00
|
|
|
The first step configures your slapd server environment so that it
|
|
|
|
can communicate with client programs using the security system in
|
|
|
|
place at your site. This usually involves setting up a service key,
|
|
|
|
a public key, or other form of secret. The second step concerns
|
|
|
|
mapping authentication identities to LDAP {{TERM:DN}}'s, which
|
2001-01-18 10:18:29 +08:00
|
|
|
depends on how entries are laid out in your directory. An explanation
|
|
|
|
of the first step will be given in the next section using Kerberos
|
|
|
|
V4 as an example mechanism. The steps necessary for your site's
|
|
|
|
authentication mechanism will be similar, but a guide to every
|
|
|
|
mechanism available under SASL is beyond the scope of this chapter.
|
2006-12-08 09:57:07 +08:00
|
|
|
The second step is described in the section {{SECT:Mapping
|
|
|
|
Authentication Identities}}.
|
2001-01-18 14:39:47 +08:00
|
|
|
|
2003-12-05 03:34:02 +08:00
|
|
|
|
|
|
|
H3: GSSAPI
|
|
|
|
|
|
|
|
This section describes the use of the SASL GSSAPI mechanism and
|
|
|
|
Kerberos V with OpenLDAP. It will be assumed that you have Kerberos
|
|
|
|
V deployed, you are familiar with the operation of the system, and
|
|
|
|
that your users are trained in its use. This section also assumes
|
|
|
|
you have familiarized yourself with the use of the GSSAPI mechanism
|
|
|
|
by reading {{Configuring GSSAPI and Cyrus SASL}} (provided with
|
|
|
|
Cyrus SASL in the {{FILE:doc/gssapi}} file) and successfully
|
|
|
|
experimented with the Cyrus provided {{EX:sample_server}} and
|
|
|
|
{{EX:sample_client}} applications. General information about
|
|
|
|
Kerberos is available at {{URL:http://web.mit.edu/kerberos/www/}}.
|
|
|
|
|
|
|
|
To use the GSSAPI mechanism with {{slapd}}(8) one must create a service
|
|
|
|
key with a principal for {{ldap}} service within the realm for the host
|
|
|
|
on which the service runs. For example, if you run {{slapd}} on
|
|
|
|
{{EX:directory.example.com}} and your realm is {{EX:EXAMPLE.COM}},
|
|
|
|
you need to create a service key with the principal:
|
|
|
|
|
|
|
|
> ldap/directory.example.com@EXAMPLE.COM
|
|
|
|
|
|
|
|
When {{slapd}}(8) runs, it must have access to this key. This is
|
2004-05-31 06:24:00 +08:00
|
|
|
generally done by placing the key into a keytab file,
|
|
|
|
{{FILE:/etc/krb5.keytab}}. See your Kerberos and Cyrus SASL
|
|
|
|
documentation for information regarding keytab location settings.
|
2003-12-05 03:34:02 +08:00
|
|
|
|
|
|
|
To use the GSSAPI mechanism to authenticate to the directory, the
|
|
|
|
user obtains a Ticket Granting Ticket (TGT) prior to running the
|
|
|
|
LDAP client. When using OpenLDAP client tools, the user may mandate
|
|
|
|
use of the GSSAPI mechanism by specifying {{EX:-Y GSSAPI}} as a
|
|
|
|
command option.
|
|
|
|
|
|
|
|
For the purposes of authentication and authorization, {{slapd}}(8)
|
2004-05-31 06:24:00 +08:00
|
|
|
associates an authentication request DN of the form:
|
2003-12-05 03:34:02 +08:00
|
|
|
|
|
|
|
> uid=<primary[/instance]>,cn=<realm>,cn=gssapi,cn=auth
|
|
|
|
|
|
|
|
Continuing our example, a user with the Kerberos principal
|
|
|
|
{{EX:kurt@EXAMPLE.COM}} would have the associated DN:
|
|
|
|
|
|
|
|
> uid=kurt,cn=example.com,cn=gssapi,cn=auth
|
|
|
|
|
|
|
|
and the principal {{EX:ursula/admin@FOREIGN.REALM}} would have the
|
|
|
|
associated DN:
|
|
|
|
|
|
|
|
> uid=ursula/admin,cn=foreign.realm,cn=gssapi,cn=auth
|
|
|
|
|
|
|
|
|
2004-05-31 06:24:00 +08:00
|
|
|
The authentication request DN can be used directly ACLs and
|
|
|
|
{{EX:groupOfNames}} "member" attributes, since it is of legitimate
|
|
|
|
LDAP DN format. Or alternatively, the authentication DN could be
|
|
|
|
mapped before use. See the section {{SECT:Mapping Authentication
|
|
|
|
Identities}} for details.
|
|
|
|
|
|
|
|
|
2001-01-18 14:39:47 +08:00
|
|
|
H3: KERBEROS_V4
|
2001-01-18 10:18:29 +08:00
|
|
|
|
|
|
|
This section describes the use of the SASL KERBEROS_V4 mechanism
|
|
|
|
with OpenLDAP. It will be assumed that you are familiar with the
|
2002-06-15 09:00:50 +08:00
|
|
|
workings of the Kerberos IV security system, and that your site has
|
2001-01-19 06:36:20 +08:00
|
|
|
Kerberos IV deployed. Your users should be familiar with
|
2002-04-20 15:24:14 +08:00
|
|
|
authentication policy, how to receive credentials in
|
2001-01-18 10:18:29 +08:00
|
|
|
a Kerberos ticket cache, and how to refresh expired credentials.
|
|
|
|
|
2003-12-05 03:34:02 +08:00
|
|
|
Note: KERBEROS_V4 and Kerberos IV are deprecated in favor of GSSAPI
|
|
|
|
and Kerberos V.
|
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
Client programs will need to be able to obtain a session key for
|
|
|
|
use when connecting to your LDAP server. This allows the LDAP server
|
|
|
|
to know the identity of the user, and allows the client to know it
|
|
|
|
is connecting to a legitimate server. If encryption layers are to
|
|
|
|
be used, the session key can also be used to help negotiate that
|
|
|
|
option.
|
|
|
|
|
|
|
|
The slapd server runs the service called "{{ldap}}", and the server
|
|
|
|
will require a srvtab file with a service key. SASL aware client
|
2001-01-18 07:48:53 +08:00
|
|
|
programs will be obtaining an "ldap" service ticket with the user's
|
2001-01-18 10:18:29 +08:00
|
|
|
ticket granting ticket (TGT), with the instance of the ticket
|
|
|
|
matching the hostname of the OpenLDAP server. For example, if your
|
2001-01-18 16:25:10 +08:00
|
|
|
realm is named {{EX:EXAMPLE.COM}} and the slapd server is running
|
|
|
|
on the host named {{EX:directory.example.com}}, the {{FILE:/etc/srvtab}}
|
|
|
|
file on the server will have a service key
|
2001-01-18 07:48:53 +08:00
|
|
|
|
|
|
|
> ldap.directory@EXAMPLE.COM
|
|
|
|
|
2001-01-19 06:36:20 +08:00
|
|
|
When an LDAP client is authenticating a user to the directory using
|
2001-01-18 10:18:29 +08:00
|
|
|
the KERBEROS_IV mechanism, it will request a session key for that
|
|
|
|
same principal, either from the ticket cache or by obtaining a new
|
|
|
|
one from the Kerberos server. This will require the TGT to be
|
|
|
|
available and valid in the cache as well. If it is not present or
|
2004-05-31 07:20:39 +08:00
|
|
|
has expired, the client may print out the message:
|
2001-01-18 07:48:53 +08:00
|
|
|
|
|
|
|
> ldap_sasl_interactive_bind_s: Local error
|
|
|
|
|
|
|
|
When the service ticket is obtained, it will be passed to the LDAP
|
2001-01-18 16:25:10 +08:00
|
|
|
server as proof of the user's identity. The server will extract
|
|
|
|
the identity and realm out of the service ticket using SASL
|
2001-01-18 10:18:29 +08:00
|
|
|
library calls, and convert them into an {{authentication request
|
|
|
|
DN}} of the form
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2001-01-19 04:14:14 +08:00
|
|
|
> uid=<username>,cn=<realm>,cn=<mechanism>,cn=auth
|
2001-01-18 07:48:53 +08:00
|
|
|
|
|
|
|
So in our above example, if the user's name were "adamson", the
|
|
|
|
authentication request DN would be:
|
|
|
|
|
2002-04-20 15:24:14 +08:00
|
|
|
> uid=adamsom,cn=example.com,cn=kerberos_v4,cn=auth
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2004-05-31 06:24:00 +08:00
|
|
|
This authentication request DN can be used directly ACLs or,
|
|
|
|
alternatively, mapped prior to use. See the section {{SECT:Mapping
|
|
|
|
Authentication Identities}} for details.
|
2001-01-18 07:48:53 +08:00
|
|
|
|
|
|
|
|
2002-08-07 11:00:00 +08:00
|
|
|
H3: DIGEST-MD5
|
|
|
|
|
2003-12-05 03:34:02 +08:00
|
|
|
This section describes the use of the SASL DIGEST-MD5 mechanism
|
|
|
|
using secrets stored either in the directory itself or in Cyrus
|
|
|
|
SASL's own database. DIGEST-MD5 relies on the client and the server
|
|
|
|
sharing a "secret", usually a password. The server generates a
|
|
|
|
challenge and the client a response proving that it knows the shared
|
|
|
|
secret. This is much more secure than simply sending the secret
|
|
|
|
over the wire.
|
2002-08-07 11:00:00 +08:00
|
|
|
|
2003-12-05 03:34:02 +08:00
|
|
|
Cyrus SASL supports several shared-secret mechanisms. To do this,
|
|
|
|
it needs access to the plaintext password (unlike mechanisms which
|
|
|
|
pass plaintext passwords over the wire, where the server can store
|
|
|
|
a hashed version of the password).
|
2002-08-07 11:00:00 +08:00
|
|
|
|
2004-05-31 07:20:39 +08:00
|
|
|
The server's copy of the shared-secret may be stored in Cyrus SASL's
|
|
|
|
own {{sasldb}} database, in an external system accessed via
|
|
|
|
{{saslauthd}}, or in LDAP database itself. In either case it is
|
|
|
|
very important to apply file access controls and LDAP access controls
|
|
|
|
to prevent exposure of the passwords. The configuration and commands
|
|
|
|
discussed in this section assume the use of Cyrus SASL 2.1.
|
2002-08-07 11:00:00 +08:00
|
|
|
|
2002-08-29 12:56:05 +08:00
|
|
|
To use secrets stored in {{sasldb}}, simply add users with the
|
2002-08-07 11:00:00 +08:00
|
|
|
{{saslpasswd2}} command:
|
|
|
|
|
|
|
|
> saslpasswd2 -c <username>
|
|
|
|
|
|
|
|
The passwords for such users must be managed with the {{saslpasswd2}}
|
|
|
|
command.
|
|
|
|
|
|
|
|
To use secrets stored in the LDAP directory, place plaintext passwords
|
2004-05-31 07:20:39 +08:00
|
|
|
in the {{EX:userPassword}} attribute. It will be necessary to add
|
|
|
|
an option to {{EX:slapd.conf}} to make sure that passwords set using
|
|
|
|
the LDAP Password Modify Operation are stored in plaintext:
|
2002-08-07 11:00:00 +08:00
|
|
|
|
|
|
|
> password-hash {CLEARTEXT}
|
|
|
|
|
2004-05-31 07:20:39 +08:00
|
|
|
Passwords stored in this way can be managed either with {{ldappasswd}}(1)
|
|
|
|
or by simply modifying the {{EX:userPassword}} attribute. Regardless of
|
|
|
|
where the passwords are stored, a mapping will be needed from
|
|
|
|
authentication request DN to user's DN.
|
2002-08-07 11:00:00 +08:00
|
|
|
|
2004-05-31 07:20:39 +08:00
|
|
|
The DIGEST-MD5 mechanism produces authentication IDs of the form:
|
2002-08-07 11:00:00 +08:00
|
|
|
|
|
|
|
> uid=<username>,cn=<realm>,cn=digest-md5,cn=auth
|
|
|
|
|
2004-05-31 07:20:39 +08:00
|
|
|
If the default realm is used, the realm name is omitted from the ID,
|
|
|
|
giving:
|
2002-08-07 11:00:00 +08:00
|
|
|
|
|
|
|
> uid=<username>,cn=digest-md5,cn=auth
|
|
|
|
|
2004-05-31 06:24:00 +08:00
|
|
|
See {{SECT: Mapping Authentication Identities}} below for information
|
|
|
|
on optional mapping of identities.
|
2002-08-07 11:00:00 +08:00
|
|
|
|
|
|
|
With suitable mappings in place, users can specify SASL IDs when
|
2004-05-31 07:20:39 +08:00
|
|
|
performing LDAP operations and sldb}} and the directory itself will
|
|
|
|
be used to verify the authentication. For example, the user
|
|
|
|
identified by the directory entry:
|
2002-08-07 11:00:00 +08:00
|
|
|
|
|
|
|
> dn: cn=Andrew Findlay+uid=u000997,dc=example,dc=com
|
|
|
|
> objectclass: inetOrgPerson
|
|
|
|
> objectclass: person
|
|
|
|
> sn: Findlay
|
|
|
|
> uid: u000997
|
|
|
|
> userPassword: secret
|
|
|
|
|
|
|
|
can issue commands of the form:
|
|
|
|
|
2004-05-31 07:20:39 +08:00
|
|
|
> ldapsearch -Y DIGEST-MD5 -U u000997 ...
|
2002-08-07 11:00:00 +08:00
|
|
|
|
2002-08-29 12:56:05 +08:00
|
|
|
Note: in each of the above cases, no authorization identity (e.g.
|
2004-05-31 07:20:39 +08:00
|
|
|
{{EX:-X}}) was provided. Unless you are attempting {{SECT:SASL
|
|
|
|
Proxy Authorization}}, no authorization identity should be specified.
|
|
|
|
The server will infer an authorization identity from authentication
|
|
|
|
identity (as described below).
|
2002-08-28 07:24:43 +08:00
|
|
|
|
2002-08-07 11:00:00 +08:00
|
|
|
|
2004-05-31 06:24:00 +08:00
|
|
|
H3: Mapping Authentication Identities
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
The authentication mechanism in the slapd server will use SASL
|
|
|
|
library calls to obtain the authenticated user's "username", based
|
|
|
|
on whatever underlying authentication mechanism was used. This
|
|
|
|
username is in the namespace of the authentication mechanism, and
|
2004-05-31 06:24:00 +08:00
|
|
|
not in the normal LDAP namespace. As stated in the sections above,
|
|
|
|
that username is reformatted into an authentication request DN of
|
|
|
|
the form
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2001-01-19 04:14:14 +08:00
|
|
|
> uid=<username>,cn=<realm>,cn=<mechanism>,cn=auth
|
2001-01-18 07:48:53 +08:00
|
|
|
|
|
|
|
or
|
|
|
|
|
2001-01-19 04:14:14 +08:00
|
|
|
> uid=<username>,cn=<mechanism>,cn=auth
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
depending on whether or not <mechanism> employs the concept of
|
2004-05-31 07:20:39 +08:00
|
|
|
"realms". Note also that the realm part will be omitted if the
|
|
|
|
default realm was used in the authentication.
|
|
|
|
|
|
|
|
The {{ldapwhoami}}(1) command may be used to determine the identity
|
|
|
|
associated with the user. It is very useful for determining proper
|
|
|
|
function of mappings.
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
It is not intended that you should add LDAP entries of the above
|
2004-05-31 06:24:00 +08:00
|
|
|
form to your LDAP database. Chances are you have an LDAP entry for
|
|
|
|
each of the persons that will be authenticating to LDAP, laid out
|
2001-01-19 04:14:14 +08:00
|
|
|
in your directory tree, and the tree does not start at cn=auth.
|
2001-01-18 10:18:29 +08:00
|
|
|
But if your site has a clear mapping between the "username" and an
|
|
|
|
LDAP entry for the person, you will be able to configure your LDAP
|
2002-08-28 07:24:43 +08:00
|
|
|
server to automatically map a authentication request DN to the
|
|
|
|
user's {{authentication DN}}.
|
|
|
|
|
|
|
|
Note: it is not required that the authentication request DN nor the
|
|
|
|
user's authentication DN resulting from the mapping refer to an
|
|
|
|
entry held in the directory. However, additional capabilities
|
|
|
|
become available (see below).
|
2001-01-18 10:18:29 +08:00
|
|
|
|
|
|
|
The LDAP administrator will need to tell the slapd server how to
|
|
|
|
map an authentication request DN to a user's authentication DN.
|
2005-07-29 11:58:58 +08:00
|
|
|
This is done by adding one or more {{EX:authz-regexp}} directives to
|
2001-01-18 10:18:29 +08:00
|
|
|
the {{slapd.conf}}(5) file. This directive takes two arguments:
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2005-07-29 11:58:58 +08:00
|
|
|
> authz-regexp <search pattern> <replacement pattern>
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
The authentication request DN is compared to the search pattern
|
|
|
|
using the regular expression functions {{regcomp}}() and {{regexec}}(),
|
|
|
|
and if it matches, it is rewritten as the replacement pattern. If
|
2005-07-29 11:58:58 +08:00
|
|
|
there are multiple {{EX:authz-regexp}} directives, only the first
|
2001-01-18 10:18:29 +08:00
|
|
|
whose search pattern matches the authentication identity is used.
|
|
|
|
The string that is output from the replacement pattern should be
|
2004-05-31 06:24:00 +08:00
|
|
|
the authentication DN of the user or an LDAP URL. If replacement
|
|
|
|
string produces a DN, the entry named by this DN need not be held
|
|
|
|
by this server. If the replace string produces an LDAP URL, that
|
|
|
|
LDAP URL must evaluate to one and only one entry held by this server.
|
2001-01-18 10:18:29 +08:00
|
|
|
|
|
|
|
The search pattern can contain any of the regular expression
|
|
|
|
characters listed in {{regexec}}(3C). The main characters of note
|
|
|
|
are dot ".", asterisk "*", and the open and close parenthesis "("
|
|
|
|
and ")". Essentially, the dot matches any character, the asterisk
|
2004-05-31 06:24:00 +08:00
|
|
|
allows zero or more repeats of the immediately preceding character
|
|
|
|
or pattern, and terms in parenthesis are remembered for the replacement
|
|
|
|
pattern.
|
2001-01-18 10:18:29 +08:00
|
|
|
|
2007-08-07 00:08:05 +08:00
|
|
|
The replacement pattern will produce either a DN or URL referring
|
2004-05-31 06:24:00 +08:00
|
|
|
to the user. Anything from the authentication request DN that
|
2001-01-18 10:18:29 +08:00
|
|
|
matched a string in parenthesis in the search pattern is stored in
|
|
|
|
the variable "$1". That variable "$1" can appear in the replacement
|
|
|
|
pattern, and will be replaced by the string from the authentication
|
2002-06-15 09:00:50 +08:00
|
|
|
request DN. If there were multiple sets of parentheses in the search
|
2001-01-18 10:18:29 +08:00
|
|
|
pattern, the variables $2, $3, etc are used.
|
|
|
|
|
2004-05-31 06:24:00 +08:00
|
|
|
H3: Direct Mapping
|
|
|
|
|
|
|
|
Where possible, direct mapping of the authentication request DN to
|
|
|
|
the user's DN is generally recommended. Aside from avoiding the
|
|
|
|
expense of searching for the user's DN, it allows mapping to
|
|
|
|
DNs which refer to entries not held by this server.
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2004-05-31 06:24:00 +08:00
|
|
|
Suppose the authentication request DN is written as:
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2004-05-31 06:24:00 +08:00
|
|
|
> uid=adamson,cn=example.com,cn=gssapi,cn=auth
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2004-05-31 06:24:00 +08:00
|
|
|
and the user's actual LDAP entry is:
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2004-05-31 06:24:00 +08:00
|
|
|
> uid=adamson,ou=people,dc=example,dc=com
|
|
|
|
|
2005-07-29 11:58:58 +08:00
|
|
|
then the following {{EX:authz-regexp}} directive in {{slapd.conf}}(5)
|
2004-05-31 06:24:00 +08:00
|
|
|
would provide for direct mapping.
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2005-07-29 11:58:58 +08:00
|
|
|
> authz-regexp
|
2004-05-31 06:24:00 +08:00
|
|
|
> uid=([^,]*),cn=example.com,cn=gssapi,cn=auth
|
|
|
|
> uid=$1,ou=people,dc=example,dc=com
|
2001-01-18 07:48:53 +08:00
|
|
|
|
|
|
|
An even more lenient rule could be written as
|
|
|
|
|
2005-07-29 11:58:58 +08:00
|
|
|
> authz-regexp
|
2004-05-31 06:24:00 +08:00
|
|
|
> uid=([^,]*),cn=[^,]*,cn=auth
|
|
|
|
> uid=$1,ou=people,dc=example,dc=com
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
Be careful about setting the search pattern too leniently, however,
|
2004-05-31 06:24:00 +08:00
|
|
|
since it may mistakenly allow persons to become authenticated as a
|
|
|
|
DN to which they should not have access. It is better to write
|
2001-01-18 10:18:29 +08:00
|
|
|
several strict directives than one lenient directive which has
|
2004-05-31 06:24:00 +08:00
|
|
|
security holes. If there is only one authentication mechanism in
|
2001-01-18 10:18:29 +08:00
|
|
|
place at your site, and zero or one realms in use, you might be
|
2003-12-05 03:34:02 +08:00
|
|
|
able to map between authentication identities and LDAP DN's with a
|
2005-07-29 11:58:58 +08:00
|
|
|
single {{EX:authz-regexp}} directive.
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2003-12-05 03:34:02 +08:00
|
|
|
Don't forget to allow for the case where the realm is omitted as
|
|
|
|
well as the case with an explicitly specified realm. This may well
|
2005-07-29 11:58:58 +08:00
|
|
|
require a separate {{EX:authz-regexp}} directive for each case, with
|
2003-12-05 03:34:02 +08:00
|
|
|
the explicit-realm entry being listed first.
|
2002-08-07 11:00:00 +08:00
|
|
|
|
2004-05-31 06:24:00 +08:00
|
|
|
H3: Search-based mappings
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2004-05-31 06:24:00 +08:00
|
|
|
There are a number of cases where mapping to a LDAP URL may be
|
|
|
|
appropriate. For instance, some sites may have person objects
|
|
|
|
located in multiple areas of the LDAP tree, such as if there were
|
|
|
|
an {{EX:ou=accounting}} tree and an {{EX:ou=engineering}} tree,
|
|
|
|
with persons interspersed between them. Or, maybe the desired
|
|
|
|
mapping must be based upon information in the user's information.
|
|
|
|
Consider the need to map the above authentication request DN to
|
|
|
|
user whose entry is as follows:
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2004-05-31 06:24:00 +08:00
|
|
|
> dn: cn=Mark Adamson,ou=People,dc=Example,dc=COM
|
|
|
|
> objectclass: person
|
|
|
|
> cn: Mark Adamson
|
|
|
|
> uid: adamson
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2004-05-31 06:24:00 +08:00
|
|
|
The information in the authentication request DN is insufficient
|
|
|
|
to allow the user's DN to be directly derived, instead the user's
|
|
|
|
DN must be searched for. For these situations, a replacement pattern
|
2005-07-29 11:58:58 +08:00
|
|
|
which produces a LDAP URL can be used in the {{EX:authz-regexp}}
|
2004-05-31 06:24:00 +08:00
|
|
|
directives. This URL will then be used to perform an internal
|
|
|
|
search of the LDAP database to find the person's authentication DN.
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
An LDAP URL, similar to other URL's, is of the form
|
2001-01-18 07:48:53 +08:00
|
|
|
|
|
|
|
> ldap://<host>/<base>?<attrs>?<scope>?<filter>
|
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
This contains all of the elements necessary to perform an LDAP
|
|
|
|
search: the name of the server <host>, the LDAP DN search base
|
|
|
|
<base>, the LDAP attributes to retrieve <attrs>, the search scope
|
|
|
|
<scope> which is one of the three options "base", "one", or "sub",
|
2002-08-28 07:24:43 +08:00
|
|
|
and lastly an LDAP search filter <filter>. Since the search is for
|
|
|
|
an LDAP DN within the current server, the <host> portion should be
|
|
|
|
empty. The <attrs> field is also ignored since only the DN is of
|
|
|
|
concern. These two elements are left in the format of the URL to
|
|
|
|
maintain the clarity of what information goes where in the string.
|
2001-01-18 10:18:29 +08:00
|
|
|
|
|
|
|
Suppose that the person in the example from above did in fact have
|
|
|
|
an authentication username of "adamson" and that information was
|
2005-07-29 11:58:58 +08:00
|
|
|
kept in the attribute "uid" in their LDAP entry. The {{EX:authz-regexp}}
|
2001-01-18 07:48:53 +08:00
|
|
|
directive might be written as
|
|
|
|
|
2005-07-29 11:58:58 +08:00
|
|
|
> authz-regexp
|
2004-05-31 06:24:00 +08:00
|
|
|
> uid=([^,]*),cn=example.com,cn=gssapi,cn=auth
|
|
|
|
> ldap:///ou=people,dc=example,dc=com??one?(uid=$1)
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
This will initiate an internal search of the LDAP database inside
|
|
|
|
the slapd server. If the search returns exactly one entry, it is
|
|
|
|
accepted as being the DN of the user. If there are more than one
|
|
|
|
entries returned, or if there are zero entries returned, the
|
2003-12-05 03:34:02 +08:00
|
|
|
authentication fails and the user's connection is left bound as the
|
|
|
|
authentication request DN.
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
The attributes that are used in the search filter <filter> in the
|
|
|
|
URL should be indexed to allow faster searching. If they are not,
|
|
|
|
the authentication step alone can take uncomfortably long periods,
|
|
|
|
and users may assume the server is down.
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2003-12-05 03:34:02 +08:00
|
|
|
A more complex site might have several realms in use, each mapping
|
2004-05-31 06:24:00 +08:00
|
|
|
to a different subtree in the directory. These can be handled with
|
2002-08-07 11:00:00 +08:00
|
|
|
statements of the form:
|
|
|
|
|
|
|
|
> # Match Engineering realm
|
2005-07-29 11:58:58 +08:00
|
|
|
> authz-regexp
|
2004-05-31 06:24:00 +08:00
|
|
|
> uid=([^,]*),cn=engineering.example.com,cn=digest-md5,cn=auth
|
|
|
|
> ldap:///dc=eng,dc=example,dc=com??one?(&(uid=$1)(objectClass=person))
|
2002-08-07 11:00:00 +08:00
|
|
|
>
|
|
|
|
> # Match Accounting realm
|
2005-07-29 11:58:58 +08:00
|
|
|
> authz-regexp
|
2004-05-31 06:24:00 +08:00
|
|
|
> uid=([^,].*),cn=accounting.example.com,cn=digest-md5,cn=auth
|
|
|
|
> ldap:///dc=accounting,dc=example,dc=com??one?(&(uid=$1)(objectClass=person))
|
2002-08-07 11:00:00 +08:00
|
|
|
>
|
|
|
|
> # Default realm is customers.example.com
|
2005-07-29 11:58:58 +08:00
|
|
|
> authz-regexp
|
2004-05-31 06:24:00 +08:00
|
|
|
> uid=([^,]*),cn=digest-md5,cn=auth
|
|
|
|
> ldap:///dc=customers,dc=example,dc=com??one?(&(uid=$1)(objectClass=person))
|
2002-08-07 11:00:00 +08:00
|
|
|
|
2002-08-28 09:16:25 +08:00
|
|
|
Note that the explicitly-named realms are handled first, to avoid
|
2004-05-31 06:24:00 +08:00
|
|
|
the realm name becoming part of the UID. Also note the use of scope
|
|
|
|
and filters to limit matching to desirable entries.
|
2002-08-07 11:00:00 +08:00
|
|
|
|
2006-06-28 04:22:28 +08:00
|
|
|
Note as well that {{EX:authz-regexp}} internal search are subject
|
|
|
|
to access controls. Specifically, the authentication identity
|
|
|
|
must have {{EX:auth}} access.
|
|
|
|
|
2002-08-07 11:00:00 +08:00
|
|
|
See {{slapd.conf}}(5) for more detailed information.
|
|
|
|
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2002-08-28 07:24:43 +08:00
|
|
|
H2: SASL Proxy Authorization
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2002-08-28 07:24:43 +08:00
|
|
|
The SASL offers a feature known as {{proxy authorization}}, which
|
|
|
|
allows an authenticated user to request that they act on the behalf
|
|
|
|
of another user. This step occurs after the user has obtained an
|
2001-01-18 10:18:29 +08:00
|
|
|
authentication DN, and involves sending an authorization identity
|
|
|
|
to the server. The server will then make a decision on whether or
|
|
|
|
not to allow the authorization to occur. If it is allowed, the
|
|
|
|
user's LDAP connection is switched to have a binding DN derived
|
|
|
|
from the authorization identity, and the LDAP session proceeds with
|
|
|
|
the access of the new authorization DN.
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
The decision to allow an authorization to proceed depends on the
|
|
|
|
rules and policies of the site where LDAP is running, and thus
|
|
|
|
cannot be made by SASL alone. The SASL library leaves it up to the
|
|
|
|
server to make the decision. The LDAP administrator sets the
|
|
|
|
guidelines of who can authorize to what identity by adding information
|
2002-06-14 21:03:20 +08:00
|
|
|
into the LDAP database entries. By default, the authorization
|
|
|
|
features are disabled, and must be explicitly configured by the
|
|
|
|
LDAP administrator before use.
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2002-08-28 07:24:43 +08:00
|
|
|
|
|
|
|
H3: Uses of Proxy Authorization
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
This sort of service is useful when one entity needs to act on the
|
|
|
|
behalf of many other users. For example, users may be directed to
|
|
|
|
a web page to make changes to their personal information in their
|
|
|
|
LDAP entry. The users authenticate to the web server to establish
|
|
|
|
their identity, but the web server CGI cannot authenticate to the
|
|
|
|
LDAP server as that user to make changes for them. Instead, the
|
|
|
|
web server authenticates itself to the LDAP server as a service
|
|
|
|
identity, say,
|
2001-01-18 07:48:53 +08:00
|
|
|
|
|
|
|
> cn=WebUpdate,dc=example,dc=com
|
|
|
|
|
|
|
|
and then it will SASL authorize to the DN of the user. Once so
|
2001-01-18 10:18:29 +08:00
|
|
|
authorized, the CGI makes changes to the LDAP entry of the user,
|
|
|
|
and as far as the slapd server can tell for its ACLs, it is the
|
|
|
|
user themself on the other end of the connection. The user could
|
|
|
|
have connected to the LDAP server directly and authenticated as
|
|
|
|
themself, but that would require the user to have more knowledge
|
|
|
|
of LDAP clients, knowledge which the web page provides in an easier
|
|
|
|
format.
|
|
|
|
|
2002-08-28 07:24:43 +08:00
|
|
|
Proxy authorization can also be used to limit access to an account
|
|
|
|
that has greater access to the database. Such an account, perhaps
|
|
|
|
even the root DN specified in {{slapd.conf}}(5), can have a strict
|
|
|
|
list of people who can authorize to that DN. Changes to the LDAP
|
|
|
|
database could then be only allowed by that DN, and in order to
|
|
|
|
become that DN, users must first authenticate as one of the persons
|
|
|
|
on the list. This allows for better auditing of who made changes
|
|
|
|
to the LDAP database. If people were allowed to authenticate
|
2007-08-07 00:08:05 +08:00
|
|
|
directly to the privileged account, possibly through the {{EX:rootpw}}
|
2001-01-18 10:18:29 +08:00
|
|
|
{{slapd.conf}}(5) directive or through a {{EX:userPassword}}
|
|
|
|
attribute, then auditing becomes more difficult.
|
|
|
|
|
2002-08-28 07:24:43 +08:00
|
|
|
Note that after a successful proxy authorization, the original
|
|
|
|
authentication DN of the LDAP connection is overwritten by the new
|
|
|
|
DN from the authorization request. If a service program is able to
|
|
|
|
authenticate itself as its own authentication DN and then authorize
|
|
|
|
to other DN's, and it is planning on switching to several different
|
|
|
|
identities during one LDAP session, it will need to authenticate
|
|
|
|
itself each time before authorizing to another DN (or use a different
|
|
|
|
proxy authorization mechanism). The slapd server does not keep
|
|
|
|
record of the service program's ability to switch to other DN's.
|
|
|
|
On authentication mechanisms like Kerberos this will not require
|
|
|
|
multiple connections being made to the Kerberos server, since the
|
|
|
|
user's TGT and "ldap" session key are valid for multiple uses for
|
|
|
|
the several hours of the ticket lifetime.
|
|
|
|
|
|
|
|
|
|
|
|
H3: SASL Authorization Identities
|
|
|
|
|
2002-08-28 09:11:47 +08:00
|
|
|
The SASL authorization identity is sent to the LDAP server via the
|
|
|
|
{{EX:-X}} switch for {{ldapsearch}}(1) and other tools, or in the
|
|
|
|
{{EX:*authzid}} parameter to the {{lutil_sasl_defaults}}() call.
|
|
|
|
The identity can be in one of two forms, either
|
2001-01-18 07:48:53 +08:00
|
|
|
|
|
|
|
> u:<username>
|
|
|
|
|
|
|
|
or
|
|
|
|
|
|
|
|
> dn:<dn>
|
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
In the first form, the <username> is from the same namespace as
|
|
|
|
the authentication identities above. It is the user's username as
|
2007-08-07 00:08:05 +08:00
|
|
|
it is referred to by the underlying authentication mechanism.
|
2001-01-18 10:18:29 +08:00
|
|
|
Authorization identities of this form are converted into a DN format
|
|
|
|
by the same function that the authentication process used, producing
|
|
|
|
an {{authorization request DN}} of the form
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2002-04-20 15:44:02 +08:00
|
|
|
> uid=<username>,cn=<realm>,cn=<mechanism>,cn=auth
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
That authorization request DN is then run through the same
|
2005-07-29 11:58:58 +08:00
|
|
|
{{EX:authz-regexp}} process to convert it into a legitimate authorization
|
2001-01-18 10:18:29 +08:00
|
|
|
DN from the database. If it cannot be converted due to a failed
|
|
|
|
search from an LDAP URL, the authorization request fails with
|
|
|
|
"inappropriate access". Otherwise, the DN string is now a legitimate
|
|
|
|
authorization DN ready to undergo approval.
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
If the authorization identity was provided in the second form, with
|
2002-06-14 21:03:20 +08:00
|
|
|
a {{EX:"dn:"}} prefix, the string after the prefix is already in
|
2001-05-12 14:15:42 +08:00
|
|
|
authorization DN form, ready to undergo approval.
|
2001-01-18 07:48:53 +08:00
|
|
|
|
|
|
|
|
2002-08-28 07:24:43 +08:00
|
|
|
H3: Proxy Authorization Rules
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2001-01-18 10:18:29 +08:00
|
|
|
Once slapd has the authorization DN, the actual approval process
|
|
|
|
begins. There are two attributes that the LDAP administrator can
|
|
|
|
put into LDAP entries to allow authorization:
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2005-07-29 11:58:58 +08:00
|
|
|
> authzTo
|
|
|
|
> authzFrom
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2005-07-29 11:58:58 +08:00
|
|
|
Both can be multivalued. The {{EX:authzTo}} attribute is a
|
2002-06-15 04:53:52 +08:00
|
|
|
source rule, and it is placed into the entry associated with the
|
|
|
|
authentication DN to tell what authorization DNs the authenticated
|
|
|
|
DN is allowed to assume. The second attribute is a destination
|
|
|
|
rule, and it is placed into the entry associated with the requested
|
|
|
|
authorization DN to tell which authenticated DNs may assume it.
|
|
|
|
|
|
|
|
The choice of which authorization policy attribute to use is up to
|
|
|
|
the administrator. Source rules are checked first in the person's
|
2005-07-29 11:58:58 +08:00
|
|
|
authentication DN entry, and if none of the {{EX:authzTo}} rules
|
|
|
|
specify the authorization is permitted, the {{EX:authzFrom}}
|
2002-06-15 04:53:52 +08:00
|
|
|
rules in the authorization DN entry are then checked. If neither
|
|
|
|
case specifies that the request be honored, the request is denied.
|
2007-08-07 00:08:05 +08:00
|
|
|
Since the default behavior is to deny authorization requests, rules
|
2002-06-15 04:53:52 +08:00
|
|
|
only specify that a request be allowed; there are no negative rules
|
|
|
|
telling what authorizations to deny.
|
2001-01-18 10:18:29 +08:00
|
|
|
|
|
|
|
The value(s) in the two attributes are of the same form as the
|
2005-07-29 11:58:58 +08:00
|
|
|
output of the replacement pattern of a {{EX:authz-regexp}} directive:
|
|
|
|
either a DN or an LDAP URL. For example, if a {{EX:authzTo}}
|
2002-06-15 05:47:09 +08:00
|
|
|
value is a DN, that DN is one the authenticated user can authorize
|
2005-07-29 11:58:58 +08:00
|
|
|
to. On the other hand, if the {{EX:authzTo}} value is an LDAP
|
2002-06-15 05:47:09 +08:00
|
|
|
URL, the URL is used as an internal search of the LDAP database,
|
|
|
|
and the authenticated user can become ANY DN returned by the search.
|
2001-05-12 14:15:42 +08:00
|
|
|
If an LDAP entry looked like:
|
2001-01-18 07:48:53 +08:00
|
|
|
|
|
|
|
> dn: cn=WebUpdate,dc=example,dc=com
|
2005-07-29 11:58:58 +08:00
|
|
|
> authzTo: ldap:///dc=example,dc=com??sub?(objectclass=person)
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2003-12-05 03:34:02 +08:00
|
|
|
then any user who authenticated as {{EX:cn=WebUpdate,dc=example,dc=com}}
|
2001-01-18 07:48:53 +08:00
|
|
|
could authorize to any other LDAP entry under the search base
|
2003-12-05 03:34:02 +08:00
|
|
|
{{EX:dc=example,dc=com}} which has an objectClass of {{EX:Person}}.
|
2001-01-18 07:48:53 +08:00
|
|
|
|
|
|
|
|
2002-08-28 07:24:43 +08:00
|
|
|
H4: Notes on Proxy Authorization Rules
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2005-07-29 11:58:58 +08:00
|
|
|
An LDAP URL in a {{EX:authzTo}} or {{EX:authzFrom}} attribute
|
2003-12-05 03:34:02 +08:00
|
|
|
will return a set of DNs. Each DN returned will be checked. Searches
|
|
|
|
which return a large set can cause the authorization process to
|
|
|
|
take an uncomfortably long time. Also, searches should be performed
|
|
|
|
on attributes that have been indexed by slapd.
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2005-07-29 11:58:58 +08:00
|
|
|
To help produce more sweeping rules for {{EX:authzFrom}} and
|
|
|
|
{{EX:authzTo}}, the values of these attributes are allowed to
|
2001-05-12 14:15:42 +08:00
|
|
|
be DNs with regular expression characters in them. This means a
|
|
|
|
source rule like
|
2001-01-18 07:48:53 +08:00
|
|
|
|
2005-07-29 11:58:58 +08:00
|
|
|
> authzTo: uid=[^,]*,dc=example,dc=com
|
2001-01-18 07:48:53 +08:00
|
|
|
|
|
|
|
would allow that authenticated user to authorize to any DN that
|
|
|
|
matches the regular expression pattern given. This regular expression
|
2001-01-18 10:18:29 +08:00
|
|
|
comparison can be evaluated much faster than an LDAP search for
|
2002-08-28 09:16:25 +08:00
|
|
|
{{EX:(uid=*)}}.
|
2001-01-18 10:18:29 +08:00
|
|
|
|
|
|
|
Also note that the values in an authorization rule must be one of
|
|
|
|
the two forms: an LDAP URL or a DN (with or without regular expression
|
2002-08-29 12:56:05 +08:00
|
|
|
characters). Anything that does not begin with "{{EX:ldap://}}" is
|
2007-08-07 00:08:05 +08:00
|
|
|
taken as a DN. It is not permissible to enter another authorization
|
2002-08-29 12:56:05 +08:00
|
|
|
identity of the form "{{EX:u:<username>}}" as an authorization rule.
|
2001-01-18 10:18:29 +08:00
|
|
|
|
2002-08-28 09:16:25 +08:00
|
|
|
|
2002-06-14 21:03:20 +08:00
|
|
|
H4: Policy Configuration
|
|
|
|
|
2005-07-29 11:58:58 +08:00
|
|
|
The decision of which type of rules to use, {{EX:authzFrom}}
|
|
|
|
or {{EX:authzTo}}, will depend on the site's situation. For
|
2002-08-28 07:24:43 +08:00
|
|
|
example, if the set of people who may become a given identity can
|
|
|
|
easily be written as a search filter, then a single destination
|
|
|
|
rule could be written. If the set of people is not easily defined
|
|
|
|
by a search filter, and the set of people is small, it may be better
|
|
|
|
to write a source rule in the entries of each of those people who
|
|
|
|
should be allowed to perform the proxy authorization.
|
|
|
|
|
|
|
|
By default, processing of proxy authorization rules is disabled.
|
2005-07-29 11:58:58 +08:00
|
|
|
The {{EX:authz-policy}} directive must be set in the
|
2002-08-28 07:24:43 +08:00
|
|
|
{{slapd.conf}}(5) file to enable authorization. This directive can
|
2007-04-05 09:20:42 +08:00
|
|
|
be set to {{EX:none}} for no rules (the default), {{EX:to}} for
|
|
|
|
source rules, {{EX:from}} for destination rules, or {{EX:both}} for
|
2002-08-28 07:24:43 +08:00
|
|
|
both source and destination rules.
|
2002-06-14 21:03:20 +08:00
|
|
|
|
2007-04-05 09:20:42 +08:00
|
|
|
Source rules are extremely powerful. If ordinary users have
|
2005-07-29 11:58:58 +08:00
|
|
|
access to write the {{EX:authzTo}} attribute in their own
|
2003-12-05 03:34:02 +08:00
|
|
|
entries, then they can write rules that would allow them to authorize
|
2007-04-05 09:20:42 +08:00
|
|
|
as anyone else. As such, when using source rules, the
|
2005-07-29 11:58:58 +08:00
|
|
|
{{EX:authzTo}} attribute should be protected with an ACL that
|
2003-12-05 03:34:02 +08:00
|
|
|
only allows privileged users to set its values.
|
|
|
|
|