1# $OpenLDAP$ 2# Copyright 2007-2021 The OpenLDAP Foundation, All Rights Reserved. 3# COPYING RESTRICTIONS APPLY, see COPYRIGHT. 4 5H1: Overlays 6 7Overlays are software components that provide hooks to functions analogous to 8those provided by backends, which can be stacked on top of the backend calls 9and as callbacks on top of backend responses to alter their behavior. 10 11Overlays may be compiled statically into {{slapd}}, or when module support 12is enabled, they may be dynamically loaded. Most of the overlays 13are only allowed to be configured on individual databases. 14 15Some can be stacked on the {{EX:frontend}} as well, for global use. This means that 16they can be executed after a request is parsed and validated, but right before the 17appropriate database is selected. The main purpose is to affect operations 18regardless of the database they will be handled by, and, in some cases, 19to influence the selection of the database by massaging the request DN. 20 21Essentially, overlays represent a means to: 22 23 * customize the behavior of existing backends without changing the backend 24 code and without requiring one to write a new custom backend with 25 complete functionality 26 * write functionality of general usefulness that can be applied to 27 different backend types 28 29When using {{slapd.conf}}(5), overlays that are configured before any other 30databases are considered global, as mentioned above. In fact they are implicitly 31stacked on top of the {{EX:frontend}} database. They can also be explicitly 32configured as such: 33 34> database frontend 35> overlay <overlay name> 36 37Overlays are usually documented by separate specific man pages in section 5; 38the naming convention is 39 40> slapo-<overlay name> 41 42All distributed core overlays have a man page. Feel free to contribute to any, 43if you think there is anything missing in describing the behavior of the component 44and the implications of all the related configuration directives. 45 46Official overlays are located in 47 48> servers/slapd/overlays/ 49 50That directory also contains the file slapover.txt, which describes the 51rationale of the overlay implementation, and may serve as a guideline for the 52development of custom overlays. 53 54Contribware overlays are located in 55 56> contrib/slapd-modules/<overlay name>/ 57 58along with other types of run-time loadable components; they are officially 59distributed, but not maintained by the project. 60 61All the current overlays in OpenLDAP are listed and described in detail in the 62following sections. 63 64 65H2: Access Logging 66 67 68H3: Overview 69 70This overlay can record accesses to a given backend database on another 71database. 72 73This allows all of the activity on a given database to be reviewed using arbitrary 74LDAP queries, instead of just logging to local flat text files. Configuration 75options are available for selecting a subset of operation types to log, and to 76automatically prune older log records from the logging database. Log records 77are stored with audit schema to assure their readability whether viewed as LDIF 78or in raw form. 79 80It is also used for {{SECT:delta-syncrepl replication}} 81 82Note: An accesslog database is unique to a given provider. It should 83never be replicated. 84 85H3: Access Logging Configuration 86 87The following is a basic example that implements Access Logging: 88 89> database mdb 90> suffix dc=example,dc=com 91> ... 92> overlay accesslog 93> logdb cn=log 94> logops writes reads 95> logold (objectclass=person) 96> 97> database mdb 98> suffix cn=log 99> ... 100> index reqStart eq 101> access to * 102> by dn.base="cn=admin,dc=example,dc=com" read 103 104The following is an example used for {{SECT:delta-syncrepl replication}}: 105 106> database mdb 107> suffix cn=accesslog 108> directory /usr/local/var/openldap-accesslog 109> rootdn cn=accesslog 110> index default eq 111> index entryCSN,objectClass,reqEnd,reqResult,reqStart,reqDN 112 113Accesslog overlay definitions for the primary db 114 115> database mdb 116> suffix dc=example,dc=com 117> ... 118> overlay accesslog 119> logdb cn=accesslog 120> logops writes 121> logsuccess TRUE 122> # scan the accesslog DB every day, and purge entries older than 7 days 123> logpurge 07+00:00 01+00:00 124 125An example search result against {{B:cn=accesslog}} might look like: 126 127> [ghenry@suretec ghenry]# ldapsearch -x -b cn=accesslog 128> # extended LDIF 129> # 130> # LDAPv3 131> # base <cn=accesslog> with scope subtree 132> # filter: (objectclass=*) 133> # requesting: ALL 134> # 135> 136> # accesslog 137> dn: cn=accesslog 138> objectClass: auditContainer 139> cn: accesslog 140> 141> # 20080110163829.000004Z, accesslog 142> dn: reqStart=20080110163829.000004Z,cn=accesslog 143> objectClass: auditModify 144> reqStart: 20080110163829.000004Z 145> reqEnd: 20080110163829.000005Z 146> reqType: modify 147> reqSession: 196696 148> reqAuthzID: cn=admin,dc=suretecsystems,dc=com 149> reqDN: uid=suretec-46022f8$,ou=Users,dc=suretecsystems,dc=com 150> reqResult: 0 151> reqMod: sambaPwdCanChange:- ###CENSORED### 152> reqMod: sambaPwdCanChange:+ ###CENSORED### 153> reqMod: sambaNTPassword:- ###CENSORED### 154> reqMod: sambaNTPassword:+ ###CENSORED### 155> reqMod: sambaPwdLastSet:- ###CENSORED### 156> reqMod: sambaPwdLastSet:+ ###CENSORED### 157> reqMod: entryCSN:= 20080110163829.095157Z#000000#000#000000 158> reqMod: modifiersName:= cn=admin,dc=suretecsystems,dc=com 159> reqMod: modifyTimestamp:= 20080110163829Z 160> 161> # search result 162> search: 2 163> result: 0 Success 164> 165> # numResponses: 3 166> # numEntries: 2 167 168 169H3: Further Information 170 171{{slapo-accesslog(5)}} and the {{SECT:delta-syncrepl replication}} section. 172 173 174H2: Audit Logging 175 176The Audit Logging overlay can be used to record all changes on a given backend database to a specified log file. 177 178H3: Overview 179 180If the need arises whereby changes need to be logged as standard LDIF, then the auditlog overlay {{B:slapo-auditlog (5)}} 181can be used. Full examples are available in the man page {{B:slapo-auditlog (5)}} 182 183H3: Audit Logging Configuration 184 185If the directory is running vi {{F:slapd.d}}, then the following LDIF could be used to add the overlay to the overlay list 186in {{B:cn=config}} and set what file the {{TERM:LDIF}} gets logged to (adjust to suit) 187 188> dn: olcOverlay=auditlog,olcDatabase={1}mdb,cn=config 189> changetype: add 190> objectClass: olcOverlayConfig 191> objectClass: olcAuditLogConfig 192> olcOverlay: auditlog 193> olcAuditlogFile: /tmp/auditlog.ldif 194 195 196In this example for testing, we are logging changes to {{F:/tmp/auditlog.ldif}} 197 198A typical {{TERM:LDIF}} file created by {{B:slapo-auditlog(5)}} would look like: 199 200> # add 1196797576 dc=suretecsystems,dc=com cn=admin,dc=suretecsystems,dc=com 201> dn: dc=suretecsystems,dc=com 202> changetype: add 203> objectClass: dcObject 204> objectClass: organization 205> dc: suretecsystems 206> o: Suretec Systems Ltd. 207> structuralObjectClass: organization 208> entryUUID: 1606f8f8-f06e-1029-8289-f0cc9d81e81a 209> creatorsName: cn=admin,dc=suretecsystems,dc=com 210> modifiersName: cn=admin,dc=suretecsystems,dc=com 211> createTimestamp: 20051123130912Z 212> modifyTimestamp: 20051123130912Z 213> entryCSN: 20051123130912.000000Z#000001#000#000000 214> auditContext: cn=accesslog 215> # end add 1196797576 216> 217> # add 1196797577 dc=suretecsystems,dc=com cn=admin,dc=suretecsystems,dc=com 218> dn: ou=Groups,dc=suretecsystems,dc=com 219> changetype: add 220> objectClass: top 221> objectClass: organizationalUnit 222> ou: Groups 223> structuralObjectClass: organizationalUnit 224> entryUUID: 160aaa2a-f06e-1029-828a-f0cc9d81e81a 225> creatorsName: cn=admin,dc=suretecsystems,dc=com 226> modifiersName: cn=admin,dc=suretecsystems,dc=com 227> createTimestamp: 20051123130912Z 228> modifyTimestamp: 20051123130912Z 229> entryCSN: 20051123130912.000000Z#000002#000#000000 230> # end add 1196797577 231 232 233H3: Further Information 234 235{{:slapo-auditlog(5)}} 236 237 238H2: Chaining 239 240 241H3: Overview 242 243The chain overlay provides basic chaining capability to the underlying 244database. 245 246What is chaining? It indicates the capability of a DSA to follow referrals on 247behalf of the client, so that distributed systems are viewed as a single 248virtual DSA by clients that are otherwise unable to "chase" (i.e. follow) 249referrals by themselves. 250 251The chain overlay is built on top of the ldap backend; it is compiled by 252default when {{B:--enable-ldap}}. 253 254 255H3: Chaining Configuration 256 257In order to demonstrate how this overlay works, we shall discuss a typical 258scenario which might be one provider server and three Syncrepl replicas. 259 260On each replica, add this near the top of the {{slapd.conf}}(5) file 261(global), before any database definitions: 262 263> overlay chain 264> chain-uri "ldap://ldapprovider.example.com" 265> chain-idassert-bind bindmethod="simple" 266> binddn="cn=Manager,dc=example,dc=com" 267> credentials="<secret>" 268> mode="self" 269> chain-tls start 270> chain-return-error TRUE 271 272Add this below your {{syncrepl}} statement: 273 274> updateref "ldap://ldapprovider.example.com/" 275 276The {{B:chain-tls}} statement enables TLS from the replica to the ldap provider. 277The DITs are exactly the same between these machines, therefore whatever user 278bound to the replica will also exist on the provider. If that DN does not have 279update privileges on the provider, nothing will happen. 280 281You will need to restart the replica after these {{slapd.conf}} changes. 282Then, if you are using {{loglevel stats}} (256), you can monitor an 283{{ldapmodify}} on the replica and the provider. (If you're using {{cn=config}} 284no restart is required.) 285 286Now start an {{ldapmodify}} on the replica and watch the logs. You should expect 287something like: 288 289> Sep 6 09:27:25 replica1 slapd[29274]: conn=11 fd=31 ACCEPT from IP=143.199.102.216:45181 (IP=143.199.102.216:389) 290> Sep 6 09:27:25 replica1 slapd[29274]: conn=11 op=0 STARTTLS 291> Sep 6 09:27:25 replica1 slapd[29274]: conn=11 op=0 RESULT oid= err=0 text= 292> Sep 6 09:27:25 replica1 slapd[29274]: conn=11 fd=31 TLS established tls_ssf=256 ssf=256 293> Sep 6 09:27:28 replica1 slapd[29274]: conn=11 op=1 BIND dn="uid=user1,ou=people,dc=example,dc=com" method=128 294> Sep 6 09:27:28 replica1 slapd[29274]: conn=11 op=1 BIND dn="uid=user1,ou=People,dc=example,dc=com" mech=SIMPLE ssf=0 295> Sep 6 09:27:28 replica1 slapd[29274]: conn=11 op=1 RESULT tag=97 err=0 text= 296> Sep 6 09:27:28 replica1 slapd[29274]: conn=11 op=2 MOD dn="uid=user1,ou=People,dc=example,dc=com" 297> Sep 6 09:27:28 replica1 slapd[29274]: conn=11 op=2 MOD attr=mail 298> Sep 6 09:27:28 replica1 slapd[29274]: conn=11 op=2 RESULT tag=103 err=0 text= 299> Sep 6 09:27:28 replica1 slapd[29274]: conn=11 op=3 UNBIND 300> Sep 6 09:27:28 replica1 slapd[29274]: conn=11 fd=31 closed 301> Sep 6 09:27:28 replica1 slapd[29274]: syncrepl_entry: LDAP_RES_SEARCH_ENTRY(LDAP_SYNC_MODIFY) 302> Sep 6 09:27:28 replica1 slapd[29274]: syncrepl_entry: be_search (0) 303> Sep 6 09:27:28 replica1 slapd[29274]: syncrepl_entry: uid=user1,ou=People,dc=example,dc=com 304> Sep 6 09:27:28 replica1 slapd[29274]: syncrepl_entry: be_modify (0) 305 306And on the provider you will see this: 307 308> Sep 6 09:23:57 ldapprovider slapd[2961]: conn=55902 op=3 PROXYAUTHZ dn="uid=user1,ou=people,dc=example,dc=com" 309> Sep 6 09:23:57 ldapprovider slapd[2961]: conn=55902 op=3 MOD dn="uid=user1,ou=People,dc=example,dc=com" 310> Sep 6 09:23:57 ldapprovider slapd[2961]: conn=55902 op=3 MOD attr=mail 311> Sep 6 09:23:57 ldapprovider slapd[2961]: conn=55902 op=3 RESULT tag=103 err=0 text= 312 313Note: You can clearly see the PROXYAUTHZ line on the provider, indicating the 314proper identity assertion for the update on the provider. Also note the replica 315immediately receiving the Syncrepl update from the provider. 316 317H3: Handling Chaining Errors 318 319By default, if chaining fails, the original referral is returned to the client 320under the assumption that the client might want to try and follow the referral. 321 322With the following directive however, if the chaining fails at the provider 323side, the actual error is returned to the client. 324 325> chain-return-error TRUE 326 327 328H3: Read-Back of Chained Modifications 329 330Occasionally, applications want to read back the data that they just wrote. 331If a modification requested to a shadow server was silently chained to its 332provider, an immediate read could result in receiving data not yet synchronized. 333In those cases, clients should use the {{B:dontusecopy}} control to ensure 334they are directed to the authoritative source for that piece of data. 335 336This control usually causes a referral to the actual source of the data 337to be returned. However, when the {{slapo-chain(5)}} overlay is used, 338it intercepts the referral being returned in response to the 339{{B:dontusecopy}} control, and tries to fetch the requested data. 340 341 342H3: Further Information 343 344{{:slapo-chain(5)}} 345 346 347H2: Constraints 348 349 350H3: Overview 351 352This overlay enforces a regular expression constraint on all values 353of specified attributes during an LDAP modify request that contains add or modify 354commands. It is used to enforce a more rigorous syntax when the underlying attribute 355syntax is too general. 356 357 358H3: Constraint Configuration 359 360Configuration via {{slapd.conf}}(5) would look like: 361 362> overlay constraint 363> constraint_attribute mail regex ^[[:alnum:]]+@mydomain.com$ 364> constraint_attribute title uri 365> ldap:///dc=catalog,dc=example,dc=com?title?sub?(objectClass=titleCatalog) 366 367A specification like the above would reject any {{mail}} attribute which did not 368look like {{<alphanumeric string>@mydomain.com}}. 369 370It would also reject any title attribute whose values were not listed in the 371title attribute of any {{titleCatalog}} entries in the given scope. 372 373An example for use with {{cn=config}}: 374 375> dn: olcOverlay=constraint,olcDatabase={1}mdb,cn=config 376> changetype: add 377> objectClass: olcOverlayConfig 378> objectClass: olcConstraintConfig 379> olcOverlay: constraint 380> olcConstraintAttribute: mail regex ^[[:alnum:]]+@mydomain.com$ 381> olcConstraintAttribute: title uri ldap:///dc=catalog,dc=example,dc=com?title?sub?(objectClass=titleCatalog) 382 383 384H3: Further Information 385 386{{:slapo-constraint(5)}} 387 388 389H2: Dynamic Directory Services 390 391 392H3: Overview 393 394The {{dds}} overlay to {{slapd}}(8) implements dynamic objects as per {{REF:RFC2589}}. 395The name {{dds}} stands for Dynamic Directory Services. It allows to define 396dynamic objects, characterized by the {{dynamicObject}} objectClass. 397 398Dynamic objects have a limited lifetime, determined by a time-to-live (TTL) 399that can be refreshed by means of a specific refresh extended operation. This 400operation allows to set the Client Refresh Period (CRP), namely the period 401between refreshes that is required to preserve the dynamic object from expiration. 402The expiration time is computed by adding the requested TTL to the current time. 403When dynamic objects reach the end of their lifetime without being further 404refreshed, they are automatically {{deleted}}. There is no guarantee of immediate 405deletion, so clients should not count on it. 406 407H3: Dynamic Directory Service Configuration 408 409A usage of dynamic objects might be to implement dynamic meetings; in this case, 410all the participants to the meeting are allowed to refresh the meeting object, 411but only the creator can delete it (otherwise it will be deleted when the TTL expires). 412 413If we add the overlay to an example database, specifying a Max TTL of 1 day, a 414min of 10 seconds, with a default TTL of 1 hour. We'll also specify an interval 415of 120 (less than 60s might be too small) seconds between expiration checks and a 416tolerance of 5 second (lifetime of a dynamic object will be {{entryTtl + tolerance}}). 417 418> overlay dds 419> dds-max-ttl 1d 420> dds-min-ttl 10s 421> dds-default-ttl 1h 422> dds-interval 120s 423> dds-tolerance 5s 424 425and add an index: 426 427> entryExpireTimestamp 428 429Creating a meeting is as simple as adding the following: 430 431> dn: cn=OpenLDAP Documentation Meeting,ou=Meetings,dc=example,dc=com 432> objectClass: groupOfNames 433> objectClass: dynamicObject 434> cn: OpenLDAP Documentation Meeting 435> member: uid=ghenry,ou=People,dc=example,dc=com 436> member: uid=hyc,ou=People,dc=example,dc=com 437 438H4: Dynamic Directory Service ACLs 439 440Allow users to start a meeting and to join it; restrict refresh to the {{member}}; 441restrict delete to the creator: 442 443> access to attrs=userPassword 444> by self write 445> by * read 446> 447> access to dn.base="ou=Meetings,dc=example,dc=com" 448> attrs=children 449> by users write 450> 451> access to dn.onelevel="ou=Meetings,dc=example,dc=com" 452> attrs=entry 453> by dnattr=creatorsName write 454> by * read 455> 456> access to dn.onelevel="ou=Meetings,dc=example,dc=com" 457> attrs=participant 458> by dnattr=creatorsName write 459> by users selfwrite 460> by * read 461> 462> access to dn.onelevel="ou=Meetings,dc=example,dc=com" 463> attrs=entryTtl 464> by dnattr=member manage 465> by * read 466 467In simple terms, the user who created the {{OpenLDAP Documentation Meeting}} can add new attendees, 468refresh the meeting using (basically complete control): 469 470> ldapexop -x -H ldap://ldaphost "refresh" "cn=OpenLDAP Documentation Meeting,ou=Meetings,dc=example,dc=com" "120" -D "uid=ghenry,ou=People,dc=example,dc=com" -W 471 472Any user can join the meeting, but not add another attendee, but they can refresh the meeting. The ACLs above are quite straight forward to understand. 473 474 475H3: Further Information 476 477{{:slapo-dds(5)}} 478 479 480H2: Dynamic Groups 481 482 483H3: Overview 484 485This overlay extends the Compare operation to detect 486members of a dynamic group. This overlay is now deprecated 487as all of its functions are available using the 488{{SECT:Dynamic Lists}} overlay. 489 490 491H3: Dynamic Group Configuration 492 493 494H2: Dynamic Lists 495 496 497H3: Overview 498 499This overlay allows expansion of dynamic groups and lists. Instead of having the 500group members or list attributes hard coded, this overlay allows us to define 501an LDAP search whose results will make up the group or list. 502 503H3: Dynamic List Configuration 504 505This module can behave both as a dynamic list and dynamic group, depending on 506the configuration. The syntax is as follows: 507 508> overlay dynlist 509> dynlist-attrset <group-oc> <URL-ad> [member-ad] 510 511The parameters to the {{F:dynlist-attrset}} directive have the following meaning: 512* {{F:<group-oc>}}: specifies which object class triggers the subsequent LDAP search. 513Whenever an entry with this object class is retrieved, the search is performed. 514* {{F:<URL-ad>}}: is the name of the attribute which holds the search URI. It 515has to be a subtype of {{F:labeledURI}}. The attributes and values present in 516the search result are added to the entry unless {{F:member-ad}} is used (see 517below). 518* {{F:member-ad}}: if present, changes the overlay behavior into a dynamic group. 519Instead of inserting the results of the search in the entry, the distinguished name 520of the results are added as values of this attribute. 521 522Here is an example which will allow us to have an email alias which automatically 523expands to all user's emails according to our LDAP filter: 524 525In {{slapd.conf}}(5): 526 527> overlay dynlist 528> dynlist-attrset nisMailAlias labeledURI 529 530This means that whenever an entry which has the {{F:nisMailAlias}} object class is 531retrieved, the search specified in the {{F:labeledURI}} attribute is performed. 532 533Let's say we have this entry in our directory: 534 535> cn=all,ou=aliases,dc=example,dc=com 536> cn: all 537> objectClass: nisMailAlias 538> labeledURI: ldap:///ou=People,dc=example,dc=com?mail?one?(objectClass=inetOrgPerson) 539 540If this entry is retrieved, the search specified in {{F:labeledURI}} will be 541performed and the results will be added to the entry just as if they have always 542been there. In this case, the search filter selects all entries directly 543under {{F:ou=People}} that have the {{F:inetOrgPerson}} object class and retrieves 544the {{F:mail}} attribute, if it exists. 545 546This is what gets added to the entry when we have two users under {{F:ou=People}} 547that match the filter: 548!import "allmail-en.png"; align="center"; title="Dynamic list for email aliases" 549FT[align="Center"] Figure X.Y: Dynamic List for all emails 550 551The configuration for a dynamic group is similar. Let's see an example which would 552automatically populate an {{F:allusers}} group with all the user accounts in the 553directory. 554 555In {{F:slapd.conf}}(5): 556 557> include /path/to/dyngroup.schema 558> ... 559> overlay dynlist 560> dynlist-attrset groupOfURLs labeledURI member 561 562Note: We must include the {{F:dyngroup.schema}} file that defines the {{F:groupOfURLs}} 563objectClass used in this example. 564 565Let's apply it to the following entry: 566 567> cn=allusers,ou=group,dc=example,dc=com 568> cn: all 569> objectClass: groupOfURLs 570> labeledURI: ldap:///ou=people,dc=example,dc=com??one?(objectClass=inetOrgPerson) 571 572The behavior is similar to the dynamic list configuration we had before: 573whenever an entry with the {{F:groupOfURLs}} object class is retrieved, the 574search specified in the {{F:labeledURI}} attribute is performed. But this time, 575only the distinguished names of the results are added, and as values of the 576{{F:member}} attribute. 577 578This is what we get: 579!import "allusersgroup-en.png"; align="center"; title="Dynamic group for all users" 580FT[align="Center"] Figure X.Y: Dynamic Group for all users 581 582Note that a side effect of this scheme of dynamic groups is that the members 583need to be specified as full DNs. So, if you are planning in using this for 584{{F:posixGroup}}s, be sure to use RFC2307bis and some attribute which can hold 585distinguished names. The {{F:memberUid}} attribute used in the {{F:posixGroup}} 586object class can hold only names, not DNs, and is therefore not suitable for 587dynamic groups. 588 589 590H3: Further Information 591 592{{:slapo-dynlist(5)}} 593 594 595H2: Reverse Group Membership Maintenance 596 597H3: Overview 598 599In some scenarios, it may be desirable for a client to be able to determine 600which groups an entry is a member of, without performing an additional search. 601Examples of this are applications using the {{TERM:DIT}} for access control 602based on group authorization. 603 604The {{B:memberof}} overlay updates an attribute (by default {{B:memberOf}}) whenever 605changes occur to the membership attribute (by default {{B:member}}) of entries of the 606objectclass (by default {{B:groupOfNames}}) configured to trigger updates. 607 608Thus, it provides maintenance of the list of groups an entry is a member of, 609when usual maintenance of groups is done by modifying the members on the group 610entry. 611 612H3: Member Of Configuration 613 614The typical use of this overlay requires just enabling the overlay for a 615specific database. For example, with the following minimal slapd.conf: 616 617> include /usr/share/openldap/schema/core.schema 618> include /usr/share/openldap/schema/cosine.schema 619> 620> authz-regexp "gidNumber=0\\\+uidNumber=0,cn=peercred,cn=external,cn=auth" 621> "cn=Manager,dc=example,dc=com" 622> database mdb 623> suffix "dc=example,dc=com" 624> rootdn "cn=Manager,dc=example,dc=com" 625> rootpw secret 626> directory /var/lib/ldap2.5 627> checkpoint 256 5 628> index objectClass eq 629> index uid eq,sub 630> 631> overlay memberof 632 633adding the following ldif: 634 635> cat memberof.ldif 636> dn: dc=example,dc=com 637> objectclass: domain 638> dc: example 639> 640> dn: ou=Group,dc=example,dc=com 641> objectclass: organizationalUnit 642> ou: Group 643> 644> dn: ou=People,dc=example,dc=com 645> objectclass: organizationalUnit 646> ou: People 647> 648> dn: uid=test1,ou=People,dc=example,dc=com 649> objectclass: account 650> uid: test1 651> 652> dn: cn=testgroup,ou=Group,dc=example,dc=com 653> objectclass: groupOfNames 654> cn: testgroup 655> member: uid=test1,ou=People,dc=example,dc=com 656 657Results in the following output from a search on the test1 user: 658 659> # ldapsearch -LL -Y EXTERNAL -H ldapi:/// "(uid=test1)" -b dc=example,dc=com memberOf 660> SASL/EXTERNAL authentication started 661> SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth 662> SASL SSF: 0 663> version: 1 664> 665> dn: uid=test1,ou=People,dc=example,dc=com 666> memberOf: cn=testgroup,ou=Group,dc=example,dc=com 667 668Note that the {{B:memberOf}} attribute is an operational attribute, so it must be 669requested explicitly. 670 671 672H3: Further Information 673 674{{:slapo-memberof(5)}} 675 676 677H2: The Proxy Cache Engine 678 679{{TERM:LDAP}} servers typically hold one or more subtrees of a 680{{TERM:DIT}}. Replica (or shadow) servers hold shadow copies of 681entries held by one or more provider servers. Changes are propagated 682from the provider server to replica servers using LDAP Sync 683replication. An LDAP cache is a special type of replica which holds 684entries corresponding to search filters instead of subtrees. 685 686H3: Overview 687 688The proxy cache extension of slapd is designed to improve the 689responsiveness of the ldap and meta backends. It handles a search 690request (query) 691by first determining whether it is contained in any cached search 692filter. Contained requests are answered from the proxy cache's local 693database. Other requests are passed on to the underlying ldap or 694meta backend and processed as usual. 695 696E.g. {{EX:(shoesize>=9)}} is contained in {{EX:(shoesize>=8)}} and 697{{EX:(sn=Richardson)}} is contained in {{EX:(sn=Richards*)}} 698 699Correct matching rules and syntaxes are used while comparing 700assertions for query containment. To simplify the query containment 701problem, a list of cacheable "templates" (defined below) is specified 702at configuration time. A query is cached or answered only if it 703belongs to one of these templates. The entries corresponding to 704cached queries are stored in the proxy cache local database while 705its associated meta information (filter, scope, base, attributes) 706is stored in main memory. 707 708A template is a prototype for generating LDAP search requests. 709Templates are described by a prototype search filter and a list of 710attributes which are required in queries generated from the template. 711The representation for prototype filter is similar to {{REF:RFC4515}}, 712except that the assertion values are missing. Examples of prototype 713filters are: (sn=),(&(sn=)(givenname=)) which are instantiated by 714search filters (sn=Doe) and (&(sn=Doe)(givenname=John)) respectively. 715 716The cache replacement policy removes the least recently used (LRU) 717query and entries belonging to only that query. Queries are allowed 718a maximum time to live (TTL) in the cache thus providing weak 719consistency. A background task periodically checks the cache for 720expired queries and removes them. 721 722The Proxy Cache paper 723({{URL:http://www.openldap.org/pub/kapurva/proxycaching.pdf}}) provides 724design and implementation details. 725 726 727H3: Proxy Cache Configuration 728 729The cache configuration specific directives described below must 730appear after a {{EX:overlay pcache}} directive within a 731{{EX:"database meta"}} or {{EX:"database ldap"}} section of 732the server's {{slapd.conf}}(5) file. 733 734H4: Setting cache parameters 735 736> pcache <DB> <maxentries> <nattrsets> <entrylimit> <period> 737 738This directive enables proxy caching and sets general cache 739parameters. The <DB> parameter specifies which underlying database 740is to be used to hold cached entries. It should be set to 741{{EX:mdb}}. The <maxentries> parameter specifies the 742total number of entries which may be held in the cache. The 743<nattrsets> parameter specifies the total number of attribute sets 744(as specified by the {{EX:pcacheAttrset}} directive) that may be 745defined. The <entrylimit> parameter specifies the maximum number of 746entries in a cacheable query. The <period> specifies the consistency 747check period (in seconds). In each period, queries with expired 748TTLs are removed. 749 750H4: Defining attribute sets 751 752> pcacheAttrset <index> <attrs...> 753 754Used to associate a set of attributes to an index. Each attribute 755set is associated with an index number from 0 to <numattrsets>-1. 756These indices are used by the pcacheTemplate directive to define 757cacheable templates. 758 759H4: Specifying cacheable templates 760 761> pcacheTemplate <prototype_string> <attrset_index> <TTL> 762 763Specifies a cacheable template and the "time to live" (in sec) <TTL> 764for queries belonging to the template. A template is described by 765its prototype filter string and set of required attributes identified 766by <attrset_index>. 767 768 769H4: Example for slapd.conf 770 771An example {{slapd.conf}}(5) database section for a caching server 772which proxies for the {{EX:"dc=example,dc=com"}} subtree held 773at server {{EX:ldap.example.com}}. 774 775> database ldap 776> suffix "dc=example,dc=com" 777> rootdn "dc=example,dc=com" 778> uri ldap://ldap.example.com/ 779> overlay pcache 780> pcache mdb 100000 1 1000 100 781> pcacheAttrset 0 mail postaladdress telephonenumber 782> pcacheTemplate (sn=) 0 3600 783> pcacheTemplate (&(sn=)(givenName=)) 0 3600 784> pcacheTemplate (&(departmentNumber=)(secretary=*)) 0 3600 785> 786> cachesize 20 787> directory ./testrun/db.2.a 788> index objectClass eq 789> index cn,sn,uid,mail pres,eq,sub 790 791H4: Example for slapd-config 792 793The same example as a LDIF file for back-config for a caching server 794which proxies for the {{EX:"dc=example,dc=com"}} subtree held 795at server {{EX:ldap.example.com}}. 796 797> dn: olcDatabase={2}ldap,cn=config 798> objectClass: olcDatabaseConfig 799> objectClass: olcLDAPConfig 800> olcDatabase: {2}ldap 801> olcSuffix: dc=example,dc=com 802> olcRootDN: dc=example,dc=com 803> olcDbURI: "ldap://ldap.example.com" 804> 805> dn: olcOverlay={0}pcache,olcDatabase={2}ldap,cn=config 806> objectClass: olcOverlayConfig 807> objectClass: olcPcacheConfig 808> olcOverlay: {0}pcache 809> olcPcache: mdb 100000 1 1000 100 810> olcPcacheAttrset: 0 mail postalAddress telephoneNumber 811> olcPcacheTemplate: "(sn=)" 0 3600 0 0 0 812> olcPcacheTemplate: "(&(sn=)(givenName=))" 0 3600 0 0 0 813> olcPcacheTemplate: "(&(departmentNumber=)(secretary=))" 0 3600 814> 815> dn: olcDatabase={0}mdb,olcOverlay={0}pcache,olcDatabase={2}ldap,cn=config 816> objectClass: olcMdbConfig 817> objectClass: olcPcacheDatabase 818> olcDatabase: {0}mdb 819> olcDbDirectory: ./testrun/db.2.a 820> olcDbCacheSize: 20 821> olcDbIndex: objectClass eq 822> olcDbIndex: cn,sn,uid,mail pres,eq,sub 823 824 825H5: Cacheable Queries 826 827A LDAP search query is cacheable when its filter matches one of the 828templates as defined in the "pcacheTemplate" statements and when it references 829only the attributes specified in the corresponding attribute set. 830In the example above the attribute set number 0 defines that only the 831attributes: {{EX:mail postaladdress telephonenumber}} are cached for the following 832pcacheTemplates. 833 834H5: Examples: 835 836> Filter: (&(sn=Richard*)(givenName=jack)) 837> Attrs: mail telephoneNumber 838 839 is cacheable, because it matches the template {{EX:(&(sn=)(givenName=))}} and its 840 attributes are contained in pcacheAttrset 0. 841 842> Filter: (&(sn=Richard*)(telephoneNumber)) 843> Attrs: givenName 844 845 is not cacheable, because the filter does not match the template, 846 nor is the attribute givenName stored in the cache 847 848> Filter: (|(sn=Richard*)(givenName=jack)) 849> Attrs: mail telephoneNumber 850 851 is not cacheable, because the filter does not match the template ( logical 852 OR "|" condition instead of logical AND "&" ) 853 854 855H3: Further Information 856 857{{:slapo-pcache(5)}} 858 859 860H2: Password Policies 861 862 863H3: Overview 864 865This overlay follows the specifications contained in the draft RFC titled 866draft-behera-ldap-password-policy-09. While the draft itself is expired, it has 867been implemented in several directory servers, including slapd. Nonetheless, 868it is important to note that it is a draft, meaning that it is subject to change 869and is a work-in-progress. 870 871The key abilities of the password policy overlay are as follows: 872 873* Enforce a minimum length for new passwords 874* Make sure passwords are not changed too frequently 875* Cause passwords to expire, provide warnings before they need to be changed, and allow a fixed number of 'grace' logins to allow them to be changed after they have expired 876* Maintain a history of passwords to prevent password re-use 877* Prevent password guessing by locking a password for a specified period of time after repeated authentication failures 878* Force a password to be changed at the next authentication 879* Set an administrative lock on an account 880* Support multiple password policies on a default or a per-object basis. 881* Perform arbitrary quality checks using an external loadable module. This is a non-standard extension of the draft RFC. 882 883 884H3: Password Policy Configuration 885 886Instantiate the module in the database where it will be used, after adding the 887new ppolicy schema and loading the ppolicy module. The following example shows 888the ppolicy module being added to the database that handles the naming 889context "dc=example,dc=com". In this example we are also specifying the DN of 890a policy object to use if none other is specified in a user's object. 891 892> database mdb 893> suffix "dc=example,dc=com" 894> [...additional database configuration directives go here...] 895> 896> overlay ppolicy 897> ppolicy_default "cn=default,ou=policies,dc=example,dc=com" 898 899 900Now we need a container for the policy objects. In our example the password 901policy objects are going to be placed in a section of the tree called 902"ou=policies,dc=example,dc=com": 903 904> dn: ou=policies,dc=example,dc=com 905> objectClass: organizationalUnit 906> objectClass: top 907> ou: policies 908 909 910The default policy object that we are creating defines the following policies: 911 912* The user is allowed to change his own password. Note that the directory ACLs for this attribute can also affect this ability (pwdAllowUserChange: TRUE). 913* The name of the password attribute is "userPassword" (pwdAttribute: userPassword). Note that this is the only value that is accepted by OpenLDAP for this attribute. 914* The server will check the syntax of the password. If the server is unable to check the syntax (i.e., it was hashed or otherwise encoded by the client) it will return an error refusing the password (pwdCheckQuality: 2). 915* When a client includes the Password Policy Request control with a bind request, the server will respond with a password expiration warning if it is going to expire in ten minutes or less (pwdExpireWarning: 600). The warnings themselves are returned in a Password Policy Response control. 916* When the password for a DN has expired, the server will allow five additional "grace" logins (pwdGraceAuthNLimit: 5). 917* The server will maintain a history of the last five passwords that were used for a DN (pwdInHistory: 5). 918* The server will lock the account after the maximum number of failed bind attempts has been exceeded (pwdLockout: TRUE). 919* When the server has locked an account, the server will keep it locked until an administrator unlocks it (pwdLockoutDuration: 0) 920* The server will reset its failed bind count after a period of 30 seconds. 921* Passwords will not expire (pwdMaxAge: 0). 922* Passwords can be changed as often as desired (pwdMinAge: 0). 923* Passwords must be at least 5 characters in length (pwdMinLength: 5). 924* The password does not need to be changed at the first bind or when the administrator has reset the password (pwdMustChange: FALSE) 925* The current password does not need to be included with password change requests (pwdSafeModify: FALSE) 926* The server will only allow five failed binds in a row for a particular DN (pwdMaxFailure: 5). 927 928 929The actual policy would be: 930 931> dn: cn=default,ou=policies,dc=example,dc=com 932> cn: default 933> objectClass: pwdPolicy 934> objectClass: namedPolicy 935> objectClass: top 936> pwdAllowUserChange: TRUE 937> pwdAttribute: userPassword 938> pwdCheckQuality: 2 939> pwdExpireWarning: 600 940> pwdFailureCountInterval: 30 941> pwdGraceAuthNLimit: 5 942> pwdInHistory: 5 943> pwdLockout: TRUE 944> pwdLockoutDuration: 0 945> pwdMaxAge: 0 946> pwdMaxFailure: 5 947> pwdMinAge: 0 948> pwdMinLength: 5 949> pwdMustChange: FALSE 950> pwdSafeModify: FALSE 951 952You can create additional policy objects as needed. 953 954The namedPolicy object class is present because the policy entry 955requires a structural object class. 956 957There are two ways password policy can be applied to individual objects: 958 9591. The pwdPolicySubentry in a user's object - If a user's object has a 960pwdPolicySubEntry attribute specifying the DN of a policy object, then 961the policy defined by that object is applied. 962 9632. Default password policy - If there is no specific pwdPolicySubentry set 964for an object, and the password policy module was configured with the DN of a 965default policy object and if that object exists, then the policy defined in 966that object is applied. 967 968Please see {{slapo-ppolicy(5)}} for a complete explanation of its features. 969 970A guiding philosophy for OpenLDAP and directory servers in general has been 971that they always hand back exactly what they were given, without 972modification. For example, if the cn attribute of an object was set to fOObaR, 973the server will return that exact string during a search. Values of attributes 974of a sensitive nature, such as userPassword, are often hashed to conceal their 975values. Since the userPassword values are used internally by the directory 976server to authenticate users, any hash algorithm that is applied to the value 977must be compatible with the directory server. Historically this problem has 978been solved by making the LDAP client application be able to hash the 979userPassword attribute value in a way that is compatible with the directory 980server, but this solution has the obvious drawback of requiring tight coupling 981between the LDAP client and server, and limits the choices of usable hashing 982algorithms to those that are accommodated by both. This is clearly a 983sub-optimal solution. 984 985In 2001 RFC 3062 became a standard that specified an LDAP extended operation 986for cases like this. Extended operations are not bound by the 987return-what-you-are-given philosophy and so are free to do things to attribute 988values that the add and modify operations cannot. The change password extended 989operation accepts a plaintext password and hashes it based on a specification 990that is contained in the server. This allows the server to be in control of 991the hashing algorithm which, in turn, ensures that any hashes applied to 992userPassword attribute values will not prevent users from being authenticated. 993 994The password policy module's ppolicy_hash_cleartext flag addresses this 995problem by intercepting LDAP modify operations that include the userPassword 996attribute and converting them to change password extended operations so they 997can be hashed according to the specification contained in slapd's 998configuration. When this flag is set, LDAP applications that modify the 999userPassword attribute can send the password in cleartext form to the server 1000using a standard LDAP modify command and the server will hash the value 1001according to the password-hash directive before storing it. It goes without 1002saying that steps need to be taken to protect the cleartext password in 1003transit, such as using SSL, TLS, or some other link encryption method. 1004 1005The following example shows the ppolicy module configured to hash cleartext 1006passwords: 1007 1008> database mdb 1009> suffix "dc=example,dc=com" 1010> [...additional database configuration directives go here...] 1011> 1012> overlay ppolicy 1013> ppolicy_default "cn=default,ou=policies,dc=example,dc=com" 1014> ppolicy_hash_cleartext 1015 1016 1017H3: Further Information 1018 1019{{:slapo-ppolicy(5)}} 1020 1021 1022H2: Referential Integrity 1023 1024 1025H3: Overview 1026 1027This overlay can be used with a backend database such as slapd-mdb(5) 1028to maintain the cohesiveness of a schema which utilizes reference 1029attributes. 1030 1031Whenever a {{modrdn}} or {{delete}} is performed, that is, when an entry's DN 1032is renamed or an entry is removed, the server will search the directory for 1033references to this DN (in selected attributes: see below) and update them 1034accordingly. If it was a {{delete}} operation, the reference is deleted. If it 1035was a {{modrdn}} operation, then the reference is updated with the new DN. 1036 1037For example, a very common administration task is to maintain group membership 1038lists, specially when users are removed from the directory. When an 1039user account is deleted or renamed, all groups this user is a member of have to be 1040updated. LDAP administrators usually have scripts for that. But we can use the 1041{{F:refint}} overlay to automate this task. In this example, if the user is 1042removed from the directory, the overlay will take care to remove the user from 1043all the groups he/she was a member of. No more scripting for this. 1044 1045H3: Referential Integrity Configuration 1046 1047The configuration for this overlay is as follows: 1048 1049> overlay refint 1050> refint_attributes <attribute [attribute ...]> 1051> refint_nothing <string> 1052 1053* {{F:refint_attributes}}: this parameter specifies a space separated list of 1054attributes which will have the referential integrity maintained. When an entry is 1055removed or has its DN renamed, the server will do an internal search for any of the 1056{{F:refint_attributes}} that point to the affected DN and update them accordingly. IMPORTANT: 1057the attributes listed here must have the {{F:distinguishedName}} syntax, that is, 1058hold DNs as values. 1059* {{F:refint_nothing}}: some times, while trying to maintain the referential 1060integrity, the server has to remove the last attribute of its kind from an 1061entry. This may be prohibited by the schema: for example, the 1062{{F:groupOfNames}} object class requires at least one member. In these cases, 1063the server will add the attribute value specified in {{F:refint_nothing}} 1064to the entry. 1065 1066To illustrate this overlay, we will use the group membership scenario. 1067 1068In {{F:slapd.conf}}: 1069 1070> overlay refint 1071> refint_attributes member 1072> refint_nothing "cn=admin,dc=example,dc=com" 1073 1074This configuration tells the overlay to maintain the referential integrity of the {{F:member}} 1075attribute. This attribute is used in the {{F:groupOfNames}} object class which always needs 1076a member, so we add the {{F:refint_nothing}} directive to fill in the group with a standard 1077member should all the members vanish. 1078 1079If we have the following group membership, the refint overlay will 1080automatically remove {{F:john}} from the group if his entry is removed from the 1081directory: 1082 1083!import "refint.png"; align="center"; title="Group membership" 1084FT[align="Center"] Figure X.Y: Maintaining referential integrity in groups 1085 1086Notice that if we rename ({{F:modrdn}}) the {{F:john}} entry to, say, {{F:jsmith}}, the refint 1087overlay will also rename the reference in the {{F:member}} attribute, so the group membership 1088stays correct. 1089 1090If we removed all users from the directory who are a member of this group, then the end result 1091would be a single member in the group: {{F:cn=admin,dc=example,dc=com}}. This is the 1092{{F:refint_nothing}} parameter kicking into action so that the schema is not violated. 1093 1094The {{rootdn}} must be set for the database as refint runs as the {{rootdn}} to gain access to 1095make its updates. The {{rootpw}} does not need to be set. 1096 1097H3: Further Information 1098 1099{{:slapo-refint(5)}} 1100 1101 1102H2: Return Code 1103 1104 1105H3: Overview 1106 1107This overlay is useful to test the behavior of clients when 1108server-generated erroneous and/or unusual responses occur, 1109for example; error codes, referrals, excessive response times and so on. 1110 1111This would be classed as a debugging tool whilst developing client software 1112or additional Overlays. 1113 1114For detailed information, please see the {{slapo-retcode(5)}} man page. 1115 1116 1117H3: Return Code Configuration 1118 1119The retcode overlay utilizes the "return code" schema described in the man page. 1120This schema is specifically designed for use with this overlay and is not intended 1121to be used otherwise. 1122 1123Note: The necessary schema is loaded automatically by the overlay. 1124 1125An example configuration might be: 1126 1127> overlay retcode 1128> retcode-parent "ou=RetCodes,dc=example,dc=com" 1129> include ./retcode.conf 1130> 1131> retcode-item "cn=Unsolicited" 0x00 unsolicited="0" 1132> retcode-item "cn=Notice of Disconnect" 0x00 unsolicited="1.3.6.1.4.1.1466.20036" 1133> retcode-item "cn=Pre-disconnect" 0x34 flags="pre-disconnect" 1134> retcode-item "cn=Post-disconnect" 0x34 flags="post-disconnect" 1135 1136Note: {{retcode.conf}} can be found in the openldap source at: {{F:tests/data/retcode.conf}} 1137 1138An excerpt of a {{F:retcode.conf}} would be something like: 1139 1140> retcode-item "cn=success" 0x00 1141> 1142> retcode-item "cn=success w/ delay" 0x00 sleeptime=2 1143> 1144> retcode-item "cn=operationsError" 0x01 1145> retcode-item "cn=protocolError" 0x02 1146> retcode-item "cn=timeLimitExceeded" 0x03 op=search 1147> retcode-item "cn=sizeLimitExceeded" 0x04 op=search 1148> retcode-item "cn=compareFalse" 0x05 op=compare 1149> retcode-item "cn=compareTrue" 0x06 op=compare 1150> retcode-item "cn=authMethodNotSupported" 0x07 1151> retcode-item "cn=strongAuthNotSupported" 0x07 text="same as authMethodNotSupported" 1152> retcode-item "cn=strongAuthRequired" 0x08 1153> retcode-item "cn=strongerAuthRequired" 0x08 text="same as strongAuthRequired" 1154 1155Please see {{F:tests/data/retcode.conf}} for a complete {{F:retcode.conf}} 1156 1157 1158H3: Further Information 1159 1160{{:slapo-retcode(5)}} 1161 1162 1163H2: Rewrite/Remap 1164 1165 1166H3: Overview 1167 1168It performs basic DN/data rewrite and objectClass/attributeType mapping. Its 1169usage is mostly intended to provide virtual views of existing data either 1170remotely, in conjunction with the proxy backend described in {{slapd-ldap(5)}}, 1171or locally, in conjunction with the relay backend described in {{slapd-relay(5)}}. 1172 1173This overlay is extremely configurable and advanced, therefore recommended 1174reading is the {{slapo-rwm(5)}} man page. 1175 1176 1177H3: Rewrite/Remap Configuration 1178 1179 1180H3: Further Information 1181 1182{{:slapo-rwm(5)}} 1183 1184 1185H2: Sync Provider 1186 1187 1188H3: Overview 1189 1190This overlay implements the provider-side support for the LDAP Content Synchronization 1191({{REF:RFC4533}}) as well as syncrepl replication support, including persistent search functionality. 1192 1193H3: Sync Provider Configuration 1194 1195There is very little configuration needed for this overlay, in fact for many situations merely loading 1196the overlay will suffice. 1197 1198However, because the overlay creates a contextCSN attribute in the root entry of the database which is 1199updated for every write operation performed against the database and only updated in memory, it is 1200recommended to configure a checkpoint so that the contextCSN is written into the underlying database to 1201minimize recovery time after an unclean shutdown: 1202 1203> overlay syncprov 1204> syncprov-checkpoint 100 10 1205 1206For every 100 operations or 10 minutes, which ever is sooner, the contextCSN will be checkpointed. 1207 1208The four configuration directives available are {{B:syncprov-checkpoint}}, {{B:syncprov-sessionlog}}, 1209{{B:syncprov-nopresent}} and {{B:syncprov-reloadhint}} which are covered in the man page discussing 1210various other scenarios where this overlay can be used. 1211 1212H3: Further Information 1213 1214The {{:slapo-syncprov(5)}} man page and the {{SECT:Configuring the different replication types}} section 1215 1216 1217H2: Translucent Proxy 1218 1219 1220H3: Overview 1221 1222This overlay can be used with a backend database such as {{:slapd-mdb}}(5) 1223to create a "translucent proxy". 1224 1225Entries retrieved from a remote LDAP server may have some or all attributes 1226overridden, or new attributes added, by entries in the local database before 1227being presented to the client. 1228 1229A search operation is first populated with entries from the remote LDAP server, 1230the attributes of which are then overridden with any attributes defined in the 1231local database. Local overrides may be populated with the add, modify, and 1232modrdn operations, the use of which is restricted to the root user of the 1233translucent local database. 1234 1235A compare operation will perform a comparison with attributes defined in the 1236local database record (if any) before any comparison is made with data in the 1237remote database. 1238 1239 1240H3: Translucent Proxy Configuration 1241 1242There are various options available with this overlay, but for this example we 1243will demonstrate adding new attributes to a remote entry and also searching 1244against these newly added local attributes. For more information about overriding remote 1245entries and search configuration, please see {{:slapo-translucent(5)}} 1246 1247Note: The Translucent Proxy overlay will disable schema checking in the local 1248database, so that an entry consisting of overlay attributes need not adhere 1249 to the complete schema. 1250 1251First we configure the overlay in the normal manner: 1252 1253> include /usr/local/etc/openldap/schema/core.schema 1254> include /usr/local/etc/openldap/schema/cosine.schema 1255> include /usr/local/etc/openldap/schema/nis.schema 1256> include /usr/local/etc/openldap/schema/inetorgperson.schema 1257> 1258> pidfile ./slapd.pid 1259> argsfile ./slapd.args 1260> 1261> database mdb 1262> suffix "dc=suretecsystems,dc=com" 1263> rootdn "cn=trans,dc=suretecsystems,dc=com" 1264> rootpw secret 1265> directory ./openldap-data 1266> 1267> index objectClass eq 1268> 1269> overlay translucent 1270> translucent_local carLicense 1271> 1272> uri ldap://192.168.X.X:389 1273> lastmod off 1274> acl-bind binddn="cn=admin,dc=suretecsystems,dc=com" credentials="blahblah" 1275 1276You will notice the overlay directive and a directive to say what attribute we 1277want to be able to search against in the local database. We must also load the 1278ldap backend which will connect to the remote directory server. 1279 1280Now we take an example LDAP group: 1281 1282> # itsupport, Groups, suretecsystems.com 1283> dn: cn=itsupport,ou=Groups,dc=suretecsystems,dc=com 1284> objectClass: posixGroup 1285> objectClass: sambaGroupMapping 1286> cn: itsupport 1287> gidNumber: 1000 1288> sambaSID: S-1-5-21-XXX 1289> sambaGroupType: 2 1290> displayName: itsupport 1291> memberUid: ghenry 1292> memberUid: joebloggs 1293 1294and create an LDIF file we can use to add our data to the local database, using 1295 some pretty strange choices of new attributes for demonstration purposes: 1296 1297> [ghenry@suretec test_configs]$ cat test-translucent-add.ldif 1298> dn: cn=itsupport,ou=Groups,dc=suretecsystems,dc=com 1299> businessCategory: frontend-override 1300> carLicense: LIVID 1301> employeeType: special 1302> departmentNumber: 9999999 1303> roomNumber: 41L-535 1304 1305Searching against the proxy gives: 1306 1307> [ghenry@suretec test_configs]$ ldapsearch -x -H ldap://127.0.0.1:9001 "(cn=itsupport)" 1308> # itsupport, Groups, OxObjects, suretecsystems.com 1309> dn: cn=itsupport,ou=Groups,ou=OxObjects,dc=suretecsystems,dc=com 1310> objectClass: posixGroup 1311> objectClass: sambaGroupMapping 1312> cn: itsupport 1313> gidNumber: 1003 1314> SAMBASID: S-1-5-21-XXX 1315> SAMBAGROUPTYPE: 2 1316> displayName: itsupport 1317> memberUid: ghenry 1318> memberUid: joebloggs 1319> roomNumber: 41L-535 1320> departmentNumber: 9999999 1321> employeeType: special 1322> carLicense: LIVID 1323> businessCategory: frontend-override 1324 1325Here we can see that the 5 new attributes are added to the remote entry before 1326being returned to the our client. 1327 1328Because we have configured a local attribute to search against: 1329 1330> overlay translucent 1331> translucent_local carLicense 1332 1333we can also search for that to return the completely fabricated entry: 1334 1335> ldapsearch -x -H ldap://127.0.0.1:9001 (carLicense=LIVID) 1336 1337This is an extremely useful feature because you can then extend a remote directory server 1338locally and also search against the local entries. 1339 1340Note: Because the translucent overlay does not perform any DN rewrites, the local 1341 and remote database instances must have the same suffix. Other configurations 1342will probably fail with No Such Object and other errors 1343 1344H3: Further Information 1345 1346{{:slapo-translucent(5)}} 1347 1348 1349H2: Attribute Uniqueness 1350 1351 1352H3: Overview 1353 1354This overlay can be used with a backend database such as {{slapd-mdb(5)}} 1355to enforce the uniqueness of some or all attributes within a subtree. 1356 1357 1358H3: Attribute Uniqueness Configuration 1359 1360This overlay is only effective on new data from the point the overlay is enabled. To 1361check uniqueness for existing data, you can export and import your data again via the 1362LDAP Add operation, which will not be suitable for large amounts of data, unlike {{B:slapcat}}. 1363 1364For the following example, if uniqueness were enforced for the {{B:mail}} attribute, 1365the subtree would be searched for any other records which also have a {{B:mail}} attribute 1366containing the same value presented with an {{B:add}}, {{B:modify}} or {{B:modrdn}} operation 1367which are unique within the configured scope. If any are found, the request is rejected. 1368 1369Note: If no attributes are specified, for example {{B:ldap:///??sub?}}, then the URI applies to all non-operational attributes. However, 1370the keyword {{B:ignore}} can be specified to exclude certain non-operational attributes. 1371 1372To search at the base dn of the current backend database ensuring uniqueness of the {{B:mail}} 1373attribute, we simply add the following configuration: 1374 1375> overlay unique 1376> unique_uri ldap:///?mail?sub? 1377 1378For an existing entry of: 1379 1380> dn: cn=gavin,dc=suretecsystems,dc=com 1381> objectClass: top 1382> objectClass: inetorgperson 1383> cn: gavin 1384> sn: henry 1385> mail: ghenry@suretecsystems.com 1386 1387and we then try to add a new entry of: 1388 1389> dn: cn=robert,dc=suretecsystems,dc=com 1390> objectClass: top 1391> objectClass: inetorgperson 1392> cn: robert 1393> sn: jones 1394> mail: ghenry@suretecsystems.com 1395 1396would result in an error like so: 1397 1398> adding new entry "cn=robert,dc=example,dc=com" 1399> ldap_add: Constraint violation (19) 1400> additional info: some attributes not unique 1401 1402The overlay can have multiple URIs specified within a domain, allowing complex 1403selections of objects and also have multiple {{B:unique_uri}} statements or 1404{{B:olcUniqueURI}} attributes which will create independent domains. 1405 1406For more information and details about the {{B:strict}} and {{B:ignore}} keywords, 1407please see the {{:slapo-unique(5)}} man page. 1408 1409H3: Further Information 1410 1411{{:slapo-unique(5)}} 1412 1413 1414H2: Value Sorting 1415 1416 1417H3: Overview 1418 1419The Value Sorting overlay can be used with a backend database to sort the 1420values of specific multi-valued attributes within a subtree. The sorting occurs 1421whenever the attributes are returned in a search response. 1422 1423H3: Value Sorting Configuration 1424 1425Sorting can be specified in ascending or descending order, using either numeric 1426or alphanumeric sort methods. Additionally, a "weighted" sort can be specified, 1427 which uses a numeric weight prepended to the attribute values. 1428 1429The weighted sort is always performed in ascending order, but may be combined 1430with the other methods for values that all have equal weights. The weight is 1431specified by prepending an integer weight {<weight>} in front of each value 1432of the attribute for which weighted sorting is desired. This weighting factor 1433is stripped off and never returned in search results. 1434 1435Here are a few examples: 1436 1437> loglevel sync stats 1438> 1439> database mdb 1440> suffix "dc=suretecsystems,dc=com" 1441> directory /usr/local/var/openldap-data 1442> 1443> ...... 1444> 1445> overlay valsort 1446> valsort-attr memberUid ou=Groups,dc=suretecsystems,dc=com alpha-ascend 1447 1448For example, ascend: 1449 1450> # sharedemail, Groups, suretecsystems.com 1451> dn: cn=sharedemail,ou=Groups,dc=suretecsystems,dc=com 1452> objectClass: posixGroup 1453> objectClass: top 1454> cn: sharedemail 1455> gidNumber: 517 1456> memberUid: admin 1457> memberUid: dovecot 1458> memberUid: laura 1459> memberUid: suretec 1460 1461For weighted, we change our data to: 1462 1463> # sharedemail, Groups, suretecsystems.com 1464> dn: cn=sharedemail,ou=Groups,dc=suretecsystems,dc=com 1465> objectClass: posixGroup 1466> objectClass: top 1467> cn: sharedemail 1468> gidNumber: 517 1469> memberUid: {4}admin 1470> memberUid: {2}dovecot 1471> memberUid: {1}laura 1472> memberUid: {3}suretec 1473 1474and change the config to: 1475 1476> overlay valsort 1477> valsort-attr memberUid ou=Groups,dc=suretecsystems,dc=com weighted 1478 1479Searching now results in: 1480 1481> # sharedemail, Groups, OxObjects, suretecsystems.com 1482> dn: cn=sharedemail,ou=Groups,ou=OxObjects,dc=suretecsystems,dc=com 1483> objectClass: posixGroup 1484> objectClass: top 1485> cn: sharedemail 1486> gidNumber: 517 1487> memberUid: laura 1488> memberUid: dovecot 1489> memberUid: suretec 1490> memberUid: admin 1491 1492 1493H3: Further Information 1494 1495{{:slapo-valsort(5)}} 1496 1497 1498H2: Overlay Stacking 1499 1500 1501H3: Overview 1502 1503Overlays can be stacked, which means that more than one overlay 1504can be instantiated for each database, or for the {{EX:frontend}}. 1505As a consequence, each overlays function is called, if defined, 1506when overlay execution is invoked. 1507Multiple overlays are executed in reverse order (as a stack) 1508with respect to their definition in slapd.conf (5), or with respect 1509to their ordering in the config database, as documented in slapd-config (5). 1510 1511 1512H3: Example Scenarios 1513 1514 1515H4: Samba 1516