⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 slapd-meta.5

📁 ldap服务器源码
💻 5
📖 第 1 页 / 共 3 页
字号:
sub context invocation; <name> must be a legal, already definedrewrite context name.TP.B |external command invocation; <name> must refer to a legal, alreadydefined command name (NOT IMPL.).TP.B &variable assignment; <name> defines a variable in the runningoperation structure which can be dereferenced later; operator.B &assigns a variable in the rewrite context scope; operator.B &&assigns a variable that scopes the entire session, e.g. its valuecan be dereferenced later by other rewrite contexts.TP.B *variable dereferencing; <name> must refer to a variable that isdefined and assigned for the running operation; operator.B *dereferences a variable scoping the rewrite context; operator.B **dereferences a variable scoping the whole session, e.g. the valueis passed across rewrite contexts.TP.B $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 .B back\-ldapor.BR back\-meta ,but constant parameters can be defined in the configuration fileby using the.B rewriteParamdirective..LPSubstitution escaping has been delegated to the `%' symbol, which is used instead of `\e' in string substitution patternsbecause `\e' is already escaped by slapd's low level parsing routines;as a consequence, regex escaping requires two `\e' symbols,e.g. `\fB.*\e.foo\e.bar\fP' must be written as `\fB.*\e\e.foo\e\e.bar\fP'..\".\" The symbol can be altered at will by redefining the related macro in.\" "rewrite-int.h"..\".SH "Rewrite context:"A rewrite context is a set of rules which are applied in sequence.The basic idea is to have an application initialize a 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..LPEach basic server operation is associated to a rewrite context;they are divided in two main groups: client \-> server andserver \-> client rewriting..LPclient -> server:.LP.RS.nf(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.fi.RE.LPserver -> client:.LP.RS.nfsearchResult         search (only if defined; no default;                     acts on DN and DN-syntax attributes                      of search results)searchAttrDN         search AVAmatchedDN            all ops (only if applicable).fi.RE.LP.SH "Basic configuration syntax".TP.B 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)..TP.B 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..TP.B rewriteRule "<regex match pattern>" "<substitution pattern>" "[ <flags> ]"Determines how a string can be rewritten if a pattern is matched.Examples are reported below..SH "Additional configuration syntax:".TP.B rewriteMap "<map type>" "<map name>" "[ <map attrs> ]"Allows to define a map that transforms substring rewriting intosomething else.The map is referenced inside the substitution pattern of a rule..TP.B rewriteParam <param name> <param value>Sets a value with global scope, that can be dereferenced by thecommand `%{$paramName}'..TP.B 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..SH "Configuration examples:".nf# 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)}" ":".\" # Anything with `uid=username' is looked up in.\" # /etc/passwd for gecos (I know it's nearly useless,.\" # but it is there just as a guideline to implementing.\" # custom maps)..\" # Note the `I' flag that leaves `uid=username' in place .\" # if `username' does not have a valid account, and the.\" # `:' that forces the rule to be processed exactly once..\" rewriteContext  uid2Gecos.\" rewriteRule     "(.*)uid=([a-z0-9]+),(.+)".\"                 "%1cn=%2{xpasswd},%3"      "I:".\" .\" # Finally, in a bind, if one uses a `uid=username' DN,.\" # it is rewritten in `cn=name surname' if possible..\" rewriteContext  bindDN.\" rewriteRule     ".*" "%{>addBlanks(%{>uid2Gecos(%0)})}" ":".\" # Rewrite the search base according to `default' rules.rewriteContext  searchBase alias default# 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=someone@example.com'; note that the rule# in case of match stops rewriting; in case of error,# it is ignored.  In case we are mapping virtual# to real naming contexts, we also need to rewrite# regular DNs, because the definition of a bindDn# rewrite context overrides the default definition.rewriteContext 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 "(.*\e\e()uid=([a-z0-9_]+)(\e\e).*)"  "%{**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 ".*" "" "#".fi.SH "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.:.LP.nf  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' ':@'.fi.LP(Rule 1 is simply there to illustrate the `G{n}' action; it could havebeen written:.LP.nf  rewriteRule '^cn=root,.*' 'ldap://ldap3.my.org/%0' ':@'.fi.LPwith the advantage of saving one rewrite pass ...).SH ACCESS CONTROLThe.B metabackend does not honor all ACL semantics as described in.BR slapd.access (5).In general, access checking is delegated to the remote server(s).Only.B read (=r)access to the.B entrypseudo-attribute and to the other attribute values of the entriesreturned by the.B searchoperation is honored, which is performed by the frontend..SH PROXY CACHE OVERLAYThe proxy cache overlay allows caching of LDAP search requests (queries) in a local database.See .BR slapo-pcache (5)for details..SH FILES.TPETCDIR/slapd.confdefault slapd configuration file.SH SEE ALSO.BR slapd.conf (5),.BR slapd\-ldap (5),.BR slapo\-pcache (5),.BR slapd (8),.BR regex (7),.BR re_format (7)..SH AUTHORPierangelo Masarati, based on back-ldap by Howard Chu

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -