2002-06-13 11:59:10 +08:00
|
|
|
.TH SLAPD-META 5 "RELEASEDATE" "OpenLDAP LDVERSION"
|
2003-01-04 04:20:47 +08:00
|
|
|
.\" Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
2002-04-30 04:24:29 +08:00
|
|
|
.\" Copying restrictions apply. See the COPYRIGHT file.
|
|
|
|
.\" Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
|
|
|
|
.\" $OpenLDAP$
|
|
|
|
.\"
|
|
|
|
.\" Portions of this document should probably be moved to slapd-ldap(5)
|
|
|
|
.\" and maybe manual pages for librewrite.
|
|
|
|
.\"
|
|
|
|
.SH NAME
|
2002-05-09 10:07:41 +08:00
|
|
|
slapd-meta \- metadirectory backend
|
2002-04-30 04:24:29 +08:00
|
|
|
.SH SYNOPSIS
|
|
|
|
ETCDIR/slapd.conf
|
|
|
|
.SH DESCRIPTION
|
|
|
|
The
|
|
|
|
.B meta
|
|
|
|
backend to
|
|
|
|
.BR slapd (8)
|
|
|
|
performs basic LDAP proxying with respect to a set of remote LDAP
|
|
|
|
servers, called "targets".
|
|
|
|
The information contained in these servers can be presented as
|
|
|
|
belonging to a single Directory Information Tree (DIT).
|
|
|
|
.LP
|
|
|
|
A basic knowledge of the functionality of the
|
2002-04-30 04:36:04 +08:00
|
|
|
.BR slapd\-ldap (5)
|
2002-04-30 04:24:29 +08:00
|
|
|
backend is recommended.
|
|
|
|
This backend has been designed as an enhancement of the ldap backend.
|
|
|
|
The two backends share many features (actually they also share
|
|
|
|
portions of code).
|
|
|
|
While the
|
|
|
|
.B ldap
|
|
|
|
backend is intended to proxy operations directed to a single server, the
|
|
|
|
.B meta
|
|
|
|
backend is mainly intended for proxying of multiple servers and possibly
|
|
|
|
naming context masquerading.
|
|
|
|
These features, although useful in many scenarios, may result in
|
|
|
|
excessive overhead for some applications, so its use should be
|
|
|
|
carefully considered.
|
|
|
|
In the examples section, some typical scenarios will be discussed.
|
|
|
|
.SH EXAMPLES
|
2002-04-30 04:36:04 +08:00
|
|
|
There are examples in various places in this document, as well as in the
|
2002-04-30 04:24:29 +08:00
|
|
|
slapd/back-meta/data/ directory in the OpenLDAP source tree.
|
|
|
|
.SH CONFIGURATION
|
2002-05-02 00:38:30 +08:00
|
|
|
These
|
|
|
|
.B slapd.conf
|
|
|
|
options apply to the META backend database.
|
2002-04-30 04:24:29 +08:00
|
|
|
That is, they must follow a "database meta" line and come before any
|
|
|
|
subsequent "backend" or "database" lines.
|
2002-05-02 00:38:30 +08:00
|
|
|
Other database options are described in the
|
|
|
|
.BR slapd.conf (5)
|
|
|
|
manual page.
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
|
|
|
Note: as with the
|
|
|
|
.B ldap
|
|
|
|
backend, operational attributes related to entry creation/modification
|
|
|
|
should not be used, as they would be passed to the target servers,
|
|
|
|
generating an error.
|
|
|
|
Moreover, it makes little sense to use such attributes in proxying, as
|
|
|
|
the proxy server doesn't actually store data, so it should have no
|
|
|
|
knowledge of such attributes.
|
|
|
|
While code to strip the modification attributes has been put in place
|
|
|
|
(and #ifdef'd), it implies unmotivated overhead.
|
|
|
|
So it is strongly recommended to set
|
2002-05-03 00:35:16 +08:00
|
|
|
.RS
|
|
|
|
lastmod off
|
|
|
|
.RE
|
2002-04-30 04:24:29 +08:00
|
|
|
for every
|
|
|
|
.B ldap
|
|
|
|
and
|
|
|
|
.B meta
|
|
|
|
backend.
|
2002-05-02 00:38:30 +08:00
|
|
|
.SH SPECIAL CONFIGURATION DIRECTIVES
|
2002-04-30 04:24:29 +08:00
|
|
|
Target configuration starts with the "uri" directive.
|
|
|
|
All the configuration directives that are not specific to targets
|
|
|
|
should be defined first for clarity, including those that are common
|
|
|
|
to all backends.
|
|
|
|
They are:
|
|
|
|
.TP
|
|
|
|
.B default-target none
|
|
|
|
This directive forces the backend to reject all those operations
|
|
|
|
that must resolve to a single target in case none or multiple
|
|
|
|
targets are selected.
|
|
|
|
They include: add, delete, modify, modrdn; compare is not included, as
|
|
|
|
well as bind since, as they don't alter entries, in case of multiple
|
|
|
|
matches an attempt is made to perform the operation on any candidate
|
2002-04-30 04:36:04 +08:00
|
|
|
target, with the constraint that at most one must succeed.
|
2002-04-30 04:24:29 +08:00
|
|
|
This directive can also be used when processing targets to mark a
|
|
|
|
specific target as default.
|
|
|
|
.TP
|
|
|
|
.B dncache-ttl {forever|disabled|<ttl>}
|
2002-05-02 00:38:30 +08:00
|
|
|
This directive sets the time-to-live of the DN cache.
|
|
|
|
This caches the target that holds a given DN to speed up target
|
2002-04-30 04:24:29 +08:00
|
|
|
selection in case multiple targets would result from an uncached
|
2002-05-02 00:38:30 +08:00
|
|
|
search; forever means cache never expires; disabled means no DN
|
2002-04-30 04:24:29 +08:00
|
|
|
caching; otherwise a valid ( > 0 ) ttl in seconds is required.
|
2002-05-02 00:38:30 +08:00
|
|
|
.SH TARGET SPECIFICATION
|
2002-04-30 04:24:29 +08:00
|
|
|
Target specification starts with a "uri" directive:
|
|
|
|
.TP
|
|
|
|
.B uri <protocol>://[<host>[:<port>]]/<naming context>
|
|
|
|
The "server" directive that was allowed in the LDAP backend (although
|
|
|
|
deprecated) has been discarded in the Meta backend.
|
2002-12-16 15:31:13 +08:00
|
|
|
The <protocol> part can be anything
|
|
|
|
.BR ldap_initialize (3)
|
|
|
|
accepts ({ldap|ldaps|ldapi} and variants); <host> and <port> may be
|
|
|
|
omitted, defaulting to whatever is set in /etc/ldap.conf.
|
2002-04-30 04:24:29 +08:00
|
|
|
The <naming context> part is mandatory.
|
|
|
|
It must end with one of the naming contexts defined for the backend,
|
|
|
|
e.g.:
|
|
|
|
.LP
|
2002-05-03 00:35:16 +08:00
|
|
|
.RS
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
suffix "\fBdc=foo,dc=com\fP"
|
|
|
|
uri "ldap://x.foo.com/dc=x,\fBdc=foo,dc=com\fP"
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
2002-05-03 00:35:16 +08:00
|
|
|
.RE
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
|
|
|
The <naming context> part doesn't need to be unique across the targets;
|
|
|
|
it may also match one of the values of the "suffix" directive.
|
2003-02-05 03:50:17 +08:00
|
|
|
Multiple URIs may be defined in a single argument. The URIs must
|
|
|
|
be separated by TABs (e.g. '\\t'), and the additional URIs must have
|
|
|
|
no <naming context> part. This causes the underlying library
|
|
|
|
to contact the first server of the list that responds.
|
2002-04-30 04:24:29 +08:00
|
|
|
.TP
|
|
|
|
.B default-target [<target>]
|
|
|
|
The "default-target" directive can also be used during target specification.
|
|
|
|
With no arguments it marks the current target as the default.
|
|
|
|
The optional number marks target <target> as the default one, starting
|
|
|
|
from 1.
|
|
|
|
Target <target> must be defined.
|
|
|
|
.TP
|
2002-05-02 00:38:30 +08:00
|
|
|
.B binddn "<administrative DN for access control purposes>"
|
|
|
|
This directive, as in the LDAP backend, allows to define the DN that is
|
2002-04-30 04:24:29 +08:00
|
|
|
used to query the target server for acl checking; it should have read
|
|
|
|
access on the target server to attributes used on the proxy for acl
|
|
|
|
checking.
|
|
|
|
There is no risk of giving away such values; they are only used to
|
|
|
|
check permissions.
|
|
|
|
.TP
|
2002-04-30 04:36:04 +08:00
|
|
|
.B bindpw <password for access control purposes>
|
2002-04-30 04:24:29 +08:00
|
|
|
This directive sets the password for acl checking in conjunction
|
|
|
|
with the above mentioned "binddn" directive.
|
|
|
|
.TP
|
2003-02-06 06:04:20 +08:00
|
|
|
.B rebind-as-user
|
|
|
|
If this option is given, the client's bind credentials are remembered
|
|
|
|
for rebinds when chasing referrals.
|
|
|
|
.TP
|
2002-05-02 00:38:30 +08:00
|
|
|
.B pseudorootdn "<substitute DN in case of rootdn bind>"
|
|
|
|
This directive, if present, sets the DN that will be substituted to
|
|
|
|
the bind DN if a bind with the backend's "rootdn" succeeds.
|
2002-04-30 04:24:29 +08:00
|
|
|
The true "rootdn" of the target server ought not be used; an arbitrary
|
2002-05-02 00:38:30 +08:00
|
|
|
administrative DN should used instead.
|
2002-04-30 04:24:29 +08:00
|
|
|
.TP
|
2002-05-02 00:38:30 +08:00
|
|
|
.B pseudorootpw "<substitute password in case of rootdn bind>"
|
2002-04-30 04:24:29 +08:00
|
|
|
This directive sets the credential that will be used in case a bind
|
|
|
|
with the backend's "rootdn" succeeds, and the bind is propagated to
|
2002-05-02 00:38:30 +08:00
|
|
|
the target using the "pseudorootdn" DN.
|
2002-04-30 04:36:04 +08:00
|
|
|
.LP
|
|
|
|
Note: cleartext credentials must be supplied here; as a consequence,
|
|
|
|
using the pseudorootdn/pseudorootpw directives is inherently unsafe.
|
2002-04-30 04:24:29 +08:00
|
|
|
.TP
|
|
|
|
.B rewrite* ...
|
|
|
|
The rewrite options are described in the "REWRITING" section.
|
|
|
|
.TP
|
2002-05-02 00:38:30 +08:00
|
|
|
.B suffixmassage "<virtual naming context>" "<real naming context>"
|
2002-04-30 04:24:29 +08:00
|
|
|
All the directives starting with "rewrite" refer to the rewrite engine
|
|
|
|
that has been added to slapd.
|
|
|
|
The "suffixmassage" directive was introduced in the LDAP backend to
|
|
|
|
allow suffix massaging while proxying.
|
|
|
|
It has been obsoleted by the rewriting tools.
|
|
|
|
However, both for backward compatibility and for ease of configuration
|
|
|
|
when simple suffix massage is required, it has been preserved.
|
|
|
|
It wraps the basic rewriting instructions that perform suffix
|
|
|
|
massaging.
|
|
|
|
.LP
|
|
|
|
Note: this also fixes a flaw in suffix massaging, which operated
|
|
|
|
on (case insensitive) DNs instead of normalized DNs,
|
|
|
|
so "dc=foo, dc=com" would not match "dc=foo,dc=com".
|
|
|
|
.LP
|
|
|
|
See the "REWRITING" section.
|
|
|
|
.TP
|
2002-06-15 04:41:40 +08:00
|
|
|
.B map "{attribute|objectclass} [<local name>|*] {<foreign name>|*}"
|
2002-04-30 04:24:29 +08:00
|
|
|
This maps object classes and attributes as in the LDAP backend.
|
|
|
|
See
|
|
|
|
.BR slapd-ldap (5).
|
2002-05-02 00:38:30 +08:00
|
|
|
.SH SCENARIOS
|
2002-04-30 04:24:29 +08:00
|
|
|
A powerful (and in some sense dangerous) rewrite engine has been added
|
|
|
|
to both the LDAP and Meta backends.
|
|
|
|
While the former can gain limited beneficial effects from rewriting
|
|
|
|
stuff, the latter can become an amazingly powerful tool.
|
|
|
|
.LP
|
|
|
|
Consider a couple of scenarios first.
|
|
|
|
.LP
|
|
|
|
1) Two directory servers share two levels of naming context;
|
|
|
|
say "dc=a,dc=foo,dc=com" and "dc=b,dc=foo,dc=com".
|
|
|
|
Then, an unambiguous Meta database can be configured as:
|
|
|
|
.LP
|
2002-05-03 00:35:16 +08:00
|
|
|
.RS
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
database meta
|
|
|
|
suffix "\fBdc=foo,dc=com\fP"
|
|
|
|
uri "ldap://a.foo.com/dc=a,\fBdc=foo,dc=com\fP"
|
|
|
|
uri "ldap://b.foo.com/dc=b,\fBdc=foo,dc=com\fP"
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
2002-05-03 00:35:16 +08:00
|
|
|
.RE
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
|
|
|
Operations directed to a specific target can be easily resolved
|
|
|
|
because there are no ambiguities.
|
|
|
|
The only operation that may resolve to multiple targets is a search
|
|
|
|
with base "dc=foo,dc=com" and scope at least "one", which results in
|
|
|
|
spawning two searches to the targets.
|
|
|
|
.LP
|
|
|
|
2a) Two directory servers don't share any portion of naming context,
|
2002-04-30 04:36:04 +08:00
|
|
|
but they'd present as a single DIT
|
2002-04-30 04:24:29 +08:00
|
|
|
[Caveat: uniqueness of (massaged) entries among the two servers is
|
|
|
|
assumed; integrity checks risk to incur in excessive overhead and have
|
2002-05-02 00:38:30 +08:00
|
|
|
not been implemented].
|
|
|
|
Say we have "dc=bar,dc=org" and "o=Foo,c=US",
|
2002-04-30 04:24:29 +08:00
|
|
|
and we'd like them to appear as branches of "dc=foo,dc=com", say
|
|
|
|
"dc=a,dc=foo,dc=com" and "dc=b,dc=foo,dc=com".
|
|
|
|
Then we need to configure our Meta backend as:
|
|
|
|
.LP
|
2002-05-03 00:35:16 +08:00
|
|
|
.RS
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
database meta
|
|
|
|
suffix "dc=foo,dc=com"
|
|
|
|
|
|
|
|
uri "ldap://a.bar.com/\fBdc=a,dc=foo,dc=com\fP"
|
|
|
|
suffixmassage "\fBdc=a,dc=foo,dc=com\fP" "dc=bar,dc=org"
|
|
|
|
|
|
|
|
uri "ldap://b.foo.com/\fBdc=b,dc=foo,dc=com\fP"
|
|
|
|
suffixmassage "\fBdc=b,dc=foo,dc=com\fP" "o=Foo,c=US"
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
2002-05-03 00:35:16 +08:00
|
|
|
.RE
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
|
|
|
Again, operations can be resolved without ambiguity, although
|
|
|
|
some rewriting is required.
|
|
|
|
Notice that the virtual naming context of each target is a branch of
|
|
|
|
the database's naming context; it is rewritten back and forth when
|
|
|
|
operations are performed towards the target servers.
|
|
|
|
What "back and forth" means will be clarified later.
|
|
|
|
.LP
|
|
|
|
When a search with base "dc=foo,dc=com" is attempted, if the
|
|
|
|
scope is "base" it fails with "no such object"; in fact, the
|
|
|
|
common root of the two targets (prior to massaging) does not
|
|
|
|
exist.
|
|
|
|
If the scope is "one", both targets are contacted with the base
|
|
|
|
replaced by each target's base; the scope is derated to "base".
|
|
|
|
In general, a scope "one" search is honored, and the scope is derated,
|
|
|
|
only when the incoming base is at most one level lower of a target's
|
|
|
|
naming context (prior to massaging).
|
|
|
|
.LP
|
|
|
|
Finally, if the scope is "sub" the incoming base is replaced
|
|
|
|
by each target's unmassaged naming context, and the scope
|
|
|
|
is not altered.
|
|
|
|
.LP
|
|
|
|
2b) Consider the above reported scenario with the two servers
|
|
|
|
sharing the same naming context:
|
|
|
|
.LP
|
2002-05-03 00:35:16 +08:00
|
|
|
.RS
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
database meta
|
|
|
|
suffix "\fBdc=foo,dc=com\fP"
|
|
|
|
|
|
|
|
uri "ldap://a.bar.com/\fBdc=foo,dc=com\fP"
|
|
|
|
suffixmassage "\fBdc=foo,dc=com\fP" "dc=bar,dc=org"
|
|
|
|
|
|
|
|
uri "ldap://b.foo.com/\fBdc=foo,dc=com\fP"
|
|
|
|
suffixmassage "\fBdc=foo,dc=com\fP" "o=Foo,c=US"
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
2002-05-03 00:35:16 +08:00
|
|
|
.RE
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
|
|
|
All the previous considerations hold, except that now there is
|
|
|
|
no way to unambiguously resolve a DN.
|
|
|
|
In this case, all the operations that require an unambiguous target
|
2002-05-02 00:38:30 +08:00
|
|
|
selection will fail unless the DN is already cached or a default
|
2002-04-30 04:24:29 +08:00
|
|
|
target has been set.
|
2002-05-03 00:49:47 +08:00
|
|
|
Practical configurations may result as a combination of all the
|
|
|
|
above scenarios.
|
2002-04-30 04:24:29 +08:00
|
|
|
.SH ACLs
|
|
|
|
Note on ACLs: at present you may add whatever ACL rule you desire
|
|
|
|
to to the Meta (and LDAP) backends.
|
|
|
|
However, the meaning of an ACL on a proxy may require some
|
|
|
|
considerations.
|
|
|
|
Two philosophies may be considered:
|
|
|
|
.LP
|
|
|
|
a) the remote server dictates the permissions; the proxy simply passes
|
|
|
|
back what it gets from the remote server.
|
|
|
|
.LP
|
|
|
|
b) the remote server unveils "everything"; the proxy is responsible
|
|
|
|
for protecting data from unauthorized access.
|
|
|
|
.LP
|
|
|
|
Of course the latter sounds unreasonable, but it is not.
|
|
|
|
It is possible to imagine scenarios in which a remote host discloses
|
|
|
|
data that can be considered "public" inside an intranet, and a proxy
|
|
|
|
that connects it to the internet may impose additional constraints.
|
|
|
|
To this purpose, the proxy should be able to comply with all the ACL
|
|
|
|
matching criteria that the server supports.
|
|
|
|
This has been achieved with regard to all the criteria supported by
|
|
|
|
slapd except a special subtle case (please drop me a note if you can
|
|
|
|
find other exceptions: <ando@openldap.org>).
|
|
|
|
The rule
|
|
|
|
.LP
|
2002-05-03 00:35:16 +08:00
|
|
|
.RS
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
access to dn="<dn>" attr=<attr>
|
|
|
|
by dnattr=<dnattr> read
|
|
|
|
by * none
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
2002-05-03 00:35:16 +08:00
|
|
|
.RE
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
|
|
|
cannot be matched iff the attribute that is being requested, <attr>,
|
|
|
|
is NOT <dnattr>, and the attribute that determines membership,
|
|
|
|
<dnattr>, has not been requested (e.g. in a search)
|
|
|
|
.LP
|
|
|
|
In fact this ACL is resolved by slapd using the portion of entry it
|
|
|
|
retrieved from the remote server without requiring any further
|
|
|
|
intervention of the backend, so, if the <dnattr> attribute has not
|
|
|
|
been fetched, the match cannot be assessed because the attribute is
|
|
|
|
not present, not because no value matches the requirement!
|
|
|
|
.LP
|
|
|
|
Note on ACLs and attribute mapping: ACLs are applied to the mapped
|
|
|
|
attributes; for instance, if the attribute locally known as "foo" is
|
|
|
|
mapped to "bar" on a remote server, then local ACLs apply to attribute
|
|
|
|
"foo" and are totally unaware of its remote name.
|
|
|
|
The remote server will check permissions for "bar", and the local
|
|
|
|
server will possibly enforce additional restrictions to "foo".
|
|
|
|
.\"
|
|
|
|
.\" If this section is moved, also update the reference in
|
|
|
|
.\" libraries/librewrite/RATIONALE.
|
|
|
|
.\"
|
|
|
|
.SH REWRITING
|
|
|
|
A string is rewritten according to a set of rules, called a `rewrite
|
|
|
|
context'.
|
|
|
|
The rules are based on Regular Expressions (POSIX regex) with
|
2003-12-30 02:02:49 +08:00
|
|
|
substring matching; basic variable substitution and map resolution
|
|
|
|
of substrings is allowed by specific mechanisms detailed in the following.
|
2002-04-30 04:24:29 +08:00
|
|
|
The behavior of pattern matching/substitution can be altered by a set
|
|
|
|
of flags.
|
|
|
|
.LP
|
|
|
|
The underlying concept is to build a lightweight rewrite module
|
|
|
|
for the slapd server (initially dedicated to the LDAP backend).
|
|
|
|
.SH Passes
|
|
|
|
An incoming string is matched agains a set of rules.
|
2003-12-30 02:02:49 +08:00
|
|
|
Rules are made of a regex match pattern, a substitution pattern
|
|
|
|
and a set of actions, described by a set of flags.
|
2002-04-30 04:24:29 +08:00
|
|
|
In case of match a string rewriting is performed according to the
|
|
|
|
substitution pattern that allows to refer to substrings matched in the
|
|
|
|
incoming string.
|
|
|
|
The actions, if any, are finally performed.
|
|
|
|
The substitution pattern allows map resolution of substrings.
|
|
|
|
A map is a generic object that maps a substitution pattern to a value.
|
2003-12-30 02:02:49 +08:00
|
|
|
The flags are divided in "Pattern matching Flags" and "Action Flags";
|
|
|
|
the former alter the regex match pattern behaviorm while the latter
|
|
|
|
alter the action that is taken after substitution.
|
2002-04-30 04:24:29 +08:00
|
|
|
.SH "Pattern Matching Flags"
|
|
|
|
.TP
|
|
|
|
.B `C'
|
|
|
|
honors case in matching (default is case insensitive)
|
|
|
|
.TP
|
|
|
|
.B `R'
|
|
|
|
use POSIX Basic Regular Expressions (default is Extended)
|
2003-12-30 02:02:49 +08:00
|
|
|
.TP
|
|
|
|
.B `M{n}'
|
|
|
|
allow no more than
|
|
|
|
.B n
|
|
|
|
recursive passes for a specific rule; does not alter the max total count
|
|
|
|
of passes, so it can only enforce a stricter limit for a specific rule.
|
2002-04-30 04:24:29 +08:00
|
|
|
.SH "Action Flags"
|
|
|
|
.TP
|
|
|
|
.B `:'
|
|
|
|
apply the rule once only (default is recursive)
|
|
|
|
.TP
|
|
|
|
.B `@'
|
2003-12-30 01:06:43 +08:00
|
|
|
stop applying rules in case of match; the current rule is still applied
|
|
|
|
recursively; combine with `:' to apply the current rule only once
|
|
|
|
and then stop.
|
2002-04-30 04:24:29 +08:00
|
|
|
.TP
|
|
|
|
.B `#'
|
|
|
|
stop current operation if the rule matches, and issue an `unwilling to
|
|
|
|
perform' error.
|
|
|
|
.TP
|
|
|
|
.B `G{n}'
|
2003-12-30 01:06:43 +08:00
|
|
|
jump
|
|
|
|
.B n
|
|
|
|
rules back and forth (watch for loops!).
|
2002-04-30 04:24:29 +08:00
|
|
|
Note that `G{1}' is implicit in every rule.
|
|
|
|
.TP
|
|
|
|
.B `I'
|
|
|
|
ignores errors in rule; this means, in case of error, e.g. issued by a
|
|
|
|
map, the error is treated as a missed match.
|
|
|
|
The `unwilling to perform' is not overridden.
|
2003-12-30 01:06:43 +08:00
|
|
|
.TP
|
|
|
|
.B `U{n}'
|
|
|
|
uses
|
|
|
|
.B
|
|
|
|
n
|
|
|
|
as return code if the rule matches; the flag does not alter the recursive
|
|
|
|
behavior of the rule, so, to have it performed only once, it must be used
|
|
|
|
in combination with `:', e.g.
|
|
|
|
.B `:U{16}'
|
|
|
|
returns the value `16' after exactly one execution of the rule, if the
|
|
|
|
pattern matches.
|
|
|
|
As a consequence, its behavior is equivalent to `@', with the return
|
|
|
|
code set to
|
|
|
|
.BR n ;
|
|
|
|
or, in other words, `@' is equivalent to `U{0}'.
|
|
|
|
By convention, the freely available codes are above 16 included;
|
|
|
|
the others are reserved.
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
2003-12-30 02:02:49 +08:00
|
|
|
The ordering of the flags can be significant.
|
2002-04-30 04:24:29 +08:00
|
|
|
For instance: `IG{2}' means ignore errors and jump two lines ahead
|
|
|
|
both in case of match and in case of error, while `G{2}I' means ignore
|
2003-12-29 23:22:10 +08:00
|
|
|
errors, but jump two lines ahead only in case of match.
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
|
|
|
More flags (mainly Action Flags) will be added as needed.
|
|
|
|
.SH "Pattern matching:"
|
|
|
|
See
|
|
|
|
.BR regex (7).
|
2002-05-02 00:38:30 +08:00
|
|
|
.SH "Substitution Pattern Syntax:"
|
2002-05-03 00:35:16 +08:00
|
|
|
Everything starting with `%' requires substitution;
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
2002-05-02 00:38:30 +08:00
|
|
|
the only obvious exception is `%%', which is left as is;
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
2002-05-02 00:38:30 +08:00
|
|
|
the basic substitution is `%d', where `d' is a digit;
|
|
|
|
0 means the whole string, while 1-9 is a submatch, as discussed in
|
|
|
|
.BR regex (7);
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
2002-05-02 00:38:30 +08:00
|
|
|
a `%' followed by a `{' invokes an advanced substitution.
|
2002-04-30 04:24:29 +08:00
|
|
|
The pattern is:
|
|
|
|
.LP
|
2002-05-03 00:35:16 +08:00
|
|
|
.RS
|
|
|
|
`%' `{' [ <op> ] <name> `(' <substitution> `)' `}'
|
|
|
|
.RE
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
|
|
|
where <name> must be a legal name for the map, i.e.
|
|
|
|
.LP
|
2002-05-03 00:35:16 +08:00
|
|
|
.RS
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
<name> ::= [a-z][a-z0-9]* (case insensitive)
|
|
|
|
<op> ::= `>' `|' `&' `&&' `*' `**' `$'
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
2002-05-03 00:35:16 +08:00
|
|
|
.RE
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
2002-05-02 00:38:30 +08:00
|
|
|
and <substitution> must be a legal substitution
|
|
|
|
pattern, with no limits on the nesting level.
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
|
|
|
The operators are:
|
|
|
|
.TP
|
|
|
|
.B >
|
|
|
|
sub context invocation; <name> must be a legal, already defined
|
|
|
|
rewrite context name
|
|
|
|
.TP
|
|
|
|
.B |
|
|
|
|
external command invocation; <name> must refer to a legal, already
|
|
|
|
defined command name (NOT IMPL.)
|
|
|
|
.TP
|
|
|
|
.B &
|
|
|
|
variable assignment; <name> defines a variable in the running
|
2002-05-02 00:38:30 +08:00
|
|
|
operation structure which can be dereferenced later; operator
|
|
|
|
.B &
|
|
|
|
assigns a variable in the rewrite context scope; operator
|
|
|
|
.B &&
|
|
|
|
assigns a variable that scopes the entire session, e.g. its value
|
|
|
|
can be derefenced later by other rewrite contexts
|
2002-04-30 04:24:29 +08:00
|
|
|
.TP
|
|
|
|
.B *
|
|
|
|
variable dereferencing; <name> must refer to a variable that is
|
2002-05-02 00:38:30 +08:00
|
|
|
defined and assigned for the running operation; operator
|
|
|
|
.B *
|
|
|
|
dereferences a variable scoping the rewrite context; operator
|
|
|
|
.B **
|
|
|
|
dereferences a variable scoping the whole session, e.g. the value
|
|
|
|
is passed across rewrite contexts
|
2002-04-30 04:24:29 +08:00
|
|
|
.TP
|
|
|
|
.B $
|
|
|
|
parameter dereferencing; <name> must refer to an existing parameter;
|
|
|
|
the idea is to make some run-time parameters set by the system
|
2002-05-02 00:38:30 +08:00
|
|
|
available to the rewrite engine, as the client host name, the bind DN
|
|
|
|
if any, constant parameters initialized at config time, and so on;
|
|
|
|
no parameter is currently set by either
|
|
|
|
.B back\-ldap
|
|
|
|
or
|
|
|
|
.BR back\-meta ,
|
|
|
|
but constant parameters can be defined in the configuration file
|
|
|
|
by using the
|
|
|
|
.B rewriteParam
|
|
|
|
directive.
|
|
|
|
.LP
|
|
|
|
Substitution escaping has been delegated to the `%' symbol,
|
|
|
|
which is used instead of `\e' in string substitution patterns
|
|
|
|
because `\e' is already escaped by slapd's low level parsing routines;
|
|
|
|
as a consequence,
|
|
|
|
.BR regex (7)
|
|
|
|
escaping requires two `\e' symbols, e.g. `\fB.*\e.foo\e.bar\fP' must
|
|
|
|
be written as `\fB.*\e\e.foo\e\e.bar\fP'.
|
|
|
|
.\"
|
|
|
|
.\" The symbol can be altered at will by redefining the related macro in
|
|
|
|
.\" "rewrite-int.h".
|
|
|
|
.\"
|
2002-04-30 04:24:29 +08:00
|
|
|
.SH "Rewrite context:"
|
|
|
|
A rewrite context is a set of rules which are applied in sequence.
|
|
|
|
The basic idea is to have an application initialize a rewrite
|
|
|
|
engine (think of Apache's mod_rewrite ...) with a set of rewrite
|
|
|
|
contexts; when string rewriting is required, one invokes the
|
|
|
|
appropriate rewrite context with the input string and obtains the
|
|
|
|
newly rewritten one if no errors occur.
|
|
|
|
.LP
|
2002-05-02 00:38:30 +08:00
|
|
|
Each basic server operation is associated to a rewrite context;
|
|
|
|
they are divided in two main groups: client \-> server and
|
|
|
|
server \-> client rewriting.
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
|
|
|
client -> server:
|
|
|
|
.LP
|
2002-05-03 00:35:16 +08:00
|
|
|
.RS
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
(default) if defined and no specific context
|
|
|
|
is available
|
2003-04-16 04:55:29 +08:00
|
|
|
bindDN bind
|
2002-05-03 00:35:16 +08:00
|
|
|
searchBase search
|
|
|
|
searchFilter search
|
2003-04-16 04:55:29 +08:00
|
|
|
compareDN compare
|
|
|
|
compareAttrDN compare AVA
|
|
|
|
addDN add
|
|
|
|
addAttrDN add AVA
|
|
|
|
modifyDN modify
|
|
|
|
modifyAttrDN modify AVA
|
|
|
|
modrDN modrdn
|
|
|
|
newSuperiorDN modrdn
|
|
|
|
deleteDN delete
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
2002-05-03 00:35:16 +08:00
|
|
|
.RE
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
|
|
|
server -> client:
|
|
|
|
.LP
|
2002-05-03 00:35:16 +08:00
|
|
|
.RS
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
searchResult search (only if defined; no default;
|
|
|
|
acts on DN and DN-syntax attributes
|
|
|
|
of search results)
|
2003-04-16 04:55:29 +08:00
|
|
|
searchAttrDN search AVA
|
|
|
|
matchedDN all ops (only if applicable)
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
2002-05-03 00:35:16 +08:00
|
|
|
.RE
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
|
|
|
.SH "Basic configuration syntax"
|
|
|
|
.TP
|
|
|
|
.B rewriteEngine { on | off }
|
|
|
|
If `on', the requested rewriting is performed; if `off', no
|
|
|
|
rewriting takes place (an easy way to stop rewriting without
|
|
|
|
altering too much the configuration file).
|
|
|
|
.TP
|
2002-05-02 00:38:30 +08:00
|
|
|
.B rewriteContext <context name> "[ alias <aliased context name> ]"
|
2002-04-30 04:24:29 +08:00
|
|
|
<Context name> is the name that identifies the context, i.e. the name
|
|
|
|
used by the application to refer to the set of rules it contains.
|
|
|
|
It is used also to reference sub contexts in string rewriting.
|
|
|
|
A context may aliase another one.
|
|
|
|
In this case the alias context contains no rule, and any reference to
|
|
|
|
it will result in accessing the aliased one.
|
|
|
|
.TP
|
2003-12-30 01:12:29 +08:00
|
|
|
.B rewriteRule "<regex match pattern>" "<substitution pattern>" "[ <flags> ]"
|
2003-12-30 02:02:49 +08:00
|
|
|
Determines how a string can be rewritten if a pattern is matched.
|
2002-04-30 04:24:29 +08:00
|
|
|
Examples are reported below.
|
|
|
|
.SH "Additional configuration syntax:"
|
|
|
|
.TP
|
2002-05-02 00:38:30 +08:00
|
|
|
.B rewriteMap "<map name>" "<map type>" "[ <map attrs> ]"
|
2002-04-30 04:24:29 +08:00
|
|
|
Allows to define a map that transforms substring rewriting into
|
|
|
|
something else.
|
|
|
|
The map is referenced inside the substitution pattern of a rule.
|
|
|
|
.TP
|
|
|
|
.B rewriteParam <param name> <param value>
|
|
|
|
Sets a value with global scope, that can be dereferenced by the
|
2002-05-02 00:38:30 +08:00
|
|
|
command `%{$paramName}'.
|
2002-04-30 04:24:29 +08:00
|
|
|
.TP
|
2003-12-30 02:02:49 +08:00
|
|
|
.B rewriteMaxPasses <number of passes> [<number of passes per rule>]
|
2002-05-02 00:38:30 +08:00
|
|
|
Sets the maximum number of total rewriting passes that can be
|
|
|
|
performed in a single rewrite operation (to avoid loops).
|
2003-12-30 02:02:49 +08:00
|
|
|
A safe default is set to 100; note that reaching this limit is still
|
|
|
|
treated as a success; recursive invocation of rules is simply
|
|
|
|
interrupted.
|
|
|
|
The count applies to the rewriting operation as a whole, not
|
|
|
|
to any single rule; an optional per-rule limit can be set.
|
|
|
|
This limit is overridden by setting specific per-rule limits
|
|
|
|
with the `M{n}' flag.
|
2002-04-30 04:24:29 +08:00
|
|
|
.SH "Configuration examples:"
|
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
# set to `off' to disable rewriting
|
|
|
|
rewriteEngine on
|
2002-05-02 00:38:30 +08:00
|
|
|
|
2002-05-03 00:35:16 +08:00
|
|
|
# Everything defined here goes into the `default' context.
|
|
|
|
# This rule changes the naming context of anything sent
|
|
|
|
# to `dc=home,dc=net' to `dc=OpenLDAP, dc=org'
|
2002-05-02 00:38:30 +08:00
|
|
|
|
2002-05-03 00:35:16 +08:00
|
|
|
rewriteRule "(.*)dc=home,[ ]?dc=net"
|
|
|
|
"%1dc=OpenLDAP, dc=org" ":"
|
2002-04-30 04:24:29 +08:00
|
|
|
|
2002-05-03 00:35:16 +08:00
|
|
|
# since a pretty/normalized DN does not include spaces
|
|
|
|
# after rdn separators, e.g. `,', this rule suffices:
|
2002-04-30 04:24:29 +08:00
|
|
|
|
2002-05-03 00:35:16 +08:00
|
|
|
rewriteRule "(.*)dc=home,dc=net"
|
|
|
|
"%1dc=OpenLDAP,dc=org" ":"
|
2002-04-30 04:24:29 +08:00
|
|
|
|
2002-05-03 00:35:16 +08:00
|
|
|
# Start a new context (ends input of the previous one).
|
|
|
|
# This rule adds blanks between DN parts if not present.
|
|
|
|
rewriteContext addBlanks
|
|
|
|
rewriteRule "(.*),([^ ].*)" "%1, %2"
|
2002-04-30 04:24:29 +08:00
|
|
|
|
2002-05-03 00:35:16 +08:00
|
|
|
# This one eats blanks
|
|
|
|
rewriteContext eatBlanks
|
|
|
|
rewriteRule "(.*),[ ](.*)" "%1,%2"
|
2002-04-30 04:24:29 +08:00
|
|
|
|
2002-05-03 00:35:16 +08:00
|
|
|
# Here control goes back to the default rewrite
|
|
|
|
# context; rules are appended to the existing ones.
|
|
|
|
# anything that gets here is piped into rule `addBlanks'
|
|
|
|
rewriteContext default
|
|
|
|
rewriteRule ".*" "%{>addBlanks(%0)}" ":"
|
2002-04-30 04:24:29 +08:00
|
|
|
|
2002-05-03 00:35:16 +08:00
|
|
|
.\" # Anything with `uid=username' is looked up in
|
|
|
|
.\" # /etc/passwd for gecos (I know it's nearly useless,
|
|
|
|
.\" # but it is there just as a guideline to implementing
|
|
|
|
.\" # custom maps).
|
|
|
|
.\" # Note the `I' flag that leaves `uid=username' in place
|
|
|
|
.\" # if `username' does not have a valid account, and the
|
|
|
|
.\" # `:' that forces the rule to be processed exactly once.
|
|
|
|
.\" rewriteContext uid2Gecos
|
|
|
|
.\" rewriteRule "(.*)uid=([a-z0-9]+),(.+)"
|
|
|
|
.\" "%1cn=%2{xpasswd},%3" "I:"
|
|
|
|
.\"
|
|
|
|
.\" # Finally, in a bind, if one uses a `uid=username' DN,
|
|
|
|
.\" # it is rewritten in `cn=name surname' if possible.
|
|
|
|
.\" rewriteContext bindDn
|
|
|
|
.\" rewriteRule ".*" "%{>addBlanks(%{>uid2Gecos(%0)})}" ":"
|
|
|
|
.\"
|
|
|
|
# Rewrite the search base according to `default' rules.
|
|
|
|
rewriteContext searchBase alias default
|
2002-04-30 04:24:29 +08:00
|
|
|
|
2002-05-03 00:35:16 +08:00
|
|
|
# Search results with OpenLDAP DN are rewritten back with
|
|
|
|
# `dc=home,dc=net' naming context, with spaces eaten.
|
|
|
|
rewriteContext searchResult
|
|
|
|
rewriteRule "(.*[^ ]?)[ ]?dc=OpenLDAP,[ ]?dc=org"
|
|
|
|
"%{>eatBlanks(%1)}dc=home,dc=net" ":"
|
2002-04-30 04:24:29 +08:00
|
|
|
|
2002-05-03 00:35:16 +08:00
|
|
|
# Bind with email instead of full DN: we first need
|
|
|
|
# an ldap map that turns attributes into a DN (the
|
|
|
|
# argument used when invoking the map is appended to
|
|
|
|
# the URI and acts as the filter portion)
|
|
|
|
rewriteMap ldap attr2dn "ldap://host/dc=my,dc=org?dn?sub"
|
2002-04-30 04:24:29 +08:00
|
|
|
|
2002-05-03 00:35:16 +08:00
|
|
|
# Then we need to detect DN made up of a single email,
|
|
|
|
# e.g. `mail=someone@example.com'; note that the rule
|
|
|
|
# in case of match stops rewriting; in case of error,
|
|
|
|
# it is ignored. In case we are mapping virtual
|
|
|
|
# to real naming contexts, we also need to rewrite
|
|
|
|
# regular DNs, because the definition of a bindDn
|
|
|
|
# rewrite context overrides the default definition.
|
|
|
|
rewriteContext bindDn
|
2003-12-30 01:06:43 +08:00
|
|
|
rewriteRule "^mail=[^,]+@[^,]+$" "%{attr2dn(%0)}" ":@I"
|
2002-04-30 04:24:29 +08:00
|
|
|
|
2002-05-03 00:35:16 +08:00
|
|
|
# This is a rather sophisticated example. It massages a
|
|
|
|
# search filter in case who performs the search has
|
|
|
|
# administrative privileges. First we need to keep
|
|
|
|
# track of the bind DN of the incoming request, which is
|
|
|
|
# stored in a variable called `binddn' with session scope,
|
|
|
|
# and left in place to allow regular binding:
|
|
|
|
rewriteContext bindDn
|
|
|
|
rewriteRule ".+" "%{&&binddn(%0)}%0" ":"
|
2002-04-30 04:24:29 +08:00
|
|
|
|
2002-05-03 00:35:16 +08:00
|
|
|
# A search filter containing `uid=' is rewritten only
|
|
|
|
# if an appropriate DN is bound.
|
|
|
|
# To do this, in the first rule the bound DN is
|
|
|
|
# dereferenced, while the filter is decomposed in a
|
|
|
|
# prefix, in the value of the `uid=<arg>' AVA, and
|
|
|
|
# in a suffix. A tag `<>' is appended to the DN.
|
|
|
|
# If the DN refers to an entry in the `ou=admin' subtree,
|
|
|
|
# the filter is rewritten OR-ing the `uid=<arg>' with
|
|
|
|
# `cn=<arg>'; otherwise it is left as is. This could be
|
|
|
|
# useful, for instance, to allow apache's auth_ldap-1.4
|
|
|
|
# module to authenticate users with both `uid' and
|
|
|
|
# `cn', but only if the request comes from a possible
|
|
|
|
# `cn=Web auth,ou=admin,dc=home,dc=net' user.
|
|
|
|
rewriteContext searchFilter
|
|
|
|
rewriteRule "(.*\e\e()uid=([a-z0-9_]+)(\e\e).*)"
|
|
|
|
"%{**binddn}<>%{&prefix(%1)}%{&arg(%2)}%{&suffix(%3)}"
|
|
|
|
":I"
|
|
|
|
rewriteRule "[^,]+,ou=admin,dc=home,dc=net"
|
2003-12-30 01:06:43 +08:00
|
|
|
"%{*prefix}|(uid=%{*arg})(cn=%{*arg})%{*suffix}" ":@I"
|
2002-05-03 00:35:16 +08:00
|
|
|
rewriteRule ".*<>" "%{*prefix}uid=%{*arg}%{*suffix}" ":"
|
2003-04-04 05:17:09 +08:00
|
|
|
|
|
|
|
# This example shows how to strip unwanted DN-valued
|
|
|
|
# attribute values from a search result; the first rule
|
|
|
|
# matches DN values below "ou=People,dc=example,dc=com";
|
|
|
|
# in case of match the rewriting exits successfully.
|
|
|
|
# The second rule matches everything else and causes
|
|
|
|
# the value to be rejected.
|
|
|
|
rewriteContext searchResult
|
2003-12-30 01:06:43 +08:00
|
|
|
rewriteRule ".*,ou=People,dc=example,dc=com" "%0" ":@"
|
2003-04-04 05:17:09 +08:00
|
|
|
rewriteRule ".*" "" "#"
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
2002-05-02 00:38:30 +08:00
|
|
|
.SH "LDAP Proxy resolution (a possible evolution of slapd\-ldap(5)):"
|
|
|
|
In case the rewritten DN is an LDAP URI, the operation is initiated
|
|
|
|
towards the host[:port] indicated in the uri, if it does not refer
|
2002-04-30 04:24:29 +08:00
|
|
|
to the local server.
|
|
|
|
E.g.:
|
|
|
|
.LP
|
|
|
|
.nf
|
2002-05-02 00:38:30 +08:00
|
|
|
rewriteRule '^cn=root,.*' '%0' 'G{3}'
|
2003-12-30 01:06:43 +08:00
|
|
|
rewriteRule '^cn=[a-l].*' 'ldap://ldap1.my.org/%0' ':@'
|
|
|
|
rewriteRule '^cn=[m-z].*' 'ldap://ldap2.my.org/%0' ':@'
|
|
|
|
rewriteRule '.*' 'ldap://ldap3.my.org/%0' ':@'
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
|
|
|
.LP
|
|
|
|
(Rule 1 is simply there to illustrate the `G{n}' action; it could have
|
|
|
|
been written:
|
|
|
|
.LP
|
|
|
|
.nf
|
2003-12-30 01:06:43 +08:00
|
|
|
rewriteRule '^cn=root,.*' 'ldap://ldap3.my.org/%0' ':@'
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
|
|
|
.LP
|
|
|
|
with the advantage of saving one rewrite pass ...)
|
2003-12-07 12:30:39 +08:00
|
|
|
.SH PROXY CACHE OVERLAY
|
|
|
|
The proxy cache overlay
|
|
|
|
allows caching of LDAP search requests (queries) in a local database.
|
|
|
|
For an incoming query, the
|
2003-06-24 19:49:56 +08:00
|
|
|
proxy cache determines its corresponding \fBtemplate\fP. If the template was
|
2003-12-07 12:30:39 +08:00
|
|
|
specified as cacheable using the \fBproxytemplate\fP directive and the request is
|
2003-06-24 19:49:56 +08:00
|
|
|
contained in a cached request, it is answered from the proxy cache. Otherwise,
|
2003-12-07 12:30:39 +08:00
|
|
|
the search is performed as usual and cacheable search results are saved in the
|
|
|
|
cache for use in future queries.
|
2003-06-24 19:49:56 +08:00
|
|
|
.LP
|
|
|
|
|
|
|
|
A template is defined by a filter string and an index identifying a set of
|
|
|
|
attributes. The \fBtemplate string\fP for a query can be obtained by
|
|
|
|
removing assertion values from the RFC 2254 representation of its search
|
|
|
|
filter. A query belongs to a template if its template string and set of
|
|
|
|
projected attributes correspond to a cacheable template. Examples of template strings are (mail=), (|(sn=)(cn=)), (&(sn=)(givenName=)).
|
|
|
|
|
|
|
|
.LP
|
|
|
|
The following cache specific directives can be used to configure the proxy
|
|
|
|
cache:
|
|
|
|
.TP
|
2003-12-07 12:30:39 +08:00
|
|
|
.B overlay proxycache
|
|
|
|
This directive adds the proxycache overlay to the current backend. The
|
|
|
|
proxycache overlay may be used with any backend but is intended for use
|
|
|
|
with the
|
|
|
|
.B ldap
|
|
|
|
and
|
|
|
|
.B meta
|
|
|
|
backends.
|
|
|
|
.TP
|
|
|
|
.B proxycache <database> <max_entries> <numattrsets> <entry_limit> <cc_period>
|
|
|
|
The directive enables proxy caching in the current backend and sets general
|
|
|
|
cache parameters. A <database> backend will be used internally to maintain
|
|
|
|
the cached entries. The chosen database will need to be configured as well,
|
|
|
|
as shown below. Cache replacement is invoked when the cache size grows to
|
|
|
|
<max_entries> entries and continues till the cache size drops below this size.
|
|
|
|
<numattrsets> should be equal to the number of following \fBproxyattrset\fP
|
2003-06-24 19:49:56 +08:00
|
|
|
directives. Queries are cached only if they correspond to a cacheable template
|
2003-12-07 12:30:39 +08:00
|
|
|
(specified by the \fBproxytemplate\fP directive) and the number of entries
|
|
|
|
returned is less than <entry_limit>. Consistency check is performed every
|
2003-06-24 19:49:56 +08:00
|
|
|
<cc_period> duration (specified in secs). In each cycle queries with expired
|
|
|
|
"time to live(\fBTTL\fP)" are removed. A sample cache configuration is:
|
|
|
|
.LP
|
|
|
|
.RS
|
2003-12-07 12:30:39 +08:00
|
|
|
proxycache \fBbdb 10000 1 50 100\fP
|
2003-06-24 19:49:56 +08:00
|
|
|
.RE
|
|
|
|
.TP
|
2003-12-07 12:30:39 +08:00
|
|
|
.B proxyattrset <index> <attrs...>
|
2003-06-24 19:49:56 +08:00
|
|
|
Used to associate a set of attributes <attrs..> with an <index>. Each attribute
|
|
|
|
set is associated with an integer from 0 to <numattrsets>-1. These indices are
|
2003-12-07 12:30:39 +08:00
|
|
|
used by the \fBproxytemplate\fP directive to define cacheable templates.
|
2003-06-24 19:49:56 +08:00
|
|
|
|
|
|
|
.TP
|
2003-12-07 12:30:39 +08:00
|
|
|
.B proxytemplate <template_string> <attrset_index> <ttl>
|
2003-06-24 19:49:56 +08:00
|
|
|
Specifies a cacheable template and "time to live" (in sec) <ttl> of queries
|
|
|
|
belonging to the template.
|
|
|
|
|
|
|
|
.LP
|
|
|
|
The following adds a template with filter string (&sn=)(givenName=)) and attributes mail, postaladdress, telephonenumber and a TTL of 1 hour.
|
|
|
|
.LP
|
|
|
|
.RS
|
|
|
|
.nf
|
2003-12-07 12:30:39 +08:00
|
|
|
proxyattrset \fB0 mail postaladdress telephonenumber\fP
|
|
|
|
proxytemplate \fB(&(sn=)(givenName=)) 0 3600\fP
|
|
|
|
.fi
|
|
|
|
.RE
|
|
|
|
.LP
|
|
|
|
Directives for configuring the underlying database must also be given, as
|
|
|
|
shown here:
|
|
|
|
.LP
|
|
|
|
.RS
|
|
|
|
.nf
|
|
|
|
directory /var/tmp/cache
|
|
|
|
cachesize 100
|
2003-06-24 19:49:56 +08:00
|
|
|
.fi
|
|
|
|
.RE
|
2003-12-07 12:30:39 +08:00
|
|
|
.LP
|
|
|
|
Any valid directives for the chosen database type may be used.
|
2002-05-02 00:38:30 +08:00
|
|
|
.SH FILES
|
2002-05-09 10:07:41 +08:00
|
|
|
.TP
|
2002-05-02 00:38:30 +08:00
|
|
|
ETCDIR/slapd.conf
|
2002-05-09 10:07:41 +08:00
|
|
|
default slapd configuration file
|
2002-05-02 00:38:30 +08:00
|
|
|
.SH SEE ALSO
|
2002-04-30 04:24:29 +08:00
|
|
|
.BR slapd.conf (5),
|
2002-04-30 04:36:04 +08:00
|
|
|
.BR slapd\-ldap (5),
|
2002-04-30 04:24:29 +08:00
|
|
|
.BR slapd (8),
|
|
|
|
.BR regex (7).
|
2003-05-25 11:50:59 +08:00
|
|
|
.SH AUTHOR
|
|
|
|
Pierangelo Masarati, based on back-ldap by Howard Chu
|