1SLAPD-META(5)                 File Formats Manual                SLAPD-META(5)
2
3
4

NAME

6       slapd-meta - metadirectory backend to slapd
7

SYNOPSIS

9       /etc/openldap/slapd.conf
10

DESCRIPTION

12       The  meta backend to slapd(8) performs basic LDAP proxying with respect
13       to a set of remote LDAP servers,  called  "targets".   The  information
14       contained  in  these  servers can be presented as belonging to a single
15       Directory Information Tree (DIT).
16
17       A basic knowledge of the functionality of the slapd-ldap(5) backend  is
18       recommended.   This  backend has been designed as an enhancement of the
19       ldap backend.  The two backends share many features (actually they also
20       share  portions  of code).  While the ldap backend is intended to proxy
21       operations directed to a single server,  the  meta  backend  is  mainly
22       intended  for  proxying of multiple servers and possibly naming context
23       masquerading.  These features, although useful in many  scenarios,  may
24       result  in  excessive overhead for some applications, so its use should
25       be carefully considered.  In the examples section, some typical scenar‐
26       ios will be discussed.
27
28       The  proxy instance of slapd(8) must contain schema information for the
29       attributes and objectClasses used in filters, request DN  and  request-
30       related data in general.  It should also contain schema information for
31       the data returned by the proxied server.  It is the  responsibility  of
32       the  proxy  administrator to keep the schema of the proxy lined up with
33       that of the proxied server.
34
35
36       Note: When looping back to the same instance of slapd(8), each  connec‐
37       tion requires a new thread; as a consequence, slapd(8) must be compiled
38       with thread support, and the threads parameter may need some tuning; in
39       those  cases,  unless  the multiple target feature is required, one may
40       consider using slapd-relay(5) instead, which performs the relayed oper‐
41       ation internally and thus reuses the same connection.
42
43

EXAMPLES

45       There  are  examples  in various places in this document, as well as in
46       the slapd/back-meta/data/ directory in the OpenLDAP source tree.
47

CONFIGURATION

49       These slapd.conf options apply to the META backend database.  That  is,
50       they  must follow a "database meta" line and come before any subsequent
51       "backend" or "database" lines.  Other database options are described in
52       the slapd.conf(5) manual page.
53
54       Note:  In  early versions of back-ldap and back-meta it was recommended
55       to always set
56
57              lastmod  off
58
59       for ldap and meta databases.  This  was  required  because  operational
60       attributes  related  to  entry  creation and modification should not be
61       proxied, as they could be mistakenly written to the  target  server(s),
62       generating  an  error.   The  current implementation automatically sets
63       lastmod to off, so its use is redundant and should be omitted.
64
65

SPECIAL CONFIGURATION DIRECTIVES

67       Target configuration starts with the "uri" directive.  All the configu‐
68       ration  directives  that  are not specific to targets should be defined
69       first for clarity, including those that are  common  to  all  backends.
70       They are:
71
72
73       conn-ttl <time>
74              This  directive  causes  a  cached  connection  to be dropped an
75              recreated after a given ttl, regardless of being idle or not.
76
77
78       default-target none
79              This directive forces the backend to reject all those operations
80              that  must  resolve  to a single target in case none or multiple
81              targets are selected.  They include: add, delete,  modify,  mod‐
82              rdn;  compare  is  not  included, as well as bind since, as they
83              don't alter entries, in case of multiple matches an  attempt  is
84              made  to perform the operation on any candidate target, with the
85              constraint that at most one must succeed.   This  directive  can
86              also  be  used when processing targets to mark a specific target
87              as default.
88
89
90       dncache-ttl {DISABLED|forever|<ttl>}
91              This directive sets the time-to-live  of  the  DN  cache.   This
92              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 is required, in the  for‐
96              mat illustrated for the idle-timeout directive.
97
98
99       onerr {CONTINUE|report|stop}
100              This directive allows to select the behavior in case an error is
101              returned by one target during a search.  The default,  continue,
102              consists  in  continuing the operation, trying to return as much
103              data as possible.  If the value is set to stop,  the  search  is
104              terminated  as  soon  as an error is returned by one target, and
105              the error is immediately propagated to the client.  If the value
106              is  set  to report, the search is continuated to the end but, in
107              case at least one target returned an error code, the first  non-
108              success error code is returned.
109
110
111       norefs <NO|yes>
112              If  yes,  do not return search reference responses.  By default,
113              they are returned unless request is LDAPv2.  If set  before  any
114              target  specification, it affects all targets, unless overridden
115              by any per-target directive.
116
117
118       noundeffilter <NO|yes>
119              If yes, return success instead of searching if a filter is unde‐
120              fined or contains undefined portions.  By default, the search is
121              propagated after replacing undefined  portions  with  (!(object‐
122              Class=*)),  which  corresponds  to the empty result set.  If set
123              before any target specification, it affects all targets,  unless
124              overridden by any per-target directive.
125
126
127       protocol-version {0,2,3}
128              This  directive  indicates what protocol version must be used to
129              contact the remote server.  If set to 0 (the default), the proxy
130              uses the same protocol version used by the client, otherwise the
131              requested protocol is used.  The proxy  returns  unwillingToPer‐
132              form  if  an  operation  that is incompatible with the requested
133              protocol is attempted.  If set before any target  specification,
134              it  affects  all  targets,  unless  overridden by any per-target
135              directive.
136
137
138       pseudoroot-bind-defer {YES|no}
139              This directive, when set to yes, causes  the  authentication  to
140              the  remote  servers with the pseudo-root identity (the identity
141              defined in each idassert-bind directive) to  be  deferred  until
142              actually  needed by subsequent operations.  Otherwise, all binds
143              as the rootdn are propagated to the targets.
144
145
146       quarantine <interval>,<num>[;<interval>,<num>[...]]
147              Turns on quarantine of URIs that returned  LDAP_UNAVAILABLE,  so
148              that  an  attempt  to  reconnect  only occurs at given intervals
149              instead of any time a client requests an operation.  The pattern
150              is:  retry  only  after  at least interval seconds elapsed since
151              last attempt, for exactly num times; then use the next  pattern.
152              If  num  for the last pattern is "+", it retries forever; other‐
153              wise, no more retries occur.  This directive must appear  before
154              any  target  specification; it affects all targets with the same
155              pattern.
156
157
158       rebind-as-user {NO|yes}
159              If this option is  given,  the  client's  bind  credentials  are
160              remembered  for  rebinds,  when  trying to re-establish a broken
161              connection, or when chasing a referral,  if  chase-referrals  is
162              set to yes.
163
164
165       session-tracking-request {NO|yes}
166              Adds session tracking control for all requests.  The client's IP
167              and hostname, and the identity associated to  each  request,  if
168              known, are sent to the remote server for informational purposes.
169              This directive is incompatible with setting protocol-version  to
170              2.   If set before any target specification, it affects all tar‐
171              gets, unless overridden by any per-target directive.
172
173
174       single-conn {NO|yes}
175              Discards current cached connection when the client rebinds.
176
177
178       use-temporary-conn {NO|yes}
179              when set to yes, create a temporary connection whenever  compet‐
180              ing  with  other threads for a shared one; otherwise, wait until
181              the shared connection is available.
182
183

TARGET SPECIFICATION

185       Target specification starts with a "uri" directive:
186
187
188       uri <protocol>://[<host>]/<naming context> [...]
189              The <protocol> part can be anything  ldap_initialize(3)  accepts
190              ({ldap|ldaps|ldapi}  and  variants);  the <host> may be omitted,
191              defaulting to whatever is set in ldap.conf(5).  The <naming con‐
192              text>  part is mandatory for the first URI, but it must be omit‐
193              ted for subsequent ones, if any.  The naming context  part  must
194              be within the naming context defined for the backend, e.g.:
195
196              suffix "dc=foo,dc=com"
197              uri    "ldap://x.foo.com/dc=x,dc=foo,dc=com"
198
199              The  <naming  context> part doesn't need to be unique across the
200              targets; it may also match one of the  values  of  the  "suffix"
201              directive.   Multiple URIs may be defined in a single URI state‐
202              ment.  The additional URIs must be separate arguments  and  must
203              not  have any <naming context> part.  This causes the underlying
204              library to contact the first server of the list  that  responds.
205              For  example,  if  l1.foo.com  and l2.foo.com are shadows of the
206              same server, the directive
207
208              suffix "dc=foo,dc=com"
209              uri    "ldap://l1.foo.com/dc=foo,dc=com" "ldap://l2.foo.com/"
210
211              causes l2.foo.com to be contacted whenever l1.foo.com  does  not
212              respond.   In  that case, the URI list is internally rearranged,
213              by moving unavailable URIs to the end, so that  further  connec‐
214              tion attempts occur with respect to the last URI that succeeded.
215
216
217       acl-authcDN <administrative DN for access control purposes>
218              DN which is used to query the target server for acl checking, as
219              in the LDAP backend; it is supposed to have read access  on  the
220              target  server to attributes used on the proxy for acl checking.
221              There is no risk of giving away such values; they are only  used
222              to  check  permissions.  The acl-authcDN identity is by no means
223              implicitly used by the proxy when  the  client  connects  anony‐
224              mously.
225
226
227       acl-passwd <password>
228              Password used with the acl-authcDN above.
229
230
231       bind-timeout <microseconds>
232              This  directive  defines the timeout, in microseconds, used when
233              polling for response after an asynchronous bind connection.  The
234              initial  call  to  ldap_result(3)  is performed with a trade-off
235              timeout of 100000 us; if that results  in  a  timeout  exceeded,
236              subsequent  calls use the value provided with bind-timeout.  The
237              default value is used also for subsequent calls if  bind-timeout
238              is  not  specified.   If set before any target specification, it
239              affects all targets, unless overridden by any per-target  direc‐
240              tive.
241
242
243       chase-referrals {YES|no}
244              enable/disable automatic referral chasing, which is delegated to
245              the underlying libldap, with rebinding eventually  performed  if
246              the  rebind-as-user  directive is used.  The default is to chase
247              referrals.  If set before any target specification,  it  affects
248              all targets, unless overridden by any per-target directive.
249
250
251       client-pr {accept-unsolicited|DISABLE|<size>}
252              This  feature  allows to use RFC 2696 Paged Results control when
253              performing search operations with a specific  target,  irrespec‐
254              tive  of  the  client's  request.   When set to a numeric value,
255              Paged Results control is always used with size as the page size.
256              When  set  to accept-unsolicited, unsolicited Paged Results con‐
257              trol responses are accepted and honored for  compatibility  with
258              broken  remote DSAs.  The client is not exposed to paged results
259              handling between  slapd-meta(5)  and  the  remote  servers.   By
260              default  (disabled),  Paged  Results  control  is  not  used and
261              responses are not accepted.  If set before any target specifica‐
262              tion,  it affects all targets, unless overridden by any per-tar‐
263              get directive.
264
265
266       default-target [<target>]
267              The "default-target" directive can also be  used  during  target
268              specification.  With no arguments it marks the current target as
269              the default.  The optional number marks target <target>  as  the
270              default one, starting from 1.  Target <target> must be defined.
271
272
273       filter <pattern>
274              This  directive allows specifying a regex(5) pattern to indicate
275              what search filter terms are actually served by a target.
276
277              In a search request, if the search filter  matches  the  pattern
278              the target is considered while fulfilling the request; otherwise
279              the target is ignored. There may be multiple occurrences of  the
280              filter directive for each target.
281
282
283       idassert-authzFrom <authz-regexp>
284              if  defined,  selects  what  local  identities are authorized to
285              exploit the identity assertion feature.  The string  <authz-reg‐
286              exp> follows the rules defined for the authzFrom attribute.  See
287              slapd.conf(5), section related to authz-policy, for  details  on
288              the syntax of this field.
289
290
291       idassert-bind    bindmethod=none|simple|sasl    [binddn=<simple    DN>]
292              [credentials=<simple    password>]    [saslmech=<SASL     mech>]
293              [secprops=<properties>] [realm=<realm>] [authcId=<authentication
294              ID>]  [authzId=<authorization  ID>]  [authz={native|proxyauthz}]
295              [mode=<mode>]     [flags=<flags>]     [starttls=no|yes|critical]
296              [tls_cert=<file>]      [tls_key=<file>]      [tls_cacert=<file>]
297              [tls_cacertdir=<path>]      [tls_reqcert=never|allow|try|demand]
298              [tls_ciphersuite=<ciphers>] [tls_protocol_min=<major>[.<minor>]]
299              [tls_crlcheck=none|peer|all]
300              Allows  to  define  the  parameters of the authentication method
301              that is internally used by the proxy  to  authorize  connections
302              that are authenticated by other databases.  The identity defined
303              by this directive, according to the properties associated to the
304              authentication  method,  is  supposed to have auth access on the
305              target server to attributes used on the proxy for authentication
306              and  authorization,  and  to  be allowed to authorize the users.
307              This requires to have proxyAuthz privileges on  a  wide  set  of
308              DNs,  e.g.  authzTo=dn.subtree:"", and the remote server to have
309              authz-policy set to to or both.  See slapd.conf(5)  for  details
310              on  these  statements  and for remarks and drawbacks about their
311              usage.  The supported bindmethods are
312
313              none|simple|sasl
314
315              where none  is  the  default,  i.e.  no  identity  assertion  is
316              performed.
317
318              The authz parameter is used to instruct the SASL bind to exploit
319              native SASL authorization, if available; since  connections  are
320              cached,  this  should only be used when authorizing with a fixed
321              identity (e.g. by means of the authzDN or  authzID  parameters).
322              Otherwise,  the  default proxyauthz is used, i.e. the proxyAuthz
323              control (Proxied  Authorization,  RFC  4370)  is  added  to  all
324              operations.
325
326              The supported modes are:
327
328              <mode> := {legacy|anonymous|none|self}
329
330              If <mode> is not present, and authzId is given, the proxy always
331              authorizes that identity.  <authorization ID> can be
332
333              u:<user>
334
335              [dn:]<DN>
336
337              The former is supposed to  be  expanded  by  the  remote  server
338              according to the authz rules; see slapd.conf(5) for details.  In
339              the latter case, whether or not the dn: prefix is  present,  the
340              string must pass DN validation and normalization.
341
342              The  default  mode  is legacy, which implies that the proxy will
343              either perform a simple bind as the authcDN or a  SASL  bind  as
344              the  authcID  and  assert  the  client's identity when it is not
345              anonymous.  Direct binds are always proxied.   The  other  modes
346              imply that the proxy will always either perform a simple bind as
347              the authcDN or a SASL bind as the authcID, unless restricted  by
348              idassert-authzFrom   rules   (see  below),  in  which  case  the
349              operation will fail;  eventually,  it  will  assert  some  other
350              identity  according  to  <mode>.  Other identity assertion modes
351              are anonymous and self, which respectively mean that  the  empty
352              or  the  client's  identity  will be asserted; none, which means
353              that no proxyAuthz control will be used, so the authcDN  or  the
354              authcID  identity  will be asserted.  For all modes that require
355              the use of the proxyAuthz control,  on  the  remote  server  the
356              proxy identity must have appropriate authzTo permissions, or the
357              asserted identities must have appropriate authzFrom permissions.
358              Note,  however,  that  the ID assertion feature is mostly useful
359              when the asserted identities do not exist on the remote server.
360
361              Flags can be
362
363              override,[non-]prescriptive,proxy-authz-[non-]critical
364
365              When the override flag is used, identity assertion  takes  place
366              even  when  the  database is authorizing for the identity of the
367              client, i.e. after binding with the provided identity, and  thus
368              authenticating  it,  the  proxy  performs the identity assertion
369              using the configured identity and authentication method.
370
371              When the prescriptive flag is  used  (the  default),  operations
372              fail with inappropriateAuthentication for those identities whose
373              assertion is not allowed by the idassert-authzFrom patterns.  If
374              the  non-prescriptive  flag  is  used,  operations are performed
375              anonymously for those identities whose assertion is not  allowed
376              by the idassert-authzFrom patterns.
377
378              When  the  proxy-authz-non-critical  flag is used (the default),
379              the proxyAuthz control is not marked as critical,  in  violation
380              of RFC 4370.  Use of proxy-authz-critical is recommended.
381
382              The  TLS  settings  default  to  the  same as the main slapd TLS
383              settings, except for tls_reqcert which defaults to "demand".
384
385              The identity associated to  this  directive  is  also  used  for
386              privileged  operations  whenever  idassert-bind  is  defined and
387              acl-bind is not.  See acl-bind for details.
388
389
390       idle-timeout <time>
391              This directive causes a  cached  connection  to  be  dropped  an
392              recreated  after  it  has been idle for the specified time.  The
393              value can be specified as
394
395              [<d>d][<h>h][<m>m][<s>[s]]
396
397              where <d>, <h>, <m> and <s> are respectively  treated  as  days,
398              hours,   minutes   and   seconds.   If  set  before  any  target
399              specification, it affects all targets, unless overridden by  any
400              per-target directive.
401
402
403       keepalive <idle>:<probes>:<interval>
404              The  keepalive  parameter  sets  the values of idle, probes, and
405              interval used to check whether a socket is alive;  idle  is  the
406              number  of  seconds a connection needs to remain idle before TCP
407              starts sending keepalive probes; probes is the maximum number of
408              keepalive probes TCP should send before dropping the connection;
409              interval is interval in  seconds  between  individual  keepalive
410              probes.   Only  some  systems support the customization of these
411              values;  the  keepalive  parameter  is  ignored  otherwise,  and
412              system-wide settings are used.
413
414
415       map {attribute|objectclass} [<local name>|*] {<foreign name>|*}
416              This  maps object classes and attributes as in the LDAP backend.
417              See slapd-ldap(5).
418
419
420       network-timeout <time>
421              Sets the network timeout  value  after  which  poll(2)/select(2)
422              following  a  connect(2)  returns  in  case of no activity.  The
423              value  is  in  seconds,  and  it  can  be   specified   as   for
424              idle-timeout.   If  set  before  any  target  specification,  it
425              affects  all  targets,  unless  overridden  by  any   per-target
426              directive.
427
428
429       nretries {forever|never|<nretries>}
430              This  directive  defines how many times a bind should be retried
431              in case of temporary failure in contacting a target.  If defined
432              before  any  target specification, it applies to all targets (by
433              default, 3  times);  the  global  value  can  be  overridden  by
434              redefinitions inside each target specification.
435
436
437       rewrite* ...
438              The rewrite options are described in the "REWRITING" section.
439
440
441       subtree-{exclude|include} <rule>
442              This  directive  allows  to  indicate what subtrees are actually
443              served by a target.  The syntax of the supported rules is
444
445              <rule>: [dn[.<style>]:]<pattern>
446
447              <style>: subtree|children|regex
448
449              When <style> is either subtree or children the <pattern> is a DN
450              that  must  be  within  the naming context served by the target.
451              When <style> is regex the <pattern> is a regex(5)  pattern.   If
452              the  dn.<style>:  prefix  is  omitted, dn.subtree: is implicitly
453              assumed for backward compatibility.
454
455              In the subtree-exclude form if the request DN matches  at  least
456              one  rule,  the  target  is  not considered while fulfilling the
457              request; otherwise, the target is considered based on the  value
458              of the request DN.  When the request is a search, also the scope
459              is considered.
460
461              In the subtree-include form if the request DN matches  at  least
462              one rule, the target is considered while fulfilling the request;
463              otherwise the target is ignored.
464
465
466                  |  match  | exclude |
467                  +---------+---------+-------------------+
468                  |    T    |    T    | not candidate     |
469                  |    F    |    T    | continue checking |
470                  +---------+---------+-------------------+
471                  |    T    |    F    | candidate         |
472                  |    F    |    F    | not candidate     |
473                  +---------+---------+-------------------+
474
475              There may be multiple  occurrences  of  the  subtree-exclude  or
476              subtree-include  directive for each of the targets, but they are
477              mutually exclusive.
478
479
480       suffixmassage <virtual naming context> <real naming context>
481              All the directives starting with "rewrite" refer to the  rewrite
482              engine  that  has  been  added  to  slapd.   The "suffixmassage"
483              directive was introduced in the LDAP  backend  to  allow  suffix
484              massaging   while  proxying.   It  has  been  obsoleted  by  the
485              rewriting tools.  However, both for backward  compatibility  and
486              for   ease  of  configuration  when  simple  suffix  massage  is
487              required, it has been preserved.  It wraps the  basic  rewriting
488              instructions that perform suffix massaging.  See the "REWRITING"
489              section for a detailed list of the rewrite rules it implies.
490
491
492       t-f-support {NO|yes|discover}
493              enable if the remote server supports absolute filters  (see  RFC
494              4526  for  details).  If set to discover, support is detected by
495              reading the remote server's root DSE.  If set before any  target
496              specification,  it affects all targets, unless overridden by any
497              per-target directive.
498
499
500       timeout [<op>=]<val> [...]
501              This directive allows to set per-operation timeouts.  Operations
502              can be
503
504              <op> ::= bind, add, delete, modrdn, modify, compare, search
505
506              The  overall  duration  of  the  search  operation is controlled
507              either by the timelimit parameter  or  by  server-side  enforced
508              time  limits  (see  timelimit  and  limits  in slapd.conf(5) for
509              details).  This timeout parameter controls how long  the  target
510              can be irresponsive before the operation is aborted.  Timeout is
511              meaningless for the remaining operations,  unbind  and  abandon,
512              which do not imply any response, while it is not yet implemented
513              in currently supported extended operations.  If no operation  is
514              specified, the timeout val affects all supported operations.  If
515              specified before any target definition, it affects  all  targets
516              unless overridden by per-target directives.
517
518              Note:  if  the  timeout  is exceeded, the operation is cancelled
519              (according to the  cancel  directive);  the  protocol  does  not
520              provide any means to rollback operations, so the client will not
521              be notified  about  the  result  of  the  operation,  which  may
522              eventually  succeeded  or  not.  In case the timeout is exceeded
523              during a bind operation, the connection is destroyed,  according
524              to RFC4511.
525
526
527       tls {[try-]start|[try-]propagate}
528              execute  the  StartTLS extended operation when the connection is
529              initialized; only works if the URI directive protocol scheme  is
530              not  ldaps://.   propagate issues the StartTLS operation only if
531              the original connection did.   The  try-  prefix  instructs  the
532              proxy  to  continue operations if the StartTLS operation failed;
533              its  use  is  highly  deprecated.   If  set  before  any  target
534              specification,  it affects all targets, unless overridden by any
535              per-target directive.
536
537

SCENARIOS

539       A powerful (and in some sense dangerous) rewrite engine has been  added
540       to  both the LDAP and Meta backends.  While the former can gain limited
541       beneficial effects from rewriting  stuff,  the  latter  can  become  an
542       amazingly powerful tool.
543
544       Consider a couple of scenarios first.
545
546       1)  Two  directory  servers  share  two  levels  of naming context; say
547       "dc=a,dc=foo,dc=com" and "dc=b,dc=foo,dc=com".   Then,  an  unambiguous
548       Meta database can be configured as:
549
550              database meta
551              suffix   "dc=foo,dc=com"
552              uri      "ldap://a.foo.com/dc=a,dc=foo,dc=com"
553              uri      "ldap://b.foo.com/dc=b,dc=foo,dc=com"
554
555       Operations directed to a specific target can be easily resolved because
556       there are no ambiguities.  The  only  operation  that  may  resolve  to
557       multiple  targets  is  a  search with base "dc=foo,dc=com" and scope at
558       least "one", which results in spawning two searches to the targets.
559
560       2a) Two directory servers don't share any portion  of  naming  context,
561       but  they'd  present  as a single DIT [Caveat: uniqueness of (massaged)
562       entries among the two servers is  assumed;  integrity  checks  risk  to
563       incur  in  excessive  overhead  and have not been implemented].  Say we
564       have "dc=bar,dc=org" and "o=Foo,c=US", and we'd like them to appear  as
565       branches    of    "dc=foo,dc=com",    say    "dc=a,dc=foo,dc=com"   and
566       "dc=b,dc=foo,dc=com".  Then we need to configure our Meta backend as:
567
568              database      meta
569              suffix        "dc=foo,dc=com"
570
571              uri           "ldap://a.bar.com/dc=a,dc=foo,dc=com"
572              suffixmassage "dc=a,dc=foo,dc=com" "dc=bar,dc=org"
573
574              uri           "ldap://b.foo.com/dc=b,dc=foo,dc=com"
575              suffixmassage "dc=b,dc=foo,dc=com" "o=Foo,c=US"
576
577       Again, operations can be  resolved  without  ambiguity,  although  some
578       rewriting  is required.  Notice that the virtual naming context of each
579       target is a branch of the database's naming context;  it  is  rewritten
580       back  and  forth  when  operations  are  performed  towards  the target
581       servers.  What "back and forth" means will be clarified later.
582
583       When a search with base "dc=foo,dc=com" is attempted, if the  scope  is
584       "base"  it fails with "no such object"; in fact, the common root of the
585       two targets (prior to massaging) does  not  exist.   If  the  scope  is
586       "one",  both  targets  are  contacted  with  the  base replaced by each
587       target's base; the scope is derated to "base".   In  general,  a  scope
588       "one"  search  is  honored,  and  the  scope  is derated, only when the
589       incoming base is at most one level lower of a target's  naming  context
590       (prior to massaging).
591
592       Finally,  if  the  scope is "sub" the incoming base is replaced by each
593       target's unmassaged naming context, and the scope is not altered.
594
595       2b) Consider the above reported scenario with the two  servers  sharing
596       the same naming context:
597
598              database      meta
599              suffix        "dc=foo,dc=com"
600
601              uri           "ldap://a.bar.com/dc=foo,dc=com"
602              suffixmassage "dc=foo,dc=com" "dc=bar,dc=org"
603
604              uri           "ldap://b.foo.com/dc=foo,dc=com"
605              suffixmassage "dc=foo,dc=com" "o=Foo,c=US"
606
607       All  the  previous considerations hold, except that now there is no way
608       to unambiguously resolve a DN.  In this case, all the  operations  that
609       require  an  unambiguous  target  selection  will fail unless the DN is
610       already  cached  or  a  default  target  has   been   set.    Practical
611       configurations may result as a combination of all the above scenarios.
612

ACLs

614       Note on ACLs: at present you may add whatever ACL rule you desire to to
615       the Meta (and LDAP) backends.  However, the meaning  of  an  ACL  on  a
616       proxy  may  require  some  considerations.   Two  philosophies  may  be
617       considered:
618
619       a) the remote server dictates the permissions; the proxy simply  passes
620       back what it gets from the remote server.
621
622       b) the remote server unveils "everything"; the proxy is responsible for
623       protecting data from unauthorized access.
624
625       Of course the latter  sounds  unreasonable,  but  it  is  not.   It  is
626       possible  to  imagine  scenarios  in which a remote host discloses data
627       that can be considered "public" inside an intranet, and  a  proxy  that
628       connects it to the internet may impose additional constraints.  To this
629       purpose, the proxy should be able to comply with all the  ACL  matching
630       criteria  that the server supports.  This has been achieved with regard
631       to all the criteria supported by slapd except  a  special  subtle  case
632       (please   file   an   ITS   if   you   can   find   other   exceptions:
633       <http://www.openldap.org/its/>).  The rule
634
635              access to dn="<dn>" attrs=<attr>
636                     by dnattr=<dnattr> read
637                     by * none
638
639       cannot be matched iff the attribute that is being requested, <attr>, is
640       NOT  <dnattr>,  and the attribute that determines membership, <dnattr>,
641       has not been requested (e.g. in a search)
642
643       In fact this ACL is resolved by slapd using the  portion  of  entry  it
644       retrieved   from  the  remote  server  without  requiring  any  further
645       intervention of the backend, so, if the <dnattr> attribute has not been
646       fetched,  the  match  cannot  be  assessed because the attribute is not
647       present, not because no value matches the requirement!
648
649       Note on ACLs and attribute mapping: ACLs  are  applied  to  the  mapped
650       attributes;  for  instance,  if the attribute locally known as "foo" is
651       mapped to "bar" on a remote server, then local ACLs apply to  attribute
652       "foo"  and  are  totally unaware of its remote name.  The remote server
653       will check permissions for "bar", and the local  server  will  possibly
654       enforce additional restrictions to "foo".
655

REWRITING

657       A  string  is  rewritten according to a set of rules, called a `rewrite
658       context'.   The  rules  are  based  on  POSIX  (''extended'')   regular
659       expressions   (regex)   with   substring   matching;   basic   variable
660       substitution and map resolution of substrings is  allowed  by  specific
661       mechanisms   detailed  in  the  following.   The  behavior  of  pattern
662       matching/substitution can be altered by a set of flags.
663
664       The underlying concept is to build a lightweight rewrite module for the
665       slapd server (initially dedicated to the LDAP backend).
666

Passes

668       An  incoming  string is matched against a set of rules.  Rules are made
669       of a regex match pattern, a substitution pattern and a set of  actions,
670       described  by  a  set of flags.  In case of match a string rewriting is
671       performed according to the substitution pattern that allows to refer to
672       substrings  matched  in  the incoming string.  The actions, if any, are
673       finally performed.  The substitution pattern allows map  resolution  of
674       substrings.  A map is a generic object that maps a substitution pattern
675       to a value.  The flags are divided  in  "Pattern  matching  Flags"  and
676       "Action Flags"; the former alter the regex match pattern behavior while
677       the latter alter the action that is taken after substitution.
678

Pattern Matching Flags

680       `C'    honors case in matching (default is case insensitive)
681
682       `R'    use   POSIX   ''basic''   regular   expressions   (default    is
683              ''extended'')
684
685       `M{n}' allow  no more than n recursive passes for a specific rule; does
686              not alter the max total count of passes, so it can only  enforce
687              a stricter limit for a specific rule.
688

Action Flags

690       `:'    apply the rule once only (default is recursive)
691
692       `@'    stop  applying rules in case of match; the current rule is still
693              applied recursively; combine with `:' to apply the current  rule
694              only once and then stop.
695
696       `#'    stop  current  operation  if  the  rule  matches,  and  issue an
697              `unwilling to perform' error.
698
699       `G{n}' jump n rules back and  forth  (watch  for  loops!).   Note  that
700              `G{1}' is implicit in every rule.
701
702       `I'    ignores  errors  in  rule;  this  means,  in case of error, e.g.
703              issued by a map, the error is treated as a  missed  match.   The
704              `unwilling to perform' is not overridden.
705
706       `U{n}' uses  n  as  return  code if the rule matches; the flag does not
707              alter the recursive  behavior  of  the  rule,  so,  to  have  it
708              performed  only  once,  it must be used in combination with `:',
709              e.g.   `:U{16}'  returns  the  value  `16'  after  exactly   one
710              execution   of   the   rule,  if  the  pattern  matches.   As  a
711              consequence, its behavior is equivalent to `@', with the  return
712              code  set to n; or, in other words, `@' is equivalent to `U{0}'.
713              By convention, the freely available codes are above 16 included;
714              the others are reserved.
715
716       The  ordering  of  the flags can be significant.  For instance: `IG{2}'
717       means ignore errors and jump two lines ahead both in case of match  and
718       in case of error, while `G{2}I' means ignore errors, but jump two lines
719       ahead only in case of match.
720
721       More flags (mainly Action Flags) will be added as needed.
722

Pattern matching:

724       See regex(7) and/or re_format(7).
725

Substitution Pattern Syntax:

727       Everything starting with `%' requires substitution;
728
729       the only obvious exception is `%%', which is left as is;
730
731       the basic substitution is `%d', where `d' is a digit; 0 means the whole
732       string, while 1-9 is a submatch;
733
734       a  `%' followed by a `{' invokes an advanced substitution.  The pattern
735       is:
736
737              `%' `{' [ <op> ] <name> `(' <substitution> `)' `}'
738
739       where <name> must be a legal name for the map, i.e.
740
741              <name> ::= [a-z][a-z0-9]* (case insensitive)
742              <op> ::= `>' `|' `&' `&&' `*' `**' `$'
743
744       and <substitution> must be a legal substitution pattern, with no limits
745       on the nesting level.
746
747       The operators are:
748
749       >      sub  context invocation; <name> must be a legal, already defined
750              rewrite context name
751
752       |      external command invocation;  <name>  must  refer  to  a  legal,
753              already defined command name (NOT IMPL.)
754
755       &      variable  assignment;  <name>  defines a variable in the running
756              operation structure which can be dereferenced later; operator  &
757              assigns  a  variable  in  the rewrite context scope; operator &&
758              assigns a variable that scopes  the  entire  session,  e.g.  its
759              value can be dereferenced later by other rewrite contexts
760
761       *      variable  dereferencing; <name> must refer to a variable that is
762              defined and assigned  for  the  running  operation;  operator  *
763              dereferences a variable scoping the rewrite context; operator **
764              dereferences a variable scoping  the  whole  session,  e.g.  the
765              value is passed across rewrite contexts
766
767       $      parameter  dereferencing;  <name>  must  refer  to  an  existing
768              parameter; the idea is to make some run-time parameters  set  by
769              the  system  available to the rewrite engine, as the client host
770              name, the bind DN if any,  constant  parameters  initialized  at
771              config  time, and so on; no parameter is currently set by either
772              back-ldap or back-meta, but constant parameters can  be  defined
773              in the configuration file by using the rewriteParam directive.
774
775       Substitution  escaping  has  been delegated to the `%' symbol, which is
776       used instead of `\' in string  substitution  patterns  because  `\'  is
777       already   escaped   by   slapd's  low  level  parsing  routines;  as  a
778       consequence,  regex   escaping   requires   two   `\'   symbols,   e.g.
779       `.*\.foo\.bar' must be written as `.*\\.foo\\.bar'.
780

Rewrite context:

782       A rewrite context is a set of rules which are applied in sequence.  The
783       basic idea is to have an application initialize a rewrite engine (think
784       of  Apache's  mod_rewrite  ...)  with  a  set of rewrite contexts; when
785       string rewriting is  required,  one  invokes  the  appropriate  rewrite
786       context with the input string and obtains the newly rewritten one if no
787       errors occur.
788
789       Each basic server operation is associated to a  rewrite  context;  they
790       are  divided  in two main groups: client -> server and server -> client
791       rewriting.
792
793       client -> server:
794
795              (default)            if defined and no specific context
796                                   is available
797              bindDN               bind
798              searchBase           search
799              searchFilter         search
800              searchFilterAttrDN   search
801              compareDN            compare
802              compareAttrDN        compare AVA
803              addDN                add
804              addAttrDN            add AVA
805              modifyDN             modify
806              modifyAttrDN         modify AVA
807              modrDN               modrdn
808              newSuperiorDN        modrdn
809              deleteDN             delete
810              exopPasswdDN         password modify extended operation DN if proxy
811
812       server -> client:
813
814              searchResult         search (only if defined; no default;
815                                   acts on DN and DN-syntax attributes
816                                   of search results)
817              searchAttrDN         search AVA
818              matchedDN            all ops (only if applicable)
819

Basic configuration syntax

821       rewriteEngine { on | off }
822              If `on', the requested rewriting  is  performed;  if  `off',  no
823              rewriting  takes  place  (an  easy way to stop rewriting without
824              altering too much the configuration file).
825
826       rewriteContext <context name> [ alias <aliased context name> ]
827              <Context name> is the name that identifies the context, i.e. the
828              name  used  by  the  application to refer to the set of rules it
829              contains.  It is used also to reference sub contexts  in  string
830              rewriting.   A  context may alias another one.  In this case the
831              alias context contains no rule, and any  reference  to  it  will
832              result in accessing the aliased one.
833
834       rewriteRule <regex match pattern> <substitution pattern> [ <flags> ]
835              Determines  how  a  string  can  be  rewritten  if  a pattern is
836              matched.  Examples are reported below.
837

Additional configuration syntax:

839       rewriteMap <map type> <map name> [ <map attrs> ]
840              Allows to define a map that transforms substring rewriting  into
841              something  else.   The map is referenced inside the substitution
842              pattern of a rule.
843
844       rewriteParam <param name> <param value>
845              Sets a value with global scope, that can be dereferenced by  the
846              command `%{$paramName}'.
847
848       rewriteMaxPasses <number of passes> [<number of passes per rule>]
849              Sets  the  maximum  number of total rewriting passes that can be
850              performed in a single rewrite operation  (to  avoid  loops).   A
851              safe  default  is  set  to 100; note that reaching this limit is
852              still treated as a success; recursive  invocation  of  rules  is
853              simply   interrupted.    The  count  applies  to  the  rewriting
854              operation as a whole, not to any single rule; an  optional  per-
855              rule  limit  can  be  set.   This limit is overridden by setting
856              specific per-rule limits with the `M{n}' flag.
857

Configuration examples:

859       # set to `off' to disable rewriting
860       rewriteEngine on
861
862       # the rules the "suffixmassage" directive implies
863       rewriteEngine on
864       # all dataflow from client to server referring to DNs
865       rewriteContext default
866       rewriteRule "(.*)<virtualnamingcontext>$" "%1<realnamingcontext>" ":"
867       # empty filter rule
868       rewriteContext searchFilter
869       # all dataflow from server to client
870       rewriteContext searchResult
871       rewriteRule "(.*)<realnamingcontext>$" "%1<virtualnamingcontext>" ":"
872       rewriteContext searchAttrDN alias searchResult
873       rewriteContext matchedDN alias searchResult
874
875       # Everything defined here goes into the `default' context.
876       # This rule changes the naming context of anything sent
877       # to `dc=home,dc=net' to `dc=OpenLDAP, dc=org'
878
879       rewriteRule "(.*)dc=home,[ ]?dc=net"
880                   "%1dc=OpenLDAP, dc=org"  ":"
881
882       # since a pretty/normalized DN does not include spaces
883       # after rdn separators, e.g. `,', this rule suffices:
884
885       rewriteRule "(.*)dc=home,dc=net"
886                   "%1dc=OpenLDAP,dc=org"  ":"
887
888       # Start a new context (ends input of the previous one).
889       # This rule adds blanks between DN parts if not present.
890       rewriteContext  addBlanks
891       rewriteRule     "(.*),([^ ].*)" "%1, %2"
892
893       # This one eats blanks
894       rewriteContext  eatBlanks
895       rewriteRule     "(.*),[ ](.*)" "%1,%2"
896
897       # Here control goes back to the default rewrite
898       # context; rules are appended to the existing ones.
899       # anything that gets here is piped into rule `addBlanks'
900       rewriteContext  default
901       rewriteRule     ".*" "%{>addBlanks(%0)}" ":"
902
903       # Rewrite the search base according to `default' rules.
904       rewriteContext  searchBase alias default
905
906       # Search results with OpenLDAP DN are rewritten back with
907       # `dc=home,dc=net' naming context, with spaces eaten.
908       rewriteContext  searchResult
909       rewriteRule     "(.*[^ ]?)[ ]?dc=OpenLDAP,[ ]?dc=org"
910                       "%{>eatBlanks(%1)}dc=home,dc=net"    ":"
911
912       # Bind with email instead of full DN: we first need
913       # an ldap map that turns attributes into a DN (the
914       # argument used when invoking the map is appended to
915       # the URI and acts as the filter portion)
916       rewriteMap ldap attr2dn "ldap://host/dc=my,dc=org?dn?sub"
917
918       # Then we need to detect DN made up of a single email,
919       # e.g. `mail=someone@example.com'; note that the rule
920       # in case of match stops rewriting; in case of error,
921       # it is ignored.  In case we are mapping virtual
922       # to real naming contexts, we also need to rewrite
923       # regular DNs, because the definition of a bindDn
924       # rewrite context overrides the default definition.
925       rewriteContext bindDN
926       rewriteRule "^mail=[^,]+@[^,]+$" "%{attr2dn(%0)}" ":@I"
927
928       # This is a rather sophisticated example. It massages a
929       # search filter in case who performs the search has
930       # administrative privileges.  First we need to keep
931       # track of the bind DN of the incoming request, which is
932       # stored in a variable called `binddn' with session scope,
933       # and left in place to allow regular binding:
934       rewriteContext  bindDN
935       rewriteRule     ".+" "%{&&binddn(%0)}%0" ":"
936
937       # A search filter containing `uid=' is rewritten only
938       # if an appropriate DN is bound.
939       # To do this, in the first rule the bound DN is
940       # dereferenced, while the filter is decomposed in a
941       # prefix, in the value of the `uid=<arg>' AVA, and
942       # in a suffix. A tag `<>' is appended to the DN.
943       # If the DN refers to an entry in the `ou=admin' subtree,
944       # the filter is rewritten OR-ing the `uid=<arg>' with
945       # `cn=<arg>'; otherwise it is left as is. This could be
946       # useful, for instance, to allow apache's auth_ldap-1.4
947       # module to authenticate users with both `uid' and
948       # `cn', but only if the request comes from a possible
949       # `cn=Web auth,ou=admin,dc=home,dc=net' user.
950       rewriteContext searchFilter
951       rewriteRule "(.*\\()uid=([a-z0-9_]+)(\\).*)"
952         "%{**binddn}<>%{&prefix(%1)}%{&arg(%2)}%{&suffix(%3)}"
953         ":I"
954       rewriteRule "[^,]+,ou=admin,dc=home,dc=net"
955         "%{*prefix}|(uid=%{*arg})(cn=%{*arg})%{*suffix}" ":@I"
956       rewriteRule ".*<>" "%{*prefix}uid=%{*arg}%{*suffix}" ":"
957
958       # This example shows how to strip unwanted DN-valued
959       # attribute values from a search result; the first rule
960       # matches DN values below "ou=People,dc=example,dc=com";
961       # in case of match the rewriting exits successfully.
962       # The second rule matches everything else and causes
963       # the value to be rejected.
964       rewriteContext searchResult
965       rewriteRule ".*,ou=People,dc=example,dc=com" "%0" ":@"
966       rewriteRule ".*" "" "#"
967

LDAP Proxy resolution (a possible evolution of slapd-ldap(5)):

969       In case the rewritten DN is an LDAP URI,  the  operation  is  initiated
970       towards  the  host[:port] indicated in the uri, if it does not refer to
971       the local server.  E.g.:
972
973         rewriteRule '^cn=root,.*' '%0'                     'G{3}'
974         rewriteRule '^cn=[a-l].*' 'ldap://ldap1.my.org/%0' ':@'
975         rewriteRule '^cn=[m-z].*' 'ldap://ldap2.my.org/%0' ':@'
976         rewriteRule '.*'          'ldap://ldap3.my.org/%0' ':@'
977
978       (Rule 1 is simply there to illustrate the `G{n}' action; it could  have
979       been written:
980
981         rewriteRule '^cn=root,.*' 'ldap://ldap3.my.org/%0' ':@'
982
983       with the advantage of saving one rewrite pass ...)
984
985

ACCESS CONTROL

987       The  meta  backend  does  not  honor  all ACL semantics as described in
988       slapd.access(5).  In general,  access  checking  is  delegated  to  the
989       remote  server(s).  Only read (=r) access to the entry pseudo-attribute
990       and to the other attribute values of the entries returned by the search
991       operation is honored, which is performed by the frontend.
992
993

PROXY CACHE OVERLAY

995       The  proxy  cache  overlay  allows  caching  of  LDAP  search  requests
996       (queries) in a local database.  See slapo-pcache(5) for details.
997
998

DEPRECATED STATEMENTS

1000       The following statements have been deprecated and should no  longer  be
1001       used.
1002
1003
1004       pseudorootdn <substitute DN in case of rootdn bind>
1005              Use idassert-bind instead.
1006
1007
1008       pseudorootpw <substitute password in case of rootdn bind>
1009              Use idassert-bind instead.
1010
1011
1012
1013

FILES

1015       /etc/openldap/slapd.conf
1016              default slapd configuration file
1017

SEE ALSO

1019       slapd.conf(5),   slapd-ldap(5),  slapo-pcache(5),  slapd(8),  regex(7),
1020       re_format(7).
1021

AUTHOR

1023       Pierangelo Masarati, based on back-ldap by Howard Chu
1024
1025
1026
1027OpenLDAP 2.4.40                   2014/09/20                     SLAPD-META(5)
Impressum