📄 slapdconfig.sdf
字号:
or {{EX:children}}. Where {{EX:base}} matches only the entry withprovided DN, {{EX:one}} matches the entries whose parent is theprovided DN, {{EX:subtree}} matches all entries in the subtree whoseroot is the provided DN, and {{EX:children}} matches all entriesunder the DN (but not the entry named by the DN).For example, if the directory contained entries named:> 0: o=suffix> 1: cn=Manager,o=suffix> 2: ou=people,o=suffix> 3: uid=kdz,ou=people,o=suffix> 4: cn=addresses,uid=kdz,ou=people,o=suffix> 5: uid=hyc,ou=people,o=suffix\Then:. {{EX:dn.base="ou=people,o=suffix"}} match 2;. {{EX:dn.one="ou=people,o=suffix"}} match 3, and 5;. {{EX:dn.subtree="ou=people,o=suffix"}} match 2, 3, 4, and 5; and. {{EX:dn.children="ou=people,o=suffix"}} match 3, 4, and 5.Entries may also be selected using a filter:> to filter=<ldap filter>where <ldap filter> is a string representation of an LDAPsearch filter, as described in {{REF:RFC2254}}. For example:> to filter=(objectClass=person)Note that entries may be selected by both DN and filter byincluding both qualifiers in the <what> clause.> to dn.one="ou=people,o=suffix" filter=(objectClass=person)Attributes within an entry are selected by including a comma-separatedlist of attribute names in the <what> selector:> attrs=<attribute list>A specific value of an attribute is selected by using a singleattribute name and also using a value selector:> attrs=<attribute> val[.<style>]=<regex>There are two special {{pseudo}} attributes {{EX:entry}} and{{EX:children}}. To read (and hence return) a target entry, thesubject must have {{EX:read}} access to the target's {{entry}}attribute. To add or delete an entry, the subject must have{{EX:write}} access to the entry's {{EX:entry}} attribute AND musthave {{EX:write}} access to the entry's parent's {{EX:children}}attribute. To rename an entry, the subject must have {{EX:write}}access to entry's {{EX:entry}} attribute AND have {{EX:write}}access to both the old parent's and new parent's {{EX:children}}attributes. The complete examples at the end of this section shouldhelp clear things up.Lastly, there is a special entry selector {{EX:"*"}} that is used toselect any entry. It is used when no other {{EX:<what>}}selector has been provided. It's equivalent to "{{EX:dn=.*}}"H3: Who to grant access toThe <who> part identifies the entity or entities being grantedaccess. Note that access is granted to "entities" not "entries."The following table summarizes entity specifiers:!block table; align=Center; coltags="EX,N"; \ title="Table 5.3: Access Entity Specifiers"Specifier|Entities*|All, including anonymous and authenticated usersanonymous|Anonymous (non-authenticated) usersusers|Authenticated usersself|User associated with target entrydn[.<basic-style>]=<regex>|Users matching a regular expressiondn.<scope-style>=<DN>|Users within scope of a DN!endblockThe DN specifier behaves much like <what> clause DN specifiers.Other control factors are also supported. For example, a {{EX:<who>}}can be restricted by an entry listed in a DN-valued attribute inthe entry to which the access applies:> dnattr=<dn-valued attribute name>The dnattr specification is used to give access to an entrywhose DN is listed in an attribute of the entry (e.g., giveaccess to a group entry to whoever is listed as the owner ofthe group entry).Some factors may not be appropriate in all environments (or any).For example, the domain factor relies on IP to domain name lookups.As these can easily spoofed, the domain factor should not be avoided.H3: The access to grantThe kind of <access> granted can be one of the following:!block table; colaligns="LRL"; coltags="EX,EX,N"; align=Center; \ title="Table 5.4: Access Levels"Level Privileges Descriptionnone =0 no accessauth =x needed to bindcompare =cx needed to comparesearch =scx needed to apply search filtersread =rscx needed to read search resultswrite =wrscx needed to modify/rename!endblockEach level implies all lower levels of access. So, forexample, granting someone {{EX:write}} access to an entry alsogrants them {{EX:read}}, {{EX:search}}, {{EX:compare}}, and {{EX:auth}} access. However, one may use the privileges specifierto grant specific permissions.H3: Access Control EvaluationWhen evaluating whether some requester should be given access toan entry and/or attribute, slapd compares the entry and/or attributeto the {{EX:<what>}} selectors given in the configuration file.For each entry, access controls provided in the database which holdsthe entry (or the first database if not held in any database) applyfirst, followed by the global access directives. Within thispriority, access directives are examined in the order in which theyappear in the config file. Slapd stops with the first {{EX:<what>}}selector that matches the entry and/or attribute. The correspondingaccess directive is the one slapd will use to evaluate access.Next, slapd compares the entity requesting access to the {{EX:<who>}}selectors within the access directive selected above in the orderin which they appear. It stops with the first {{EX:<who>}} selectorthat matches the requester. This determines the access the entityrequesting access has to the entry and/or attribute.Finally, slapd compares the access granted in the selected{{EX:<access>}} clause to the access requested by the client. Ifit allows greater or equal access, access is granted. Otherwise,access is denied.The order of evaluation of access directives makes their placementin the configuration file important. If one access directive ismore specific than another in terms of the entries it selects, itshould appear first in the config file. Similarly, if one {{EX:<who>}}selector is more specific than another it should come first in theaccess directive. The access control examples given below shouldhelp make this clear.H3: Access Control ExamplesThe access control facility described above is quite powerful. Thissection shows some examples of its use for descriptive purposes.A simple example:> access to * by * readThis access directive grants read access to everyone.> access to *> by self write> by anonymous auth> by * readThis directive allows the user to modify their entry, allows anonymousto authentication against these entries, and allows all others toread these entries. Note that only the first {{EX:by <who>}} clausewhich matches applies. Hence, the anonymous users are granted{{EX:auth}}, not {{EX:read}}. The last clause could just as wellhave been "{{EX:by users read}}".It is often desirable to restrict operations based upon the levelof protection in place. The following shows how security strengthfactors (SSF) can be used.> access to *> by ssf=128 self write> by ssf=64 anonymous auth> by ssf=64 users readThis directive allows users to modify their own entries if securityprotections have of strength 128 or better have been established,allows authentication access to anonymous users, and read accesswhen 64 or better security protections have been established. Ifclient has not establish sufficient security protections, theimplicit {{EX:by * none}} clause would be applied.The following example shows the use of a style specifiers to selectthe entries by DN in two access directives where ordering issignificant.> access to dn.children="dc=example,dc=com"> by * search> access to dn.children="dc=com"> by * readRead access is granted to entries under the {{EX:dc=com}} subtree,except for those entries under the {{EX:dc=example,dc=com}} subtree,to which search access is granted. No access is granted to{{EX:dc=com}} as neither access directive matches this DN. If theorder of these access directives was reversed, the trailing directivewould never be reached, since all entries under {{EX:dc=example,dc=com}}are also under {{EX:dc=com}} entries.Also note that if no {{EX:access to}} directive matches or no {{EX:by<who>}} clause, {{B:access is denied}}. That is, every {{EX:accessto}} directive ends with an implicit {{EX:by * none}} clause andevery access list ends with an implicit {{EX:access to * by * none}}directive.The next example again shows the importance of ordering, both ofthe access directives and the {{EX:by <who>}} clauses. It alsoshows the use of an attribute selector to grant access to a specificattribute and various {{EX:<who>}} selectors.> access to dn.subtree="dc=example,dc=com" attrs=homePhone> by self write> by dn.children="dc=example,dc=com" search> by peername.regex=IP:10\..+ read> access to dn.subtree="dc=example,dc=com"> by self write> by dn.children="dc=example,dc=com" search> by anonymous authThis example applies to entries in the "{{EX:dc=example,dc=com}}"subtree. To all attributes except {{EX:homePhone}}, an entry canwrite to itself, entries under {{EX:example.com}} entries can searchby them, anybody else has no access (implicit {{EX:by * none}})excepting for authentication/authorization (which is always doneanonymously). The {{EX:homePhone}} attribute is writable by theentry, searchable by entries under {{EX:example.com}}, readable byclients connecting from network 10, and otherwise not readable(implicit {{EX:by * none}}). All other access is denied by theimplicit {{EX:access to * by * none}}.Sometimes it is useful to permit a particular DN to add orremove itself from an attribute. For example, if you would like tocreate a group and allow people to add and remove onlytheir own DN from the member attribute, you could accomplishit with an access directive like this:> access to attrs=member,entry> by dnattr=member selfwriteThe dnattr {{EX:<who>}} selector says that the access applies toentries listed in the {{EX:member}} attribute. The {{EX:selfwrite}} accessselector says that such members can only add or delete theirown DN from the attribute, not other values. The addition ofthe entry attribute is required because access to the entry isrequired to access any of the entry's attributes.!if 0For more details on how to use the {{EX:access}} directive,consult the {{Advanced Access Control}} chapter.!endifH2: Configuration File ExampleThe following is an example configuration file, interspersedwith explanatory text. It defines two databases to handledifferent parts of the {{TERM:X.500}} tree; both are {{TERM:BDB}}database instances. The line numbers shown are provided forreference only and are not included in the actual file. First, theglobal configuration section:E: 1. # example config file - global configuration sectionE: 2. include /usr/local/etc/schema/core.schemaE: 3. referral ldap://root.openldap.orgE: 4. access to * by * read Line 1 is a comment. Line 2 includes another config filewhich contains {{core}} schema definitions.The {{EX:referral}} directive on line 3means that queries not local to one of the databases definedbelow will be referred to the LDAP server running on thestandard port (389) at the host {{EX:root.openldap.org}}.Line 4 is a global access control. It applies to allentries (after any applicable database-specific accesscontrols).The next section of the configuration file defines a BDBbackend that will handle queries for things in the"dc=example,dc=com" portion of the tree. Thedatabase is to be replicated to two slave slapds, one ontruelies, the other on judgmentday. Indices are to bemaintained for several attributes, and the {{EX:userPassword}}attribute is to be protected from unauthorized access.E: 5. # BDB definition for the example.comE: 6. database bdbE: 7. suffix "dc=example,dc=com"E: 8. directory /usr/local/var/openldap-dataE: 9. rootdn "cn=Manager,dc=example,dc=com"E: 10. rootpw secretE: 11. # replication directivesE: 12. replogfile /usr/local/var/openldap/slapd.replogE: 13. replica uri=ldap://slave1.example.com:389E: 14. binddn="cn=Replicator,dc=example,dc=com"E: 15. bindmethod=simple credentials=secretE: 16. replica uri=ldaps://slave2.example.com:636E: 17. binddn="cn=Replicator,dc=example,dc=com"E: 18. bindmethod=simple credentials=secretE: 19. # indexed attribute definitionsE: 20. index uid pres,eqE: 21. index cn,sn,uid pres,eq,approx,subE: 22. index objectClass eqE: 23. # database access control definitionsE: 24. access to attrs=userPasswordE: 25. by self writeE: 26. by anonymous authE: 27. by dn.base="cn=Admin,dc=example,dc=com" writeE: 28. by * noneE: 29. access to *E: 30. by self writeE: 31. by dn.base="cn=Admin,dc=example,dc=com" writeE: 32. by * readLine 5 is a comment. The start of the database definition is markedby the database keyword on line 6. Line 7 specifies the DN suffixfor queries to pass to this database. Line 8 specifies the directoryin which the database files will live.Lines 9 and 10 identify the database {{super-user}} entry and associatedpassword. This entry is not subject to access control or size ortime limit restrictions.Lines 11 through 18 are for replication. Line 12 specifies thereplication log file (where changes to the database are logged -this file is written by slapd and read by slurpd). Lines 13 through15 specify the hostname and port for a replicated host, the DN tobind as when performing updates, the bind method (simple) and thecredentials (password) for the binddn. Lines 16 through 18 specifya second replication site. See the {{SECT:Replication with slurpd}}chapter for more information on these directives.Lines 20 through 22 indicate the indices to maintain for variousattributes.Lines 24 through 32 specify access control for entries in thisdatabase. As this is the first database, the controls also applyto entries not held in any database (such as the Root DSE). Forall applicable entries, the {{EX:userPassword}} attribute is writableby the entry itself and by the "admin" entry. It may be used forauthentication/authorization purposes, but is otherwise not readable.All other attributes are writable by the entry and the "admin"entry, but may be read by all users (authenticated or not).The next section of the example configuration file defines anotherBDB database. This one handles queries involving the{{EX:dc=example,dc=net}} subtree but is managed by the same entityas the first database. Note that without line 39, the read accesswould be allowed due to the global access rule at line 4.E: 33. # BDB definition for example.netE: 34. database bdbE: 35. suffix "dc=example,dc=net"E: 36. directory /usr/local/var/openldap-data-netE: 37. rootdn "cn=Manager,dc=example,dc=com"E: 38. index objectClass eqE: 39. access to * by users read
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -