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