]> git.sur5r.net Git - openldap/blob - doc/man/man5/slapd-meta.5
ddc01462402847c9572ca5cddf9f698904087515
[openldap] / doc / man / man5 / slapd-meta.5
1 .TH SLAPD-META 5 "RELEASEDATE" "OpenLDAP LDVERSION"
2 .\" Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
3 .\" Copying restrictions apply.  See the COPYRIGHT file.
4 .\" Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
5 .\" $OpenLDAP$
6 .\"
7 .\" Portions of this document should probably be moved to slapd-ldap(5)
8 .\" and maybe manual pages for librewrite.
9 .\"
10 .SH NAME
11 slapd-meta \- metadirectory backend
12 .SH SYNOPSIS
13 ETCDIR/slapd.conf
14 .SH DESCRIPTION
15 The
16 .B meta
17 backend to
18 .BR slapd (8)
19 performs basic LDAP proxying with respect to a set of remote LDAP
20 servers, called "targets".
21 The information contained in these servers can be presented as
22 belonging to a single Directory Information Tree (DIT).
23 .LP
24 A basic knowledge of the functionality of the
25 .BR slapd\-ldap (5)
26 backend is recommended.
27 This backend has been designed as an enhancement of the ldap backend.
28 The two backends share many features (actually they also share
29 portions of code).
30 While the
31 .B ldap
32 backend is intended to proxy operations directed to a single server, the
33 .B meta
34 backend is mainly intended for proxying of multiple servers and possibly
35 naming context masquerading.
36 These features, although useful in many scenarios, may result in
37 excessive overhead for some applications, so its use should be
38 carefully considered.
39 In the examples section, some typical scenarios will be discussed.
40 .SH EXAMPLES
41 There are examples in various places in this document, as well as in the
42 slapd/back-meta/data/ directory in the OpenLDAP source tree.
43 .SH CONFIGURATION
44 These
45 .B slapd.conf
46 options apply to the META backend database.
47 That is, they must follow a "database meta" line and come before any
48 subsequent "backend" or "database" lines.
49 Other database options are described in the
50 .BR slapd.conf (5)
51 manual page.
52 .LP
53 Note: as with the
54 .B ldap
55 backend, operational attributes related to entry creation/modification
56 should not be used, as they would be passed to the target servers,
57 generating an error.
58 Moreover, it makes little sense to use such attributes in proxying, as
59 the proxy server doesn't actually store data, so it should have no
60 knowledge of such attributes.
61 While code to strip the modification attributes has been put in place
62 (and #ifdef'd), it implies unmotivated overhead.
63 So it is strongly recommended to set
64 .RS
65 lastmod  off
66 .RE
67 for every
68 .B ldap
69 and
70 .B meta
71 backend.
72 .SH SPECIAL CONFIGURATION DIRECTIVES
73 Target configuration starts with the "uri" directive.
74 All the configuration directives that are not specific to targets
75 should be defined first for clarity, including those that are common
76 to all backends.
77 They are:
78 .TP
79 .B default-target none
80 This directive forces the backend to reject all those operations
81 that must resolve to a single target in case none or multiple
82 targets are selected.
83 They include: add, delete, modify, modrdn; compare is not included, as
84 well as bind since, as they don't alter entries, in case of multiple
85 matches an attempt is made to perform the operation on any candidate
86 target, with the constraint that at most one must succeed.
87 This directive can also be used when processing targets to mark a
88 specific target as default.
89 .TP
90 .B dncache-ttl {forever|disabled|<ttl>}
91 This directive sets the time-to-live of the DN cache.
92 This caches the target that holds a given DN to speed up target
93 selection in case multiple targets would result from an uncached
94 search; forever means cache never expires; disabled means no DN
95 caching; otherwise a valid ( > 0 ) ttl in seconds is required.
96 .SH TARGET SPECIFICATION
97 Target specification starts with a "uri" directive:
98 .TP
99 .B uri <protocol>://[<host>[:<port>]]/<naming context>
100 The "server" directive that was allowed in the LDAP backend (although
101 deprecated) has been discarded in the Meta backend.
102 The <protocol> part can be anything
103 .BR ldap_initialize (3)
104 accepts ({ldap|ldaps|ldapi} and variants); <host> and <port> may be
105 omitted, defaulting to whatever is set in /etc/ldap.conf.
106 The <naming context> part is mandatory.
107 It must end with one of the naming contexts defined for the backend,
108 e.g.:
109 .LP
110 .RS
111 .nf
112 suffix "\fBdc=foo,dc=com\fP"
113 uri    "ldap://x.foo.com/dc=x,\fBdc=foo,dc=com\fP"
114 .fi
115 .RE
116 .LP
117 The <naming context> part doesn't need to be unique across the targets;
118 it may also match one of the values of the "suffix" directive.
119 .TP
120 .B default-target [<target>]
121 The "default-target" directive can also be used during target specification.
122 With no arguments it marks the current target as the default.
123 The optional number marks target <target> as the default one, starting
124 from 1.
125 Target <target> must be defined.
126 .TP
127 .B binddn "<administrative DN for access control purposes>"
128 This directive, as in the LDAP backend, allows to define the DN that is
129 used to query the target server for acl checking; it should have read
130 access on the target server to attributes used on the proxy for acl
131 checking.
132 There is no risk of giving away such values; they are only used to
133 check permissions.
134 .TP
135 .B bindpw <password for access control purposes>
136 This directive sets the password for acl checking in conjunction
137 with the above mentioned "binddn" directive.
138 .TP
139 .B pseudorootdn "<substitute DN in case of rootdn bind>"
140 This directive, if present, sets the DN that will be substituted to
141 the bind DN if a bind with the backend's "rootdn" succeeds.
142 The true "rootdn" of the target server ought not be used; an arbitrary
143 administrative DN should used instead.
144 .TP
145 .B pseudorootpw "<substitute password in case of rootdn bind>"
146 This directive sets the credential that will be used in case a bind
147 with the backend's "rootdn" succeeds, and the bind is propagated to
148 the target using the "pseudorootdn" DN.
149 .LP
150 Note: cleartext credentials must be supplied here; as a consequence,
151 using the pseudorootdn/pseudorootpw directives is inherently unsafe.
152 .TP
153 .B rewrite* ...
154 The rewrite options are described in the "REWRITING" section.
155 .TP
156 .B suffixmassage "<virtual naming context>" "<real naming context>"
157 All the directives starting with "rewrite" refer to the rewrite engine
158 that has been added to slapd.
159 The "suffixmassage" directive was introduced in the LDAP backend to
160 allow suffix massaging while proxying.
161 It has been obsoleted by the rewriting tools.
162 However, both for backward compatibility and for ease of configuration
163 when simple suffix massage is required, it has been preserved.
164 It wraps the basic rewriting instructions that perform suffix
165 massaging.
166 .LP
167 Note: this also fixes a flaw in suffix massaging, which operated
168 on (case insensitive) DNs instead of normalized DNs,
169 so "dc=foo, dc=com" would not match "dc=foo,dc=com".
170 .LP
171 See the "REWRITING" section.
172 .TP
173 .B map "{attribute|objectclass} [<local name>|*] {<foreign name>|*}"
174 This maps object classes and attributes as in the LDAP backend.
175 See
176 .BR slapd-ldap (5).
177 .SH SCENARIOS
178 A powerful (and in some sense dangerous) rewrite engine has been added
179 to both the LDAP and Meta backends.
180 While the former can gain limited beneficial effects from rewriting
181 stuff, the latter can become an amazingly powerful tool.
182 .LP
183 Consider a couple of scenarios first.
184 .LP
185 1) Two directory servers share two levels of naming context;
186 say "dc=a,dc=foo,dc=com" and "dc=b,dc=foo,dc=com".
187 Then, an unambiguous Meta database can be configured as:
188 .LP
189 .RS
190 .nf
191 database meta
192 suffix   "\fBdc=foo,dc=com\fP"
193 uri      "ldap://a.foo.com/dc=a,\fBdc=foo,dc=com\fP"
194 uri      "ldap://b.foo.com/dc=b,\fBdc=foo,dc=com\fP"
195 .fi
196 .RE
197 .LP
198 Operations directed to a specific target can be easily resolved
199 because there are no ambiguities.
200 The only operation that may resolve to multiple targets is a search
201 with base "dc=foo,dc=com" and scope at least "one", which results in
202 spawning two searches to the targets.
203 .LP
204 2a) Two directory servers don't share any portion of naming context,
205 but they'd present as a single DIT
206 [Caveat: uniqueness of (massaged) entries among the two servers is
207 assumed; integrity checks risk to incur in excessive overhead and have
208 not been implemented].
209 Say we have "dc=bar,dc=org" and "o=Foo,c=US",
210 and we'd like them to appear as branches of "dc=foo,dc=com", say
211 "dc=a,dc=foo,dc=com" and "dc=b,dc=foo,dc=com".
212 Then we need to configure our Meta backend as:
213 .LP
214 .RS
215 .nf
216 database      meta
217 suffix        "dc=foo,dc=com"
218
219 uri           "ldap://a.bar.com/\fBdc=a,dc=foo,dc=com\fP"
220 suffixmassage "\fBdc=a,dc=foo,dc=com\fP" "dc=bar,dc=org"
221
222 uri           "ldap://b.foo.com/\fBdc=b,dc=foo,dc=com\fP"
223 suffixmassage "\fBdc=b,dc=foo,dc=com\fP" "o=Foo,c=US"
224 .fi
225 .RE
226 .LP
227 Again, operations can be resolved without ambiguity, although
228 some rewriting is required.
229 Notice that the virtual naming context of each target is a branch of
230 the database's naming context; it is rewritten back and forth when
231 operations are performed towards the target servers.
232 What "back and forth" means will be clarified later.
233 .LP
234 When a search with base "dc=foo,dc=com" is attempted, if the 
235 scope is "base" it fails with "no such object"; in fact, the
236 common root of the two targets (prior to massaging) does not
237 exist.
238 If the scope is "one", both targets are contacted with the base
239 replaced by each target's base; the scope is derated to "base".
240 In general, a scope "one" search is honored, and the scope is derated,
241 only when the incoming base is at most one level lower of a target's
242 naming context (prior to massaging).
243 .LP
244 Finally, if the scope is "sub" the incoming base is replaced
245 by each target's unmassaged naming context, and the scope
246 is not altered.
247 .LP
248 2b) Consider the above reported scenario with the two servers
249 sharing the same naming context:
250 .LP
251 .RS
252 .nf
253 database      meta
254 suffix        "\fBdc=foo,dc=com\fP"
255
256 uri           "ldap://a.bar.com/\fBdc=foo,dc=com\fP"
257 suffixmassage "\fBdc=foo,dc=com\fP" "dc=bar,dc=org"
258
259 uri           "ldap://b.foo.com/\fBdc=foo,dc=com\fP"
260 suffixmassage "\fBdc=foo,dc=com\fP" "o=Foo,c=US"
261 .fi
262 .RE
263 .LP
264 All the previous considerations hold, except that now there is
265 no way to unambiguously resolve a DN.
266 In this case, all the operations that require an unambiguous target
267 selection will fail unless the DN is already cached or a default
268 target has been set.
269 Practical configurations may result as a combination of all the
270 above scenarios.
271 .SH ACLs
272 Note on ACLs: at present you may add whatever ACL rule you desire
273 to to the Meta (and LDAP) backends.
274 However, the meaning of an ACL on a proxy may require some
275 considerations.
276 Two philosophies may be considered:
277 .LP
278 a) the remote server dictates the permissions; the proxy simply passes
279 back what it gets from the remote server.
280 .LP
281 b) the remote server unveils "everything"; the proxy is responsible
282 for protecting data from unauthorized access.
283 .LP
284 Of course the latter sounds unreasonable, but it is not.
285 It is possible to imagine scenarios in which a remote host discloses
286 data that can be considered "public" inside an intranet, and a proxy
287 that connects it to the internet may impose additional constraints.
288 To this purpose, the proxy should be able to comply with all the ACL
289 matching criteria that the server supports.
290 This has been achieved with regard to all the criteria supported by
291 slapd except a special subtle case (please drop me a note if you can
292 find other exceptions: <ando@openldap.org>).
293 The rule
294 .LP
295 .RS
296 .nf
297 access to dn="<dn>" attr=<attr>
298        by dnattr=<dnattr> read
299        by * none
300 .fi
301 .RE
302 .LP
303 cannot be matched iff the attribute that is being requested, <attr>,
304 is NOT <dnattr>, and the attribute that determines membership,
305 <dnattr>, has not been requested (e.g. in a search)
306 .LP
307 In fact this ACL is resolved by slapd using the portion of entry it
308 retrieved from the remote server without requiring any further
309 intervention of the backend, so, if the <dnattr> attribute has not
310 been fetched, the match cannot be assessed because the attribute is
311 not present, not because no value matches the requirement!
312 .LP
313 Note on ACLs and attribute mapping: ACLs are applied to the mapped
314 attributes; for instance, if the attribute locally known as "foo" is
315 mapped to "bar" on a remote server, then local ACLs apply to attribute
316 "foo" and are totally unaware of its remote name.
317 The remote server will check permissions for "bar", and the local
318 server will possibly enforce additional restrictions to "foo".
319 .\"
320 .\" If this section is moved, also update the reference in
321 .\" libraries/librewrite/RATIONALE.
322 .\"
323 .SH REWRITING
324 A string is rewritten according to a set of rules, called a `rewrite
325 context'.
326 The rules are based on Regular Expressions (POSIX regex) with
327 substring matching; extensions are planned to allow basic variable
328 substitution and map resolution of substrings.
329 The behavior of pattern matching/substitution can be altered by a set
330 of flags.
331 .LP
332 The underlying concept is to build a lightweight rewrite module
333 for the slapd server (initially dedicated to the LDAP backend).
334 .SH Passes
335 An incoming string is matched agains a set of rules.
336 Rules are made of a match pattern, a substitution pattern and a set of
337 actions.
338 In case of match a string rewriting is performed according to the
339 substitution pattern that allows to refer to substrings matched in the
340 incoming string.
341 The actions, if any, are finally performed.
342 The substitution pattern allows map resolution of substrings.
343 A map is a generic object that maps a substitution pattern to a value.
344 .SH "Pattern Matching Flags"
345 .TP
346 .B `C'
347 honors case in matching (default is case insensitive)
348 .TP
349 .B `R'
350 use POSIX Basic Regular Expressions (default is Extended)
351 .SH "Action Flags"
352 .TP
353 .B `:'
354 apply the rule once only (default is recursive)
355 .TP
356 .B `@'
357 stop applying rules in case of match.
358 .TP
359 .B `#'
360 stop current operation if the rule matches, and issue an `unwilling to
361 perform' error.
362 .TP
363 .B `G{n}'
364 jump n rules back and forth (watch for loops!).
365 Note that `G{1}' is implicit in every rule.
366 .TP
367 .B `I'
368 ignores errors in rule; this means, in case of error, e.g. issued by a
369 map, the error is treated as a missed match.
370 The `unwilling to perform' is not overridden.
371 .LP
372 The ordering of the flags is significant.
373 For instance: `IG{2}' means ignore errors and jump two lines ahead
374 both in case of match and in case of error, while `G{2}I' means ignore
375 errors, but jump thwo lines ahead only in case of match.
376 .LP
377 More flags (mainly Action Flags) will be added as needed.
378 .SH "Pattern matching:"
379 See
380 .BR regex (7).
381 .SH "Substitution Pattern Syntax:"
382 Everything starting with `%' requires substitution;
383 .LP
384 the only obvious exception is `%%', which is left as is;
385 .LP
386 the basic substitution is `%d', where `d' is a digit;
387 0 means the whole string, while 1-9 is a submatch, as discussed in 
388 .BR regex (7);
389 .LP
390 a `%' followed by a `{' invokes an advanced substitution.
391 The pattern is:
392 .LP
393 .RS
394 `%' `{' [ <op> ] <name> `(' <substitution> `)' `}'
395 .RE
396 .LP
397 where <name> must be a legal name for the map, i.e.
398 .LP
399 .RS
400 .nf
401 <name> ::= [a-z][a-z0-9]* (case insensitive)
402 <op> ::= `>' `|' `&' `&&' `*' `**' `$'
403 .fi
404 .RE
405 .LP
406 and <substitution> must be a legal substitution
407 pattern, with no limits on the nesting level.
408 .LP
409 The operators are:
410 .TP
411 .B >
412 sub context invocation; <name> must be a legal, already defined
413 rewrite context name
414 .TP
415 .B |
416 external command invocation; <name> must refer to a legal, already
417 defined command name (NOT IMPL.)
418 .TP
419 .B &
420 variable assignment; <name> defines a variable in the running
421 operation structure which can be dereferenced later; operator
422 .B &
423 assigns a variable in the rewrite context scope; operator
424 .B &&
425 assigns a variable that scopes the entire session, e.g. its value
426 can be derefenced later by other rewrite contexts
427 .TP
428 .B *
429 variable dereferencing; <name> must refer to a variable that is
430 defined and assigned for the running operation; operator
431 .B *
432 dereferences a variable scoping the rewrite context; operator
433 .B **
434 dereferences a variable scoping the whole session, e.g. the value
435 is passed across rewrite contexts
436 .TP
437 .B $
438 parameter dereferencing; <name> must refer to an existing parameter;
439 the idea is to make some run-time parameters set by the system
440 available to the rewrite engine, as the client host name, the bind DN
441 if any, constant parameters initialized at config time, and so on;
442 no parameter is currently set by either 
443 .B back\-ldap
444 or
445 .BR back\-meta ,
446 but constant parameters can be defined in the configuration file
447 by using the
448 .B rewriteParam
449 directive.
450 .LP
451 Substitution escaping has been delegated to the `%' symbol, 
452 which is used instead of `\e' in string substitution patterns
453 because `\e' is already escaped by slapd's low level parsing routines;
454 as a consequence, 
455 .BR regex (7)
456 escaping requires two `\e' symbols, e.g. `\fB.*\e.foo\e.bar\fP' must
457 be written as `\fB.*\e\e.foo\e\e.bar\fP'.
458 .\"
459 .\" The symbol can be altered at will by redefining the related macro in
460 .\" "rewrite-int.h".
461 .\"
462 .SH "Rewrite context:"
463 A rewrite context is a set of rules which are applied in sequence.
464 The basic idea is to have an application initialize a rewrite
465 engine (think of Apache's mod_rewrite ...) with a set of rewrite
466 contexts; when string rewriting is required, one invokes the
467 appropriate rewrite context with the input string and obtains the
468 newly rewritten one if no errors occur.
469 .LP
470 Each basic server operation is associated to a rewrite context;
471 they are divided in two main groups: client \-> server and
472 server \-> client rewriting.
473 .LP
474 client -> server:
475 .LP
476 .RS
477 .nf
478 (default)      if defined and no specific context 
479                is available
480 bindDn         bind
481 searchBase     search
482 searchFilter   search
483 compareDn      compare
484 addDn          add
485 modifyDn       modify
486 modrDn         modrdn
487 newSuperiorDn  modrdn
488 deleteDn       delete
489 .fi
490 .RE
491 .LP
492 server -> client:
493 .LP
494 .RS
495 .nf
496 searchResult   search (only if defined; no default;
497                acts on DN and DN-syntax attributes 
498                of search results)
499 matchedDn      all ops (only if defined; no default;
500                NOT IMPL. except in search)
501 .fi
502 .RE
503 .LP
504 .SH "Basic configuration syntax"
505 .TP
506 .B rewriteEngine { on | off }
507 If `on', the requested rewriting is performed; if `off', no
508 rewriting takes place (an easy way to stop rewriting without
509 altering too much the configuration file).
510 .TP
511 .B rewriteContext <context name> "[ alias <aliased context name> ]"
512 <Context name> is the name that identifies the context, i.e. the name
513 used by the application to refer to the set of rules it contains.
514 It is used also to reference sub contexts in string rewriting.
515 A context may aliase another one.
516 In this case the alias context contains no rule, and any reference to
517 it will result in accessing the aliased one.
518 .TP
519 .B rewriteRule "<regex pattern>" "<substitution pattern>" "[ <flags> ]"
520 Determines how a tring can be rewritten if a pattern is matched.
521 Examples are reported below.
522 .SH "Additional configuration syntax:"
523 .TP
524 .B rewriteMap "<map name>" "<map type>" "[ <map attrs> ]"
525 Allows to define a map that transforms substring rewriting into
526 something else.
527 The map is referenced inside the substitution pattern of a rule.
528 .TP
529 .B rewriteParam <param name> <param value>
530 Sets a value with global scope, that can be dereferenced by the
531 command `%{$paramName}'.
532 .TP
533 .B rewriteMaxPasses <number of passes>
534 Sets the maximum number of total rewriting passes that can be
535 performed in a single rewrite operation (to avoid loops).
536 .SH "Configuration examples:"
537 .nf
538 # set to `off' to disable rewriting
539 rewriteEngine on
540
541 # Everything defined here goes into the `default' context.
542 # This rule changes the naming context of anything sent
543 # to `dc=home,dc=net' to `dc=OpenLDAP, dc=org'
544
545 rewriteRule "(.*)dc=home,[ ]?dc=net"
546             "%1dc=OpenLDAP, dc=org"  ":"
547
548 # since a pretty/normalized DN does not include spaces
549 # after rdn separators, e.g. `,', this rule suffices:
550
551 rewriteRule "(.*)dc=home,dc=net"
552             "%1dc=OpenLDAP,dc=org"  ":"
553
554 # Start a new context (ends input of the previous one).
555 # This rule adds blanks between DN parts if not present.
556 rewriteContext  addBlanks
557 rewriteRule     "(.*),([^ ].*)" "%1, %2"
558
559 # This one eats blanks
560 rewriteContext  eatBlanks
561 rewriteRule     "(.*),[ ](.*)" "%1,%2"
562
563 # Here control goes back to the default rewrite
564 # context; rules are appended to the existing ones.
565 # anything that gets here is piped into rule `addBlanks'
566 rewriteContext  default
567 rewriteRule     ".*" "%{>addBlanks(%0)}" ":"
568
569 .\" # Anything with `uid=username' is looked up in
570 .\" # /etc/passwd for gecos (I know it's nearly useless,
571 .\" # but it is there just as a guideline to implementing
572 .\" # custom maps).
573 .\" # Note the `I' flag that leaves `uid=username' in place 
574 .\" # if `username' does not have a valid account, and the
575 .\" # `:' that forces the rule to be processed exactly once.
576 .\" rewriteContext  uid2Gecos
577 .\" rewriteRule     "(.*)uid=([a-z0-9]+),(.+)"
578 .\"                 "%1cn=%2{xpasswd},%3"      "I:"
579 .\" 
580 .\" # Finally, in a bind, if one uses a `uid=username' DN,
581 .\" # it is rewritten in `cn=name surname' if possible.
582 .\" rewriteContext  bindDn
583 .\" rewriteRule     ".*" "%{>addBlanks(%{>uid2Gecos(%0)})}" ":"
584 .\" 
585 # Rewrite the search base  according to `default' rules.
586 rewriteContext  searchBase alias default
587
588 # Search results with OpenLDAP DN are rewritten back with
589 # `dc=home,dc=net' naming context, with spaces eaten.
590 rewriteContext  searchResult
591 rewriteRule     "(.*[^ ]?)[ ]?dc=OpenLDAP,[ ]?dc=org"
592                 "%{>eatBlanks(%1)}dc=home,dc=net"    ":"
593
594 # Bind with email instead of full DN: we first need
595 # an ldap map that turns attributes into a DN (the
596 # argument used when invoking the map is appended to 
597 # the URI and acts as the filter portion)
598 rewriteMap ldap attr2dn "ldap://host/dc=my,dc=org?dn?sub"
599
600 # Then we need to detect DN made up of a single email,
601 # e.g. `mail=someone@example.com'; note that the rule
602 # in case of match stops rewriting; in case of error,
603 # it is ignored.  In case we are mapping virtual
604 # to real naming contexts, we also need to rewrite
605 # regular DNs, because the definition of a bindDn
606 # rewrite context overrides the default definition.
607 rewriteContext bindDn
608 rewriteRule "^mail=[^,]+@[^,]+$" "%{attr2dn(%0)}" "@I"
609
610 # This is a rather sophisticated example. It massages a
611 # search filter in case who performs the search has
612 # administrative privileges.  First we need to keep
613 # track of the bind DN of the incoming request, which is
614 # stored in a variable called `binddn' with session scope,
615 # and left in place to allow regular binding:
616 rewriteContext  bindDn
617 rewriteRule     ".+" "%{&&binddn(%0)}%0" ":"
618
619 # A search filter containing `uid=' is rewritten only
620 # if an appropriate DN is bound.
621 # To do this, in the first rule the bound DN is
622 # dereferenced, while the filter is decomposed in a
623 # prefix, in the value of the `uid=<arg>' AVA, and 
624 # in a suffix. A tag `<>' is appended to the DN. 
625 # If the DN refers to an entry in the `ou=admin' subtree, 
626 # the filter is rewritten OR-ing the `uid=<arg>' with
627 # `cn=<arg>'; otherwise it is left as is. This could be
628 # useful, for instance, to allow apache's auth_ldap-1.4
629 # module to authenticate users with both `uid' and
630 # `cn', but only if the request comes from a possible
631 # `cn=Web auth,ou=admin,dc=home,dc=net' user.
632 rewriteContext searchFilter
633 rewriteRule "(.*\e\e()uid=([a-z0-9_]+)(\e\e).*)"
634   "%{**binddn}<>%{&prefix(%1)}%{&arg(%2)}%{&suffix(%3)}"
635   ":I"
636 rewriteRule "[^,]+,ou=admin,dc=home,dc=net"
637   "%{*prefix}|(uid=%{*arg})(cn=%{*arg})%{*suffix}" "@I"
638 rewriteRule ".*<>" "%{*prefix}uid=%{*arg}%{*suffix}" ":"
639 .fi
640 .SH "LDAP Proxy resolution (a possible evolution of slapd\-ldap(5)):"
641 In case the rewritten DN is an LDAP URI, the operation is initiated
642 towards the host[:port] indicated in the uri, if it does not refer
643 to the local server.
644 E.g.:
645 .LP
646 .nf
647   rewriteRule '^cn=root,.*' '%0'                     'G{3}'
648   rewriteRule '^cn=[a-l].*' 'ldap://ldap1.my.org/%0' '@'
649   rewriteRule '^cn=[m-z].*' 'ldap://ldap2.my.org/%0' '@'
650   rewriteRule '.*'          'ldap://ldap3.my.org/%0' '@'
651 .fi
652 .LP
653 (Rule 1 is simply there to illustrate the `G{n}' action; it could have
654 been written:
655 .LP
656 .nf
657   rewriteRule '^cn=root,.*' 'ldap://ldap3.my.org/%0' '@'
658 .fi
659 .LP
660 with the advantage of saving one rewrite pass ...)
661 .SH FILES
662 .TP
663 ETCDIR/slapd.conf
664 default slapd configuration file
665 .SH SEE ALSO
666 .BR slapd.conf (5),
667 .BR slapd\-ldap (5),
668 .BR slapd (8),
669 .BR regex (7).