SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG
DONATE


YUM REPOSITORY

 
 

MAN page from openSUSE Tumbleweed openldap2-back-meta-2.4.47-46.3.x86_64.rpm

SLAPD-META

Section: File Formats (5)
Updated: 2018/12/19
Index 

NAME

slapd-meta - metadirectory backend to slapd 

SYNOPSIS

/etc/openldap/slapd.conf 

DESCRIPTION

Themetabackend toslapd(8)performs basic LDAP proxying with respect to a set of remote LDAPservers, called "targets".The information contained in these servers can be presented asbelonging to a single Directory Information Tree (DIT).

A basic knowledge of the functionality of theslapd-ldap(5)backend is recommended.This backend has been designed as an enhancement of the ldap backend.The two backends share many features (actually they also shareportions of code).While theldapbackend is intended to proxy operations directed to a single server, themetabackend is mainly intended for proxying of multiple servers and possiblynaming context masquerading.These features, although useful in many scenarios, may result inexcessive overhead for some applications, so its use should becarefully considered.In the examples section, some typical scenarios will be discussed.

The proxy instance ofslapd(8)must contain schema information for the attributes and objectClassesused in filters, request DN and request-related data in general.It should also contain schema information for the data returnedby the proxied server.It is the responsibility of the proxy administrator to keep the schemaof the proxy lined up with that of the proxied server.

Note: When looping back to the same instance of slapd(8), each connection requires a new thread; as a consequence, slapd(8)must be compiled with thread support, and the threads parameter may need some tuning; in those cases, unless the multiple target featureis required, one may consider using slapd-relay(5) instead, which performs the relayed operation internally and thus reuses the same connection.

 

EXAMPLES

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

CONFIGURATION

Theseslapd.confoptions apply to the META backend database.That is, they must follow a "database meta" line and come before anysubsequent "backend" or "database" lines.Other database options are described in theslapd.conf(5)manual page.

Note: In early versions of back-ldap and back-meta it was recommended to always set

lastmod  off

for ldapandmetadatabases.This was required because operational attributes related to entry creation and modification should not be proxied, as they could be mistakenly writtento the target server(s), generating an error.The current implementation automatically sets lastmod to off, so its use is redundant and should be omitted.

 

SPECIAL CONFIGURATION DIRECTIVES

Target configuration starts with the "uri" directive.All the configuration directives that are not specific to targetsshould be defined first for clarity, including those that are commonto all backends.They are:

conn-ttl <time>
This directive causes a cached connection to be dropped an recreatedafter a given ttl, regardless of being idle or not.

default-target none
This directive forces the backend to reject all those operationsthat must resolve to a single target in case none or multipletargets are selected.They include: add, delete, modify, modrdn; compare is not included, aswell as bind since, as they don't alter entries, in case of multiplematches an attempt is made to perform the operation on any candidatetarget, with the constraint that at most one must succeed.This directive can also be used when processing targets to mark aspecific target as default.

dncache-ttl {DISABLED|forever|<ttl>}
This directive sets the time-to-live of the DN cache.This caches the target that holds a given DN to speed up targetselection in case multiple targets would result from an uncachedsearch; forever means cache never expires; disabled means no DNcaching; otherwise a valid ( > 0 ) ttl is required, in the formatillustrated for the idle-timeoutdirective.

onerr {CONTINUE|report|stop}
This directive allows one to select the behavior in case an error is returnedby one target during a search.The default, continue, consists in continuing the operation, trying to return as much data as possible.If the value is set to stop, the search is terminated as soon as an error is returned by one target, and the error is immediately propagated to the client.If the value is set to report, the search is continuated to the endbut, in case at least one target returned an error code, the firstnon-success error code is returned.

norefs <NO|yes>
Ifyes,do not return search reference responses.By default, they are returned unless request is LDAPv2.If set before any target specification, it affects all targets, unlessoverridden by any per-target directive.

noundeffilter <NO|yes>
Ifyes,return success instead of searching if a filter is undefined or containsundefined portions.By default, the search is propagated after replacing undefined portionswith(!(objectClass=*)),which corresponds to the empty result set.If set before any target specification, it affects all targets, unlessoverridden by any per-target directive.

protocol-version {0,2,3}
This directive indicates what protocol version must be used to contactthe remote server.If set to 0 (the default), the proxy uses the same protocol version used by the client, otherwise the requested protocol is used.The proxy returns unwillingToPerform if an operation that is incompatible with the requested protocol is attempted.If set before any target specification, it affects all targets, unlessoverridden by any per-target directive.

pseudoroot-bind-defer {YES|no}
This directive, when set to yes,causes the authentication to the remote servers with the pseudo-rootidentity (the identity defined in eachidassert-binddirective) to be deferred until actually needed by subsequent operations.Otherwise, all binds as the rootdn are propagated to the targets.

quarantine <interval>,<num>[;<interval>,<num>[...]]
Turns on quarantine of URIs that returnedLDAP_UNAVAILABLE,so that an attempt to reconnect only occurs at given intervals insteadof any time a client requests an operation.The pattern is: retry only after at leastintervalseconds elapsed since last attempt, for exactlynumtimes; then use the next pattern.Ifnumfor the last pattern is "+", it retries forever; otherwise, no more retries occur.This directive must appear before any target specification;it affects all targets with the same pattern.

rebind-as-user {NO|yes}
If this option is given, the client's bind credentials are rememberedfor rebinds, when trying to re-establish a broken connection,or when chasing a referral, if chase-referralsis set toyes.

session-tracking-request {NO|yes}
Adds session tracking control for all requests.The client's IP and hostname, and the identity associated to each request,if known, are sent to the remote server for informational purposes.This directive is incompatible with setting protocol-version to 2.If set before any target specification, it affects all targets, unlessoverridden by any per-target directive.

single-conn {NO|yes}
Discards current cached connection when the client rebinds.

use-temporary-conn {NO|yes}
when set to yes,create a temporary connection whenever competing with other threadsfor a shared one; otherwise, wait until the shared connection is available.

 

TARGET SPECIFICATION

Target specification starts with a "uri" directive:

uri <protocol>://[<host>]/<naming context> [...]
The <protocol> part can be anythingldap_initialize(3)accepts ({ldap|ldaps|ldapi} and variants); the <host> may beomitted, defaulting to whatever is set inldap.conf(5).The <naming context> part is mandatory for the first URI,but it must be omitted for subsequent ones, if any.The naming context part must be within the naming context defined for the backend,e.g.:

suffix "dc=foo,dc=com"uri    "ldap://x.foo.com/dc=x,dc=foo,dc=com"

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.Multiple URIs may be defined in a single URI statement.The additional URIs must be separate arguments and must not have any<naming context> part. This causes the underlying libraryto contact the first server of the list that responds.For example, if l1.foo.com and l2.foo.com are shadowsof the same server, the directive

suffix "dc=foo,dc=com"uri    "ldap://l1.foo.com/dc=foo,dc=com" "ldap://l2.foo.com/"

causes l2.foo.com to be contacted whenever l1.foo.comdoes not respond.In that case, the URI list is internally rearranged, by moving unavailableURIs to the end, so that further connection attempts occur with respect tothe last URI that succeeded.

acl-authcDN <administrative DN for access control purposes>
DN which is used to query the target server for acl checking,as in the LDAP backend; it is supposed to 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 tocheck permissions.The acl-authcDN identity is by no means implicitly used by the proxy when the client connects anonymously.

acl-passwd <password>
Password used with theacl-authcDNabove.

bind-timeout <microseconds>
This directive defines the timeout, in microseconds, used when pollingfor response after an asynchronous bind connection. The initial callto ldap_result(3) is performed with a trade-off timeout of 100000 us;if that results in a timeout exceeded, subsequent calls use the valueprovided withbind-timeout.The default value is used also for subsequent calls ifbind-timeoutis not specified.If set before any target specification, it affects all targets, unlessoverridden by any per-target directive.

chase-referrals {YES|no}
enable/disable automatic referral chasing, which is delegated to theunderlying libldap, with rebinding eventually performed if therebind-as-user directive is used. The default is to chase referrals.If set before any target specification, it affects all targets, unlessoverridden by any per-target directive.

client-pr {accept-unsolicited|DISABLE|<size>}
This feature allows one to use RFC 2696 Paged Results control when performingsearch operations with a specific target,irrespective of the client's request.When set to a numeric value, Paged Results control is alwaysused with size as the page size.When set to accept-unsolicited, unsolicited Paged Resultscontrol responses are accepted and honoredfor compatibility with broken remote DSAs.The client is not exposed to paged results handlingbetweenslapd-meta(5)and the remote servers.By default (disabled), Paged Results control is not usedand responses are not accepted.If set before any target specification, it affects all targets, unlessoverridden by any per-target directive.

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, startingfrom 1.Target <target> must be defined.

filter <pattern>
This directive allows specifying aregex(5)pattern to indicate what search filter terms are actually served by a target.

In a search request, if the search filter matches the patternthe target is considered while fulfilling the request; otherwisethe target is ignored. There may be multiple occurrences ofthefilterdirective for each target.

idassert-authzFrom <authz-regexp>
if defined, selects whatlocalidentities are authorized to exploit the identity assertion feature.The string<authz-regexp>follows the rules defined for theauthzFromattribute.See slapd.conf(5),section related toauthz-policy,for details on the syntax of this field.

idassert-bindbindmethod=none|simple|sasl [binddn=<simple DN>] [credentials=<simple password>][saslmech=<SASL mech>] [secprops=<properties>] [realm=<realm>][authcId=<authentication ID>] [authzId=<authorization ID>][authz={native|proxyauthz}] [mode=<mode>] [flags=<flags>][starttls=no|yes|critical][tls_cert=<file>][tls_key=<file>][tls_cacert=<file>][tls_cacertdir=<path>][tls_reqcert=never|allow|try|demand][tls_cipher_suite=<ciphers>][tls_protocol_min=<major>[.<minor>]][tls_crlcheck=none|peer|all]
Allows one to define the parameters of the authentication method that isinternally used by the proxy to authorize connections that are authenticated by other databases.The identity defined by this directive, according to the propertiesassociated to the authentication method, is supposed to have auth access on the target server to attributes used on the proxy for authenticationand authorization, and to be allowed to authorize the users.This requires to haveproxyAuthzprivileges on a wide set of DNs, e.g.authzTo=dn.subtree:,and the remote server to haveauthz-policyset totoorboth.Seeslapd.conf(5)for details on these statements and for remarks and drawbacks abouttheir usage.The supported bindmethods are

none|simple|sasl

wherenoneis the default, i.e. no identity assertion is performed.

The authz parameter is used to instruct the SASL bind to exploit native SASL authorization, if available; since connections are cached,this should only be used when authorizing with a fixed identity(e.g. by means of the authzDNorauthzIDparameters).Otherwise, the defaultproxyauthzis used, i.e. the proxyAuthz control (Proxied Authorization, RFC 4370)is added to all operations.

The supported modes are:

<mode> := {legacy|anonymous|none|self}

If <mode>is not present, and authzIdis given, the proxy always authorizes that identity.<authorization ID>can be

u:<user>

[dn:]<DN>

The former is supposed to be expanded by the remote server according to the authz rules; seeslapd.conf(5)for details.In the latter case, whether or not the dn:prefix is present, the string must pass DN validation and normalization.

The default mode is legacy,which implies that the proxy will either perform a simple bind as theauthcDNor a SASL bind as theauthcIDand assert the client's identity when it is not anonymous.Direct binds are always proxied.The other modes imply that the proxy will always either perform a simple bind as theauthcDNor a SASL bind as theauthcID,unless restricted byidassert-authzFromrules (see below), in which case the operation will fail;eventually, it will assert some other identity according to<mode>.Other identity assertion modes areanonymousandself,which respectively mean that the empty or the client'sidentitywill be asserted;none,which means that no proxyAuthz control will be used, so theauthcDNor theauthcIDidentity will be asserted.For all modes that require the use of theproxyAuthz control, on the remote server the proxy identity must have appropriate authzTopermissions, or the asserted identities must have appropriateauthzFrom permissions. Note, however, that the ID assertion feature is mostly useful when the asserted identities do not exist on the remote server.

Flags can be

override,[non-]prescriptive,proxy-authz-[non-]critical

When the overrideflag is used, identity assertion takes place even when the databaseis authorizing for the identity of the client, i.e. after bindingwith the provided identity, and thus authenticating it, the proxyperforms the identity assertion using the configured identity andauthentication method.

When theprescriptiveflag is used (the default), operations fail withinappropriateAuthenticationfor those identities whose assertion is not allowed by theidassert-authzFrompatterns.If the non-prescriptiveflag is used, operations are performed anonymously for those identities whose assertion is not allowed by theidassert-authzFrompatterns.

When theproxy-authz-non-criticalflag is used (the default), the proxyAuthz control is not marked as critical,in violation of RFC 4370. Use ofproxy-authz-criticalis recommended.

The TLS settings default to the same as the main slapd TLS settings,except fortls_reqcertwhich defaults to "demand".

The identity associated to this directive is also used for privilegedoperations whenever idassert-bind is defined and acl-bindis not. See acl-bind for details.

idle-timeout <time>
This directive causes a cached connection to be dropped an recreatedafter it has been idle for the specified time.The value can be specified as

[<d>d][<h>h][<m>m][<s>[s]]

where <d>, <h>, <m> and <s> are respectively treated as days, hours, minutes and seconds.If set before any target specification, it affects all targets, unlessoverridden by any per-target directive.

keepalive <idle>:<probes>:<interval>
Thekeepaliveparameter sets the values of idle, probes, and intervalused to check whether a socket is alive;idleis the number of seconds a connection needs to remain idle before TCPstarts sending keepalive probes;probesis the maximum number of keepalive probes TCP should send before droppingthe connection;intervalis interval in seconds between individual keepalive probes.Only some systems support the customization of these values;thekeepaliveparameter is ignored otherwise, and system-wide settings are used.

map {attribute|objectclass} [<local name>|*] {<foreign name>|*}
This maps object classes and attributes as in the LDAP backend.Seeslapd-ldap(5).

network-timeout <time>
Sets the network timeout value after whichpoll(2)/select(2)following a connect(2)returns in case of no activity.The value is in seconds, and it can be specified as foridle-timeout.If set before any target specification, it affects all targets, unlessoverridden by any per-target directive.

nretries {forever|never|<nretries>}
This directive defines how many times a bind should be retriedin case of temporary failure in contacting a target. If definedbefore any target specification, it applies to all targets (by default,3times);the global value can be overridden by redefinitions inside each targetspecification.

rewrite* ...
The rewrite options are described in the "REWRITING" section.

subtree-{exclude|include} <rule>
This directive allows one to indicate what subtrees are actually servedby a target.The syntax of the supported rules is

<rule>: [dn[.<style>]:]<pattern>

<style>: subtree|children|regex

When <style> is either subtree or childrenthe <pattern> is a DN that must be within the naming contextserved by the target.When <style> is regex the <pattern> is aregex(5)pattern.If the dn.<style>: prefix is omitted, dn.subtree:is implicitly assumed for backward compatibility.

In thesubtree-excludeform if the request DN matches at least one rule,the target is not considered while fulfilling the request;otherwise, the target is considered based on the value of the request DN.When the request is a search, also the scope is considered.

In thesubtree-includeform if the request DN matches at least one rule,the target is considered while fulfilling the request;otherwise the target is ignored.

    |  match  | exclude |    +---------+---------+-------------------+    |    T    |    T    | not candidate     |    |    F    |    T    | continue checking |    +---------+---------+-------------------+    |    T    |    F    | candidate         |    |    F    |    F    | not candidate     |    +---------+---------+-------------------+

There may be multiple occurrences of thesubtree-excludeorsubtree-includedirective for each of the targets, but they are mutually exclusive.

suffixmassage <virtual naming context> <real naming context>
All the directives starting with "rewrite" refer to the rewrite enginethat has been added to slapd.The "suffixmassage" directive was introduced in the LDAP backend toallow suffix massaging while proxying.It has been obsoleted by the rewriting tools.However, both for backward compatibility and for ease of configurationwhen simple suffix massage is required, it has been preserved.It wraps the basic rewriting instructions that perform suffixmassaging. See the "REWRITING" section for a detailed list of the rewrite rules it implies.

t-f-support {NO|yes|discover}
enable if the remote server supports absolute filters(see RFC 4526 for details).If set todiscover,support is detected by reading the remote server's root DSE.If set before any target specification, it affects all targets, unlessoverridden by any per-target directive.

timeout [<op>=]<val> [...]
This directive allows one to set per-operation timeouts.Operations can be

<op> ::= bind, add, delete, modrdn, modify, compare, search

The overall duration of the search operation is controlled eitherby the timelimit parameter or by server-side enforcedtime limits (see timelimit and limits inslapd.conf(5)for details).This timeout parameter controls how long the target can be irresponsive before the operation is aborted.Timeout is meaningless for the remaining operations,unbind and abandon, which do not imply any response,while it is not yet implemented in currently supported extended operations.If no operation is specified, the timeout val affects allsupported operations.If specified before any target definition, it affects all targetsunless overridden by per-target directives.

Note: if the timeout is exceeded, the operation is cancelled(according to the cancel directive);the protocol does not provide any means to rollback operations,so the client will not be notified about the result of the operation,which may eventually succeeded or not.In case the timeout is exceeded during a bind operation, the connectionis destroyed, according to RFC4511.

tls {[try-]start|[try-]propagate}
execute the StartTLS extended operation when the connection is initialized;only works if the URI directive protocol scheme is not ldaps://.propagate issues the StartTLS operation only if the originalconnection did.The try- prefix instructs the proxy to continue operationsif the StartTLS operation failed; its use is highly deprecated.If set before any target specification, it affects all targets, unlessoverridden by any per-target directive.

 

SCENARIOS

A powerful (and in some sense dangerous) rewrite engine has been addedto both the LDAP and Meta backends.While the former can gain limited beneficial effects from rewritingstuff, the latter can become an amazingly powerful tool.

Consider a couple of scenarios first.

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:

database metasuffix   "dc=foo,dc=com"uri      "ldap://a.foo.com/dc=a,dc=foo,dc=com"uri      "ldap://b.foo.com/dc=b,dc=foo,dc=com"

Operations directed to a specific target can be easily resolvedbecause there are no ambiguities.The only operation that may resolve to multiple targets is a searchwith base "dc=foo,dc=com" and scope at least "one", which results inspawning two searches to the targets.

2a) Two directory servers don't share any portion of naming context,but they'd present as a single DIT[Caveat: uniqueness of (massaged) entries among the two servers isassumed; integrity checks risk to incur in excessive overhead and havenot been implemented].Say we have "dc=bar,dc=org" and "o=Foo,c=US",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:

database      metasuffix        "dc=foo,dc=com"uri           "ldap://a.bar.com/dc=a,dc=foo,dc=com"suffixmassage "dc=a,dc=foo,dc=com" "dc=bar,dc=org"uri           "ldap://b.foo.com/dc=b,dc=foo,dc=com"suffixmassage "dc=b,dc=foo,dc=com" "o=Foo,c=US"

Again, operations can be resolved without ambiguity, althoughsome rewriting is required.Notice that the virtual naming context of each target is a branch ofthe database's naming context; it is rewritten back and forth whenoperations are performed towards the target servers.What "back and forth" means will be clarified later.

When a search with base "dc=foo,dc=com" is attempted, if the scope is "base" it fails with "no such object"; in fact, thecommon root of the two targets (prior to massaging) does notexist.If the scope is "one", both targets are contacted with the basereplaced 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'snaming context (prior to massaging).

Finally, if the scope is "sub" the incoming base is replacedby each target's unmassaged naming context, and the scopeis not altered.

2b) Consider the above reported scenario with the two serverssharing the same naming context:

database      metasuffix        "dc=foo,dc=com"uri           "ldap://a.bar.com/dc=foo,dc=com"suffixmassage "dc=foo,dc=com" "dc=bar,dc=org"uri           "ldap://b.foo.com/dc=foo,dc=com"suffixmassage "dc=foo,dc=com" "o=Foo,c=US"

All the previous considerations hold, except that now there isno way to unambiguously resolve a DN.In this case, all the operations that require an unambiguous targetselection will fail unless the DN is already cached or a defaulttarget has been set.Practical configurations may result as a combination of all theabove scenarios. 

ACLs

Note on ACLs: at present you may add whatever ACL rule you desireto the Meta (and LDAP) backends.However, the meaning of an ACL on a proxy may require someconsiderations.Two philosophies may be considered:

a) the remote server dictates the permissions; the proxy simply passesback what it gets from the remote server.

b) the remote server unveils "everything"; the proxy is responsiblefor protecting data from unauthorized access.

Of course the latter sounds unreasonable, but it is not.It is possible to imagine scenarios in which a remote host disclosesdata that can be considered "public" inside an intranet, and a proxythat connects it to the internet may impose additional constraints.To this purpose, the proxy should be able to comply with all the ACLmatching criteria that the server supports.This has been achieved with regard to all the criteria supported byslapd except a special subtle case (please file an ITS if you canfind other exceptions: <http://www.openldap.org/its/>).The rule

access to dn="<dn>" attrs=<attr>       by dnattr=<dnattr> read       by * none

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)

In fact this ACL is resolved by slapd using the portion of entry itretrieved from the remote server without requiring any furtherintervention of the backend, so, if the <dnattr> attribute has notbeen fetched, the match cannot be assessed because the attribute isnot present, not because no value matches the requirement!

Note on ACLs and attribute mapping: ACLs are applied to the mappedattributes; for instance, if the attribute locally known as "foo" ismapped 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 localserver will possibly enforce additional restrictions to "foo". 

REWRITING

A string is rewritten according to a set of rules, called a `rewritecontext'.The rules are based on POSIX (''extended'') regular expressions (regex)with substring matching; basic variable substitution and map resolution of substrings is allowed by specific mechanisms detailed in the following.The behavior of pattern matching/substitution can be altered by a setof flags.

The underlying concept is to build a lightweight rewrite modulefor the slapd server (initially dedicated to the LDAP backend). 

Passes

An incoming string is matched against a set of rules.Rules are made of a regex match pattern, a substitution patternand a set of actions, described by a set of flags.In case of match a string rewriting is performed according to thesubstitution pattern that allows one to refer to substrings matched in theincoming 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.The flags are divided in "Pattern matching Flags" and "Action Flags";the former alter the regex match pattern behavior while the latteralter the action that is taken after substitution. 

Pattern Matching Flags

`C'
honors case in matching (default is case insensitive)
`R'
use POSIX ''basic'' regular expressions (default is ''extended'')
`M{n}'
allow no more thannrecursive passes for a specific rule; does not alter the max total countof passes, so it can only enforce a stricter limit for a specific rule.
 

Action Flags

`:'
apply the rule once only (default is recursive)
`@'
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.
`#'
stop current operation if the rule matches, and issue an `unwilling toperform' error.
`G{n}'
jumpnrules back and forth (watch for loops!).Note that `G{1}' is implicit in every rule.
`I'
ignores errors in rule; this means, in case of error, e.g. issued by amap, the error is treated as a missed match.The `unwilling to perform' is not overridden.
`U{n}'
usesnas return code if the rule matches; the flag does not alter the recursivebehavior of the rule, so, to have it performed only once, it must be used in combination with `:', e.g.`:U{16}'returns the value `16' after exactly one execution of the rule, if thepattern matches.As a consequence, its behavior is equivalent to `@', with the returncode set ton;or, in other words, `@' is equivalent to `U{0}'.By convention, the freely available codes are above 16 included;the others are reserved.

The ordering of the flags can be significant.For instance: `IG{2}' means ignore errors and jump two lines aheadboth in case of match and in case of error, while `G{2}I' means ignoreerrors, but jump two lines ahead only in case of match.

More flags (mainly Action Flags) will be added as needed. 

Pattern matching:

Seeregex(7)and/orre_format(7). 

Substitution Pattern Syntax:

Everything starting with `%' requires substitution;

the only obvious exception is `%%', which is left as is;

the basic substitution is `%d', where `d' is a digit;0 means the whole string, while 1-9 is a submatch;

a `%' followed by a `{' invokes an advanced substitution.The pattern is:

`%' `{' [ <op> ] <name> `(' <substitution> `)' `}'

where <name> must be a legal name for the map, i.e.

<name> ::= [a-z][a-z0-9]* (case insensitive)<op> ::= `>' `|' `&' `&&' `*' `**' `$'

and <substitution> must be a legal substitutionpattern, with no limits on the nesting level.

The operators are:

>
sub context invocation; <name> must be a legal, already definedrewrite context name
|
external command invocation; <name> must refer to a legal, alreadydefined command name (NOT IMPL.)
&
variable assignment; <name> defines a variable in the runningoperation structure which can be dereferenced later; operator&assigns a variable in the rewrite context scope; operator&&assigns a variable that scopes the entire session, e.g. its valuecan be dereferenced later by other rewrite contexts
*
variable dereferencing; <name> must refer to a variable that isdefined and assigned for the running operation; operator*dereferences a variable scoping the rewrite context; operator**dereferences a variable scoping the whole session, e.g. the valueis passed across rewrite contexts
$
parameter dereferencing; <name> must refer to an existing parameter;the idea is to make some run-time parameters set by the systemavailable to the rewrite engine, as the client host name, the bind DNif any, constant parameters initialized at config time, and so on;no parameter is currently set by either back-ldaporback-meta,but constant parameters can be defined in the configuration fileby using therewriteParamdirective.

Substitution escaping has been delegated to the `%' symbol, which is used instead of `\' in string substitution patternsbecause `\' is already escaped by slapd's low level parsing routines;as a consequence, regex escaping requires two `\' symbols,e.g. `.*\.foo\.bar' must be written as `.*\\.foo\\.bar'. 

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 rewriteengine (think of Apache's mod_rewrite ...) with a set of rewritecontexts; when string rewriting is required, one invokes theappropriate rewrite context with the input string and obtains thenewly rewritten one if no errors occur.

Each basic server operation is associated to a rewrite context;they are divided in two main groups: client -> server andserver -> client rewriting.

client -> server:

(default)            if defined and no specific context                      is availablebindDN               bindsearchBase           searchsearchFilter         searchsearchFilterAttrDN   searchcompareDN            comparecompareAttrDN        compare AVAaddDN                addaddAttrDN            add AVAmodifyDN             modifymodifyAttrDN         modify AVAmodrDN               modrdnnewSuperiorDN        modrdndeleteDN             deleteexopPasswdDN         password modify extended operation DN if proxy

server -> client:

searchResult         search (only if defined; no default;                     acts on DN and DN-syntax attributes                      of search results)searchAttrDN         search AVAmatchedDN            all ops (only if applicable)

 

Basic configuration syntax

rewriteEngine { on | off }
If `on', the requested rewriting is performed; if `off', norewriting takes place (an easy way to stop rewriting withoutaltering too much the configuration file).
rewriteContext <context name> [ alias <aliased context name> ]
<Context name> is the name that identifies the context, i.e. the nameused 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 alias another one.In this case the alias context contains no rule, and any reference toit will result in accessing the aliased one.
rewriteRule <regex match pattern> <substitution pattern> [ <flags> ]
Determines how a string can be rewritten if a pattern is matched.Examples are reported below.
 

Additional configuration syntax:

rewriteMap <map type> <map name> [ <map attrs> ]
Allows one to define a map that transforms substring rewriting intosomething else.The map is referenced inside the substitution pattern of a rule.
rewriteParam <param name> <param value>
Sets a value with global scope, that can be dereferenced by thecommand `%{$paramName}'.
rewriteMaxPasses <number of passes> [<number of passes per rule>]
Sets the maximum number of total rewriting passes that can beperformed in a single rewrite operation (to avoid loops).A safe default is set to 100; note that reaching this limit is stilltreated 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 limitswith the `M{n}' flag.
 

Configuration examples:

# set to `off' to disable rewritingrewriteEngine on# the rules the "suffixmassage" directive impliesrewriteEngine on# all dataflow from client to server referring to DNsrewriteContext defaultrewriteRule "(.*)<virtualnamingcontext>$" "%1<realnamingcontext>" ":"# empty filter rulerewriteContext searchFilter# all dataflow from server to clientrewriteContext searchResultrewriteRule "(.*)<realnamingcontext>$" "%1<virtualnamingcontext>" ":"rewriteContext searchAttrDN alias searchResultrewriteContext matchedDN alias searchResult# 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'rewriteRule "(.*)dc=home,[ ]?dc=net"            "%1dc=OpenLDAP, dc=org"  ":"# since a pretty/normalized DN does not include spaces# after rdn separators, e.g. `,', this rule suffices:rewriteRule "(.*)dc=home,dc=net"            "%1dc=OpenLDAP,dc=org"  ":"# Start a new context (ends input of the previous one).# This rule adds blanks between DN parts if not present.rewriteContext  addBlanksrewriteRule     "(.*),([^ ].*)" "%1, %2"# This one eats blanksrewriteContext  eatBlanksrewriteRule     "(.*),[ ](.*)" "%1,%2"# 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  defaultrewriteRule     ".*" "%{>addBlanks(%0)}" ":"# Rewrite the search base according to `default' rules.rewriteContext  searchBase alias default# Search results with OpenLDAP DN are rewritten back with# `dc=home,dc=net' naming context, with spaces eaten.rewriteContext  searchResultrewriteRule     "(.*[^ ]?)[ ]?dc=OpenLDAP,[ ]?dc=org"                "%{>eatBlanks(%1)}dc=home,dc=net"    ":"# 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"# Then we need to detect DN made up of a single email,# e.g. `mail=someoneAATTexample.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 bindDNrewriteRule "^mail=[^,]+@[^,]+$" "%{attr2dn(%0)}" ":@I"# 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  bindDNrewriteRule     ".+" "%{&&binddn(%0)}%0" ":"# 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 searchFilterrewriteRule "(.*\\()uid=([a-z0-9_]+)(\\).*)"  "%{**binddn}<>%{&prefix(%1)}%{&arg(%2)}%{&suffix(%3)}"  ":I"rewriteRule "[^,]+,ou=admin,dc=home,dc=net"  "%{*prefix}|(uid=%{*arg})(cn=%{*arg})%{*suffix}" ":@I"rewriteRule ".*<>" "%{*prefix}uid=%{*arg}%{*suffix}" ":"# 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 searchResultrewriteRule ".*,ou=People,dc=example,dc=com" "%0" ":@"rewriteRule ".*" "" "#"
 

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

In case the rewritten DN is an LDAP URI, the operation is initiatedtowards the host[:port] indicated in the uri, if it does not referto the local server.E.g.:

  rewriteRule '^cn=root,.*' '%0'                     'G{3}'  rewriteRule '^cn=[a-l].*' 'ldap://ldap1.my.org/%0' ':@'  rewriteRule '^cn=[m-z].*' 'ldap://ldap2.my.org/%0' ':@'  rewriteRule '.*'          'ldap://ldap3.my.org/%0' ':@'

(Rule 1 is simply there to illustrate the `G{n}' action; it could havebeen written:

  rewriteRule '^cn=root,.*' 'ldap://ldap3.my.org/%0' ':@'

with the advantage of saving one rewrite pass ...)

 

ACCESS CONTROL

Themetabackend does not honor all ACL semantics as described inslapd.access(5).In general, access checking is delegated to the remote server(s).Onlyread (=r)access to theentrypseudo-attribute and to the other attribute values of the entriesreturned by thesearchoperation is honored, which is performed by the frontend.

 

PROXY CACHE OVERLAY

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

 

DEPRECATED STATEMENTS

The following statements have been deprecated and should no longer be used.

pseudorootdn <substitute DN in case of rootdn bind>
Useidassert-bindinstead.

pseudorootpw <substitute password in case of rootdn bind>
Useidassert-bindinstead.

 

FILES

/etc/openldap/slapd.conf
default slapd configuration file
 

SEE ALSO

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

AUTHOR

Pierangelo Masarati, based on back-ldap by Howard Chu


 

Index

NAME
SYNOPSIS
DESCRIPTION
EXAMPLES
CONFIGURATION
SPECIAL CONFIGURATION DIRECTIVES
TARGET SPECIFICATION
SCENARIOS
ACLs
REWRITING
Passes
Pattern Matching Flags
Action Flags
Pattern matching:
Substitution Pattern Syntax:
Rewrite context:
Basic configuration syntax
Additional configuration syntax:
Configuration examples:
LDAP Proxy resolution (a possible evolution of slapd-ldap(5)):
ACCESS CONTROL
PROXY CACHE OVERLAY
DEPRECATED STATEMENTS
FILES
SEE ALSO
AUTHOR

This document was created byman2html,using the manual pages.