1# $OpenLDAP$ 2# Copyright 2005-2014 The OpenLDAP Foundation, All Rights Reserved. 3# COPYING RESTRICTIONS APPLY, see COPYRIGHT. 4 5H1: Configuring slapd 6 7Once the software has been built and installed, you are ready 8to configure {{slapd}}(8) for use at your site. 9 10OpenLDAP 2.3 and later have transitioned to using a dynamic runtime 11configuration engine, {{slapd-config}}(5). {{slapd-config}}(5) 12* is fully LDAP-enabled 13* is managed using the standard LDAP operations 14* stores its configuration data in an {{TERM:LDIF}} database, generally 15in the {{F:/usr/local/etc/openldap/slapd.d}} directory. 16* allows all of slapd's configuration options to be changed on the fly, 17generally without requiring a server restart for the changes 18to take effect. 19 20This chapter describes the general format of the {{slapd-config}}(5) 21configuration system, followed by a detailed description of commonly used 22settings. 23 24The older style {{slapd.conf}}(5) file is still supported, but its use 25is deprecated and support for it will be withdrawn in a future OpenLDAP 26release. Configuring {{slapd}}(8) via {{slapd.conf}}(5) is described in 27the next chapter. 28 29Refer to {{slapd}}(8) for information on how to have slapd automatically 30convert from {{slapd.conf}}(5) to {{slapd-config}}(5). 31 32 33Note: Although the {{slapd-config}}(5) system stores its configuration 34as (text-based) LDIF files, you should {{1:never}} edit any of 35the LDIF files directly. Configuration changes should be performed via LDAP 36operations, e.g. {{ldapadd}}(1), {{ldapdelete}}(1), or {{ldapmodify}}(1). 37 38 39Note: You will need to continue to use the older {{slapd.conf}}(5) 40configuration system if your OpenLDAP installation requires the use of one 41or more backends or overlays that have not been updated to use the 42{{slapd-config}}(5) system. As of OpenLDAP 2.4.33, all of the official 43backends have been updated. There may be additional contributed or experimental 44overlays that also have not been updated. 45 46 47H2: Configuration Layout 48 49The slapd configuration is stored as a special LDAP directory with 50a predefined schema and DIT. There are specific objectClasses used to 51carry global configuration options, schema definitions, backend and 52database definitions, and assorted other items. A sample config tree 53is shown in Figure 5.1. 54 55!import "config_dit.png"; align="center"; title="Sample configuration tree" 56FT[align="Center"] Figure 5.1: Sample configuration tree. 57 58Other objects may be part of the configuration but were omitted from 59the illustration for clarity. 60 61The {{slapd-config}} configuration tree has a very specific structure. The 62root of the tree is named {{EX:cn=config}} and contains global configuration 63settings. Additional settings are contained in separate child entries: 64* Dynamically loaded modules 65.. These may only be used if the {{EX:--enable-modules}} option was 66used to configure the software. 67* Schema definitions 68.. The {{EX:cn=schema,cn=config}} entry contains the system schema (all 69the schema that is hard-coded in slapd). 70.. Child entries of {{EX:cn=schema,cn=config}} contain user schema as 71loaded from config files or added at runtime. 72* Backend-specific configuration 73* Database-specific configuration 74.. Overlays are defined in children of the Database entry. 75.. Databases and Overlays may also have other miscellaneous children. 76 77The usual rules for LDIF files apply to the configuration information: 78Comment lines beginning with a '{{EX:#}}' character 79are ignored. If a line begins with a single space, it is considered a 80continuation of the previous line (even if the previous line is a 81comment) and the single leading space is removed. Entries are separated by blank lines. 82 83The general layout of the config LDIF is as follows: 84 85> # global configuration settings 86> dn: cn=config 87> objectClass: olcGlobal 88> cn: config 89> <global config settings> 90> 91> # schema definitions 92> dn: cn=schema,cn=config 93> objectClass: olcSchemaConfig 94> cn: schema 95> <system schema> 96> 97> dn: cn={X}core,cn=schema,cn=config 98> objectClass: olcSchemaConfig 99> cn: {X}core 100> <core schema> 101> 102> # additional user-specified schema 103> ... 104> 105> # backend definitions 106> dn: olcBackend=<typeA>,cn=config 107> objectClass: olcBackendConfig 108> olcBackend: <typeA> 109> <backend-specific settings> 110> 111> # database definitions 112> dn: olcDatabase={X}<typeA>,cn=config 113> objectClass: olcDatabaseConfig 114> olcDatabase: {X}<typeA> 115> <database-specific settings> 116> 117> # subsequent definitions and settings 118> ... 119 120Some of the entries listed above have a numeric index {{EX:"{X}"}} in 121their names. While most configuration settings have an inherent ordering 122dependency (i.e., one setting must take effect before a subsequent one 123may be set), LDAP databases are inherently unordered. The numeric index 124is used to enforce a consistent ordering in the configuration database, 125so that all ordering dependencies are preserved. In most cases the index 126does not have to be provided; it will be automatically generated based 127on the order in which entries are created. 128 129Configuration directives are specified as values of individual 130attributes. 131Most of the attributes and objectClasses used in the slapd 132configuration have a prefix of {{EX:"olc"}} (OpenLDAP Configuration) 133in their names. Generally there is a one-to-one correspondence 134between the attributes and the old-style {{EX:slapd.conf}} configuration 135keywords, using the keyword as the attribute name, with the "olc" 136prefix attached. 137 138A configuration directive may take arguments. If so, the arguments are 139separated by whitespace. If an argument contains whitespace, 140the argument should be enclosed in double quotes {{EX:"like this"}}. 141In the descriptions that follow, arguments that should be replaced 142by actual text are shown in brackets {{EX:<>}}. 143 144The distribution contains an example configuration file that will 145be installed in the {{F: /usr/local/etc/openldap}} directory. 146A number of files containing schema definitions (attribute types 147and object classes) are also provided in the 148{{F: /usr/local/etc/openldap/schema}} directory. 149 150 151H2: Configuration Directives 152 153This section details commonly used configuration directives. For 154a complete list, see the {{slapd-config}}(5) manual page. This section 155will treat the configuration directives in a top-down order, starting 156with the global directives in the {{EX:cn=config}} entry. Each 157directive will be described along with its default value (if any) and 158an example of its use. 159 160 161H3: cn=config 162 163Directives contained in this entry generally apply to the server as a whole. 164Most of them are system or connection oriented, not database related. This 165entry must have the {{EX:olcGlobal}} objectClass. 166 167 168H4: olcIdleTimeout: <integer> 169 170Specify the number of seconds to wait before forcibly closing 171an idle client connection. A value of 0, the default, 172disables this feature. 173 174 175H4: olcLogLevel: <level> 176 177This directive specifies the level at which debugging statements 178and operation statistics should be syslogged (currently logged to 179the {{syslogd}}(8) {{EX:LOG_LOCAL4}} facility). You must have 180configured OpenLDAP {{EX:--enable-debug}} (the default) for this 181to work (except for the two statistics levels, which are always 182enabled). Log levels may be specified as integers or by keyword. 183Multiple log levels may be used and the levels are additive. 184To display what levels 185correspond to what kind of debugging, invoke slapd with {{EX:-d?}} 186or consult the table below. The possible values for <level> are: 187 188!block table; colaligns="RL"; align=Center; \ 189 title="Table 5.1: Debugging Levels" 190Level Keyword Description 191-1 any enable all debugging 1920 no debugging 1931 (0x1 trace) trace function calls 1942 (0x2 packets) debug packet handling 1954 (0x4 args) heavy trace debugging 1968 (0x8 conns) connection management 19716 (0x10 BER) print out packets sent and received 19832 (0x20 filter) search filter processing 19964 (0x40 config) configuration processing 200128 (0x80 ACL) access control list processing 201256 (0x100 stats) stats log connections/operations/results 202512 (0x200 stats2) stats log entries sent 2031024 (0x400 shell) print communication with shell backends 2042048 (0x800 parse) print entry parsing debugging 20516384 (0x4000 sync) syncrepl consumer processing 20632768 (0x8000 none) only messages that get logged whatever log level is set 207!endblock 208 209The desired log level can be input as a single integer that 210combines the (ORed) desired levels, both in decimal or in hexadecimal 211notation, as a list of integers (that are ORed internally), or as a list of the names that are shown between brackets, such that 212 213> olcLogLevel 129 214> olcLogLevel 0x81 215> olcLogLevel 128 1 216> olcLogLevel 0x80 0x1 217> olcLogLevel acl trace 218 219are equivalent. 220 221\Examples: 222 223E: olcLogLevel -1 224 225This will cause lots and lots of debugging information to be 226logged. 227 228E: olcLogLevel conns filter 229 230Just log the connection and search filter processing. 231 232E: olcLogLevel none 233 234Log those messages that are logged regardless of the configured loglevel. This 235differs from setting the log level to 0, when no logging occurs. At least the 236{{EX:None}} level is required to have high priority messages logged. 237 238\Default: 239 240E: olcLogLevel stats 241 242Basic stats logging is configured by default. However, if no olcLogLevel is 243defined, no logging occurs (equivalent to a 0 level). 244 245 246H4: olcReferral <URI> 247 248This directive specifies the referral to pass back when slapd 249cannot find a local database to handle a request. 250 251\Example: 252 253> olcReferral: ldap://root.openldap.org 254 255This will refer non-local queries to the global root LDAP server 256at the OpenLDAP Project. Smart LDAP clients can re-ask their 257query at that server, but note that most of these clients are 258only going to know how to handle simple LDAP URLs that 259contain a host part and optionally a distinguished name part. 260 261 262H4: Sample Entry 263 264>dn: cn=config 265>objectClass: olcGlobal 266>cn: config 267>olcIdleTimeout: 30 268>olcLogLevel: Stats 269>olcReferral: ldap://root.openldap.org 270 271 272H3: cn=module 273 274If support for dynamically loaded modules was enabled when configuring 275slapd, {{EX:cn=module}} entries may be used to specify sets of modules to load. 276Module entries must have the {{EX:olcModuleList}} objectClass. 277 278 279H4: olcModuleLoad: <filename> 280 281Specify the name of a dynamically loadable module to load. The filename 282may be an absolute path name or a simple filename. Non-absolute names 283are searched for in the directories specified by the {{EX:olcModulePath}} 284directive. 285 286 287H4: olcModulePath: <pathspec> 288 289Specify a list of directories to search for loadable modules. Typically the 290path is colon-separated but this depends on the operating system. 291 292 293H4: Sample Entries 294 295>dn: cn=module{0},cn=config 296>objectClass: olcModuleList 297>cn: module{0} 298>olcModuleLoad: /usr/local/lib/smbk5pwd.la 299> 300>dn: cn=module{1},cn=config 301>objectClass: olcModuleList 302>cn: module{1} 303>olcModulePath: /usr/local/lib:/usr/local/lib/slapd 304>olcModuleLoad: accesslog.la 305>olcModuleLoad: pcache.la 306 307 308H3: cn=schema 309 310The cn=schema entry holds all of the schema definitions that are hard-coded 311in slapd. As such, the values in this entry are generated by slapd so no 312schema values need to be provided in the config file. The entry must still 313be defined though, to serve as a base for the user-defined schema to add 314in underneath. Schema entries must have the {{EX:olcSchemaConfig}} 315objectClass. 316 317 318H4: olcAttributeTypes: <{{REF:RFC4512}} Attribute Type Description> 319 320This directive defines an attribute type. 321Please see the {{SECT:Schema Specification}} chapter 322for information regarding how to use this directive. 323 324 325H4: olcObjectClasses: <{{REF:RFC4512}} Object Class Description> 326 327This directive defines an object class. 328Please see the {{SECT:Schema Specification}} chapter for 329information regarding how to use this directive. 330 331 332H4: Sample Entries 333 334>dn: cn=schema,cn=config 335>objectClass: olcSchemaConfig 336>cn: schema 337> 338>dn: cn=test,cn=schema,cn=config 339>objectClass: olcSchemaConfig 340>cn: test 341>olcAttributeTypes: ( 1.1.1 342> NAME 'testAttr' 343> EQUALITY integerMatch 344> SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ) 345>olcAttributeTypes: ( 1.1.2 NAME 'testTwo' EQUALITY caseIgnoreMatch 346> SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.44 ) 347>olcObjectClasses: ( 1.1.3 NAME 'testObject' 348> MAY ( testAttr $ testTwo ) AUXILIARY ) 349 350 351H3: Backend-specific Directives 352 353Backend directives apply to all database instances of the 354same type and, depending on the directive, may be overridden 355by database directives. Backend entries must have the 356{{EX:olcBackendConfig}} objectClass. 357 358H4: olcBackend: <type> 359 360This directive names a backend-specific configuration entry. 361{{EX:<type>}} should be one of the 362supported backend types listed in Table 5.2. 363 364!block table; align=Center; coltags="EX,N"; \ 365 title="Table 5.2: Database Backends" 366Types Description 367bdb Berkeley DB transactional backend 368config Slapd configuration backend 369dnssrv DNS SRV backend 370hdb Hierarchical variant of bdb backend 371ldap Lightweight Directory Access Protocol (Proxy) backend 372ldif Lightweight Data Interchange Format backend 373meta Meta Directory backend 374monitor Monitor backend 375passwd Provides read-only access to {{passwd}}(5) 376perl Perl Programmable backend 377shell Shell (extern program) backend 378sql SQL Programmable backend 379!endblock 380 381\Example: 382 383> olcBackend: bdb 384 385There are no other directives defined for this entry. Specific backend 386types may define additional attributes for their particular use but so 387far none have ever been defined. As such, these directives usually do 388not appear in any actual configurations. 389 390 391H4: Sample Entry 392 393> dn: olcBackend=bdb,cn=config 394> objectClass: olcBackendConfig 395> olcBackend: bdb 396 397 398H3: Database-specific Directives 399 400Directives in this section are supported by every type of database. 401Database entries must have the {{EX:olcDatabaseConfig}} objectClass. 402 403H4: olcDatabase: [{<index>}]<type> 404 405This directive names a specific database instance. The numeric {<index>} may 406be provided to distinguish multiple databases of the same type. Usually the 407index can be omitted, and slapd will generate it automatically. 408{{EX:<type>}} should be one of the 409supported backend types listed in Table 5.2 or the {{EX:frontend}} type. 410 411The {{EX:frontend}} is a special database that is used to hold 412database-level options that should be applied to all the other 413databases. Subsequent database definitions may also override some 414frontend settings. 415 416The {{EX:config}} database is also special; both the {{EX:config}} and 417the {{EX:frontend}} databases are always created implicitly even if they 418are not explicitly configured, and they are created before any other 419databases. 420 421\Example: 422 423> olcDatabase: bdb 424 425This marks the beginning of a new {{TERM:BDB}} database instance. 426 427 428H4: olcAccess: to <what> [ by <who> [<accesslevel>] [<control>] ]+ 429 430This directive grants access (specified by <accesslevel>) to a 431set of entries and/or attributes (specified by <what>) by one or 432more requestors (specified by <who>). 433See the {{SECT:Access Control}} section of this guide for basic usage. 434 435!if 0 436More detailed discussion of this directive can be found in the 437{{SECT:Advanced Access Control}} chapter. 438!endif 439 440Note: If no {{EX:olcAccess}} directives are specified, the default 441access control policy, {{EX:to * by * read}}, allows all 442users (both authenticated and anonymous) read access. 443 444Note: Access controls defined in the frontend are appended to all 445other databases' controls. 446 447 448H4: olcReadonly { TRUE | FALSE } 449 450This directive puts the database into "read-only" mode. Any 451attempts to modify the database will return an "unwilling to 452perform" error. 453 454\Default: 455 456> olcReadonly: FALSE 457 458 459H4: olcRootDN: <DN> 460 461This directive specifies the DN that is not subject to 462access control or administrative limit restrictions for 463operations on this database. The DN need not refer to 464an entry in this database or even in the directory. The 465DN may refer to a SASL identity. 466 467Entry-based Example: 468 469> olcRootDN: "cn=Manager,dc=example,dc=com" 470 471SASL-based Example: 472 473> olcRootDN: "uid=root,cn=example.com,cn=digest-md5,cn=auth" 474 475See the {{SECT:SASL Authentication}} section for information on 476SASL authentication identities. 477 478 479H4: olcRootPW: <password> 480 481This directive can be used to specify a password for the DN for 482the rootdn (when the rootdn is set to a DN within the database). 483 484\Example: 485 486> olcRootPW: secret 487 488It is also permissible to provide a hash of the password in 489{{REF:RFC2307}} form. {{slappasswd}}(8) may be used to generate 490the password hash. 491 492\Example: 493 494> olcRootPW: {SSHA}ZKKuqbEKJfKSXhUbHG3fG8MDn9j1v4QN 495 496The hash was generated using the command {{EX:slappasswd -s secret}}. 497 498 499H4: olcSizeLimit: <integer> 500 501This directive specifies the maximum number of entries to return 502from a search operation. 503 504\Default: 505 506> olcSizeLimit: 500 507 508See the {{SECT:Limits}} section of this guide and slapd-config(5) 509for more details. 510 511 512H4: olcSuffix: <dn suffix> 513 514This directive specifies the DN suffix of queries that will be 515passed to this backend database. Multiple suffix lines can be 516given, and usually at least one is required for each database 517definition. (Some backend types, such as {{EX:frontend}} and 518{{EX:monitor}} use a hard-coded suffix which may not be overridden 519in the configuration.) 520 521\Example: 522 523> olcSuffix: "dc=example,dc=com" 524 525Queries with a DN ending in "dc=example,dc=com" 526will be passed to this backend. 527 528Note: When the backend to pass a query to is selected, slapd 529looks at the suffix value(s) in each database definition in the 530order in which they were configured. Thus, if one database suffix is a 531prefix of another, it must appear after it in the configuration. 532 533 534H4: olcSyncrepl 535 536> olcSyncrepl: rid=<replica ID> 537> provider=ldap[s]://<hostname>[:port] 538> [type=refreshOnly|refreshAndPersist] 539> [interval=dd:hh:mm:ss] 540> [retry=[<retry interval> <# of retries>]+] 541> searchbase=<base DN> 542> [filter=<filter str>] 543> [scope=sub|one|base] 544> [attrs=<attr list>] 545> [attrsonly] 546> [sizelimit=<limit>] 547> [timelimit=<limit>] 548> [schemachecking=on|off] 549> [bindmethod=simple|sasl] 550> [binddn=<DN>] 551> [saslmech=<mech>] 552> [authcid=<identity>] 553> [authzid=<identity>] 554> [credentials=<passwd>] 555> [realm=<realm>] 556> [secprops=<properties>] 557> [starttls=yes|critical] 558> [tls_cert=<file>] 559> [tls_key=<file>] 560> [tls_cacert=<file>] 561> [tls_cacertdir=<path>] 562> [tls_reqcert=never|allow|try|demand] 563> [tls_ciphersuite=<ciphers>] 564> [tls_crlcheck=none|peer|all] 565> [logbase=<base DN>] 566> [logfilter=<filter str>] 567> [syncdata=default|accesslog|changelog] 568 569 570This directive specifies the current database as a replica of the 571master content by establishing the current {{slapd}}(8) as a 572replication consumer site running a syncrepl replication engine. 573The master database is located at the replication provider site 574specified by the {{EX:provider}} parameter. The replica database is 575kept up-to-date with the master content using the LDAP Content 576Synchronization protocol. See {{REF:RFC4533}} 577for more information on the protocol. 578 579The {{EX:rid}} parameter is used for identification of the current 580{{EX:syncrepl}} directive within the replication consumer server, 581where {{EX:<replica ID>}} uniquely identifies the syncrepl specification 582described by the current {{EX:syncrepl}} directive. {{EX:<replica ID>}} 583is non-negative and is no more than three decimal digits in length. 584 585The {{EX:provider}} parameter specifies the replication provider site 586containing the master content as an LDAP URI. The {{EX:provider}} 587parameter specifies a scheme, a host and optionally a port where the 588provider slapd instance can be found. Either a domain name or IP 589address may be used for <hostname>. Examples are 590{{EX:ldap://provider.example.com:389}} or {{EX:ldaps://192.168.1.1:636}}. 591If <port> is not given, the standard LDAP port number (389 or 636) is used. 592Note that the syncrepl uses a consumer-initiated protocol, and hence its 593specification is located at the consumer site, whereas the {{EX:replica}} 594specification is located at the provider site. {{EX:syncrepl}} and 595{{EX:replica}} directives define two independent replication 596mechanisms. They do not represent the replication peers of each other. 597 598The content of the syncrepl replica is defined using a search 599specification as its result set. The consumer slapd will 600send search requests to the provider slapd according to the search 601specification. The search specification includes {{EX:searchbase}}, 602{{EX:scope}}, {{EX:filter}}, {{EX:attrs}}, {{EX:attrsonly}}, 603{{EX:sizelimit}}, and {{EX:timelimit}} parameters as in the normal 604search specification. The {{EX:searchbase}} parameter has no 605default value and must always be specified. The {{EX:scope}} defaults 606to {{EX:sub}}, the {{EX:filter}} defaults to {{EX:(objectclass=*)}}, 607{{EX:attrs}} defaults to {{EX:"*,+"}} to replicate all user and operational 608attributes, and {{EX:attrsonly}} is unset by default. Both {{EX:sizelimit}} 609and {{EX:timelimit}} default to "unlimited", and only positive integers 610or "unlimited" may be specified. 611 612The {{TERM[expand]LDAP Sync}} protocol has two operation 613types: {{EX:refreshOnly}} and {{EX:refreshAndPersist}}. 614The operation type is specified by the {{EX:type}} parameter. 615In the {{EX:refreshOnly}} operation, the next synchronization search operation 616is periodically rescheduled at an interval time after each 617synchronization operation finishes. The interval is specified 618by the {{EX:interval}} parameter. It is set to one day by default. 619In the {{EX:refreshAndPersist}} operation, a synchronization search 620remains persistent in the provider {{slapd}} instance. Further updates to the 621master replica will generate {{EX:searchResultEntry}} to the consumer slapd 622as the search responses to the persistent synchronization search. 623 624If an error occurs during replication, the consumer will attempt to reconnect 625according to the retry parameter which is a list of the <retry interval> 626and <# of retries> pairs. For example, retry="60 10 300 3" lets the consumer 627retry every 60 seconds for the first 10 times and then retry every 300 seconds 628for the next three times before stop retrying. + in <# of retries> means 629indefinite number of retries until success. 630 631The schema checking can be enforced at the LDAP Sync consumer site 632by turning on the {{EX:schemachecking}} parameter. 633If it is turned on, every replicated entry will be checked for its 634schema as the entry is stored into the replica content. 635Every entry in the replica should contain those attributes 636required by the schema definition. 637If it is turned off, entries will be stored without checking 638schema conformance. The default is off. 639 640The {{EX:binddn}} parameter gives the DN to bind as for the 641syncrepl searches to the provider slapd. It should be a DN 642which has read access to the replication content in the 643master database. 644 645The {{EX:bindmethod}} is {{EX:simple}} or {{EX:sasl}}, 646depending on whether simple password-based authentication or 647{{TERM:SASL}} authentication is to be used when connecting 648to the provider {{slapd}} instance. 649 650Simple authentication should not be used unless adequate data 651integrity and confidentiality protections are in place (e.g. TLS 652or IPsec). Simple authentication requires specification of {{EX:binddn}} 653and {{EX:credentials}} parameters. 654 655SASL authentication is generally recommended. SASL authentication 656requires specification of a mechanism using the {{EX:saslmech}} parameter. 657Depending on the mechanism, an authentication identity and/or 658credentials can be specified using {{EX:authcid}} and {{EX:credentials}}, 659respectively. The {{EX:authzid}} parameter may be used to specify 660an authorization identity. 661 662The {{EX:realm}} parameter specifies a realm which a certain 663mechanisms authenticate the identity within. The {{EX:secprops}} 664parameter specifies Cyrus SASL security properties. 665 666The {{EX:starttls}} parameter specifies use of the StartTLS extended 667operation to establish a TLS session before authenticating to the provider. 668If the {{EX:critical}} argument is supplied, the session will be aborted 669if the StartTLS request fails. Otherwise the syncrepl session continues 670without TLS. Note that the main slapd TLS settings are not used by the 671syncrepl engine; by default the TLS parameters from a {{ldap.conf}}(5) 672configuration file will be used. TLS settings may be specified here, 673in which case any {{ldap.conf}}(5) settings will be completely ignored. 674 675Rather than replicating whole entries, the consumer can query logs 676of data modifications. This mode of operation is referred to as 677{{delta syncrepl}}. In addition to the above parameters, the 678{{EX:logbase}} and {{EX:logfilter}} parameters must be set appropriately 679for the log that will be used. The {{EX:syncdata}} parameter must 680be set to either {{EX:"accesslog"}} if the log conforms to the 681{{slapo-accesslog}}(5) log format, or {{EX:"changelog"}} if the log 682conforms to the obsolete {{changelog}} format. If the {{EX:syncdata}} 683parameter is omitted or set to {{EX:"default"}} then the log 684parameters are ignored. 685 686The {{syncrepl}} replication mechanism is supported by the {{bdb}} and 687{{hdb}} backends. 688 689See the {{SECT:LDAP Sync Replication}} chapter of this guide for 690more information on how to use this directive. 691 692 693H4: olcTimeLimit: <integer> 694 695This directive specifies the maximum number of seconds (in real 696time) slapd will spend answering a search request. If a 697request is not finished in this time, a result indicating an 698exceeded timelimit will be returned. 699 700\Default: 701 702> olcTimeLimit: 3600 703 704See the {{SECT:Limits}} section of this guide and slapd-config(5) 705for more details. 706 707 708H4: olcUpdateref: <URL> 709 710This directive is only applicable in a slave slapd. It 711specifies the URL to return to clients which submit update 712requests upon the replica. 713If specified multiple times, each {{TERM:URL}} is provided. 714 715\Example: 716 717> olcUpdateref: ldap://master.example.net 718 719 720H4: Sample Entries 721 722>dn: olcDatabase=frontend,cn=config 723>objectClass: olcDatabaseConfig 724>objectClass: olcFrontendConfig 725>olcDatabase: frontend 726>olcReadOnly: FALSE 727> 728>dn: olcDatabase=config,cn=config 729>objectClass: olcDatabaseConfig 730>olcDatabase: config 731>olcRootDN: cn=Manager,dc=example,dc=com 732 733 734H3: BDB and HDB Database Directives 735 736Directives in this category apply to both the {{TERM:BDB}} 737and the {{TERM:HDB}} database. 738They are used in an olcDatabase entry in addition to the generic 739database directives defined above. For a complete reference 740of BDB/HDB configuration directives, see {{slapd-bdb}}(5). In 741addition to the {{EX:olcDatabaseConfig}} objectClass, BDB and HDB 742database entries must have the {{EX:olcBdbConfig}} and 743{{EX:olcHdbConfig}} objectClass, respectively. 744 745 746H4: olcDbDirectory: <directory> 747 748This directive specifies the directory where the BDB files 749containing the database and associated indices live. 750 751\Default: 752 753> olcDbDirectory: /usr/local/var/openldap-data 754 755 756H4: olcDbCachesize: <integer> 757 758This directive specifies the size in entries of the in-memory 759cache maintained by the BDB backend database instance. 760 761\Default: 762 763> olcDbCachesize: 1000 764 765 766H4: olcDbCheckpoint: <kbyte> <min> 767 768This directive specifies how often to checkpoint the BDB transaction log. 769A checkpoint operation flushes the database buffers to disk and writes a 770checkpoint record in the log. 771The checkpoint will occur if either <kbyte> data has been written or 772<min> minutes have passed since the last checkpoint. Both arguments default 773to zero, in which case they are ignored. When the <min> argument is 774non-zero, an internal task will run every <min> minutes to perform the 775checkpoint. See the Berkeley DB reference guide for more details. 776 777\Example: 778 779> olcDbCheckpoint: 1024 10 780 781 782H4: olcDbConfig: <DB_CONFIG setting> 783 784This attribute specifies a configuration directive to be placed in the 785{{EX:DB_CONFIG}} file of the database directory. At server startup time, if 786no such file exists yet, the {{EX:DB_CONFIG}} file will be created and the 787settings in this attribute will be written to it. If the file exists, 788its contents will be read and displayed in this attribute. The attribute 789is multi-valued, to accommodate multiple configuration directives. No default 790is provided, but it is essential to use proper settings here to get the 791best server performance. 792 793Any changes made to this attribute will be written to the {{EX:DB_CONFIG}} 794file and will cause the database environment to be reset so the changes 795can take immediate effect. If the environment cache is large and has not 796been recently checkpointed, this reset operation may take a long time. It 797may be advisable to manually perform a single checkpoint using the Berkeley DB 798{{db_checkpoint}} utility before using LDAP Modify to change this 799attribute. 800 801\Example: 802 803> olcDbConfig: set_cachesize 0 10485760 0 804> olcDbConfig: set_lg_bsize 2097512 805> olcDbConfig: set_lg_dir /var/tmp/bdb-log 806> olcDbConfig: set_flags DB_LOG_AUTOREMOVE 807 808In this example, the BDB cache is set to 10MB, the BDB transaction log 809buffer size is set to 2MB, and the transaction log files are to be stored 810in the /var/tmp/bdb-log directory. Also a flag is set to tell BDB to 811delete transaction log files as soon as their contents have been 812checkpointed and they are no longer needed. Without this setting the 813transaction log files will continue to accumulate until some other 814cleanup procedure removes them. See the Berkeley DB documentation for the 815{{EX:db_archive}} command for details. For a complete list of Berkeley DB 816flags please see - {{URL:http://www.oracle.com/technology/documentation/berkeley-db/db/api_c/env_set_flags.html}} 817 818Ideally the BDB cache must be 819at least as large as the working set of the database, the log buffer size 820should be large enough to accommodate most transactions without overflowing, 821and the log directory must be on a separate physical disk from the main 822database files. And both the database directory and the log directory 823should be separate from disks used for regular system activities such as 824the root, boot, or swap filesystems. See the FAQ-o-Matic and the Berkeley DB 825documentation for more details. 826 827 828H4: olcDbNosync: { TRUE | FALSE } 829 830This option causes on-disk database contents to not be immediately 831synchronized with in memory changes upon change. Setting this option 832to {{EX:TRUE}} may improve performance at the expense of data integrity. This 833directive has the same effect as using 834> olcDbConfig: set_flags DB_TXN_NOSYNC 835 836 837H4: olcDbIDLcacheSize: <integer> 838 839Specify the size of the in-memory index cache, in index slots. The 840default is zero. A larger value will speed up frequent searches of 841indexed entries. The optimal size will depend on the data and search 842characteristics of the database, but using a number three times 843the entry cache size is a good starting point. 844 845\Example: 846 847> olcDbIDLcacheSize: 3000 848 849 850H4: olcDbIndex: {<attrlist> | default} [pres,eq,approx,sub,none] 851 852This directive specifies the indices to maintain for the given 853attribute. If only an {{EX:<attrlist>}} is given, the default 854indices are maintained. The index keywords correspond to the 855common types of matches that may be used in an LDAP search filter. 856 857\Example: 858 859> olcDbIndex: default pres,eq 860> olcDbIndex: uid 861> olcDbIndex: cn,sn pres,eq,sub 862> olcDbIndex: objectClass eq 863 864The first line sets the default set of indices to maintain to 865present and equality. The second line causes the default (pres,eq) 866set of indices to be maintained for the {{EX:uid}} attribute type. 867The third line causes present, equality, and substring indices to 868be maintained for {{EX:cn}} and {{EX:sn}} attribute types. The 869fourth line causes an equality index for the {{EX:objectClass}} 870attribute type. 871 872There is no index keyword for inequality matches. Generally these 873matches do not use an index. However, some attributes do support 874indexing for inequality matches, based on the equality index. 875 876A substring index can be more explicitly specified as {{EX:subinitial}}, 877{{EX:subany}}, or {{EX:subfinal}}, corresponding to the three 878possible components 879of a substring match filter. A subinitial index only indexes 880substrings that appear at the beginning of an attribute value. 881A subfinal index only indexes substrings that appear at the end 882of an attribute value, while subany indexes substrings that occur 883anywhere in a value. 884 885Note that by default, setting an index for an attribute also 886affects every subtype of that attribute. E.g., setting an equality 887index on the {{EX:name}} attribute causes {{EX:cn}}, {{EX:sn}}, and every other 888attribute that inherits from {{EX:name}} to be indexed. 889 890By default, no indices are maintained. It is generally advised 891that minimally an equality index upon objectClass be maintained. 892 893> olcDbindex: objectClass eq 894 895Additional indices should be configured corresponding to the 896most common searches that are used on the database. 897Presence indexing should not be configured for an attribute 898unless the attribute occurs very rarely in the database, and 899presence searches on the attribute occur very frequently during 900normal use of the directory. Most applications don't use presence 901searches, so usually presence indexing is not very useful. 902 903If this setting is changed while slapd is running, an internal task 904will be run to generate the changed index data. All server operations 905can continue as normal while the indexer does its work. If slapd is 906stopped before the index task completes, indexing will have to be 907manually completed using the slapindex tool. 908 909 910H4: olcDbLinearIndex: { TRUE | FALSE } 911 912If this setting is {{EX:TRUE}} slapindex will index one attribute 913at a time. The default settings is {{EX:FALSE}} in which case all 914indexed attributes of an entry are processed at the same time. When 915enabled, each indexed attribute is processed individually, using 916multiple passes through the entire database. This option improves 917slapindex performance when the database size exceeds the BDB cache 918size. When the BDB cache is large enough, this option is not needed 919and will decrease performance. Also by default, slapadd performs 920full indexing and so a separate slapindex run is not needed. With 921this option, slapadd does no indexing and slapindex must be used. 922 923 924H4: olcDbMode: { <octal> | <symbolic> } 925 926This directive specifies the file protection mode that newly 927created database index files should have. This can be in the form 928{{EX:0600}} or {{EX:-rw-------}} 929 930\Default: 931 932> olcDbMode: 0600 933 934 935H4: olcDbSearchStack: <integer> 936 937Specify the depth of the stack used for search filter evaluation. 938Search filters are evaluated on a stack to accommodate nested {{EX:AND}} / 939{{EX:OR}} clauses. An individual stack is allocated for each server thread. 940The depth of the stack determines how complex a filter can be evaluated 941without requiring any additional memory allocation. Filters that are 942nested deeper than the search stack depth will cause a separate stack to 943be allocated for that particular search operation. These separate allocations 944can have a major negative impact on server performance, but specifying 945too much stack will also consume a great deal of memory. Each search 946uses 512K bytes per level on a 32-bit machine, or 1024K bytes per level 947on a 64-bit machine. The default stack depth is 16, thus 8MB or 16MB 948per thread is used on 32 and 64 bit machines, respectively. Also the 949512KB size of a single stack slot is set by a compile-time constant which 950may be changed if needed; the code must be recompiled for the change 951to take effect. 952 953\Default: 954 955> olcDbSearchStack: 16 956 957 958H4: olcDbShmKey: <integer> 959 960Specify a key for a shared memory BDB environment. By default the BDB 961environment uses memory mapped files. If a non-zero value is specified, 962it will be used as the key to identify a shared memory region that will 963house the environment. 964 965\Example: 966 967> olcDbShmKey: 42 968 969 970H4: Sample Entry 971 972>dn: olcDatabase=hdb,cn=config 973>objectClass: olcDatabaseConfig 974>objectClass: olcHdbConfig 975>olcDatabase: hdb 976>olcSuffix: "dc=example,dc=com" 977>olcDbDirectory: /usr/local/var/openldap-data 978>olcDbCacheSize: 1000 979>olcDbCheckpoint: 1024 10 980>olcDbConfig: set_cachesize 0 10485760 0 981>olcDbConfig: set_lg_bsize 2097152 982>olcDbConfig: set_lg_dir /var/tmp/bdb-log 983>olcDbConfig: set_flags DB_LOG_AUTOREMOVE 984>olcDbIDLcacheSize: 3000 985>olcDbIndex: objectClass eq 986 987 988H2: Configuration Example 989 990The following is an example configuration, interspersed 991with explanatory text. It defines two databases to handle 992different parts of the {{TERM:X.500}} tree; both are {{TERM:BDB}} 993database instances. The line numbers shown are provided for 994reference only and are not included in the actual file. First, the 995global configuration section: 996 997E: 1. # example config file - global configuration entry 998E: 2. dn: cn=config 999E: 3. objectClass: olcGlobal 1000E: 4. cn: config 1001E: 5. olcReferral: ldap://root.openldap.org 1002E: 6. 1003 1004Line 1 is a comment. Lines 2-4 identify this as the global 1005configuration entry. 1006The {{EX:olcReferral:}} directive on line 5 1007means that queries not local to one of the databases defined 1008below will be referred to the LDAP server running on the 1009standard port (389) at the host {{EX:root.openldap.org}}. 1010Line 6 is a blank line, indicating the end of this entry. 1011 1012E: 7. # internal schema 1013E: 8. dn: cn=schema,cn=config 1014E: 9. objectClass: olcSchemaConfig 1015E: 10. cn: schema 1016E: 11. 1017 1018Line 7 is a comment. Lines 8-10 identify this as the root of 1019the schema subtree. The actual schema definitions in this entry 1020are hardcoded into slapd so no additional attributes are specified here. 1021Line 11 is a blank line, indicating the end of this entry. 1022 1023E: 12. # include the core schema 1024E: 13. include: file:///usr/local/etc/openldap/schema/core.ldif 1025E: 14. 1026 1027Line 12 is a comment. Line 13 is an LDIF include directive which 1028accesses the {{core}} schema definitions in LDIF format. Line 14 1029is a blank line. 1030 1031Next comes the database definitions. The first database is the 1032special {{EX:frontend}} database whose settings are applied globally 1033to all the other databases. 1034 1035E: 15. # global database parameters 1036E: 16. dn: olcDatabase=frontend,cn=config 1037E: 17. objectClass: olcDatabaseConfig 1038E: 18. olcDatabase: frontend 1039E: 19. olcAccess: to * by * read 1040E: 20. 1041 1042Line 15 is a comment. Lines 16-18 identify this entry as the global 1043database entry. Line 19 is a global access control. It applies to all 1044entries (after any applicable database-specific access controls). 1045Line 20 is a blank line. 1046 1047The next entry defines the config backend. 1048 1049E: 21. # set a rootpw for the config database so we can bind. 1050E: 22. # deny access to everyone else. 1051E: 23. dn: olcDatabase=config,cn=config 1052E: 24. objectClass: olcDatabaseConfig 1053E: 25. olcDatabase: config 1054E: 26. olcRootPW: {SSHA}XKYnrjvGT3wZFQrDD5040US592LxsdLy 1055E: 27. olcAccess: to * by * none 1056E: 28. 1057 1058Lines 21-22 are comments. Lines 23-25 identify this entry as the config 1059database entry. Line 26 defines the {{super-user}} password for this 1060database. (The DN defaults to {{"cn=config"}}.) Line 27 denies all access 1061to this database, so only the super-user will be able to access it. (This 1062is already the default access on the config database. It is just listed 1063here for illustration, and to reiterate that unless a means to authenticate 1064as the super-user is explicitly configured, the config database will be 1065inaccessible.) 1066 1067Line 28 is a blank line. 1068 1069The next entry defines a BDB backend that will handle queries for things 1070in the "dc=example,dc=com" portion of the tree. Indices are to be maintained 1071for several attributes, and the {{EX:userPassword}} attribute is to be 1072protected from unauthorized access. 1073 1074E: 29. # BDB definition for example.com 1075E: 30. dn: olcDatabase=bdb,cn=config 1076E: 31. objectClass: olcDatabaseConfig 1077E: 32. objectClass: olcBdbConfig 1078E: 33. olcDatabase: bdb 1079E: 34. olcSuffix: dc=example,dc=com 1080E: 35. olcDbDirectory: /usr/local/var/openldap-data 1081E: 36. olcRootDN: cn=Manager,dc=example,dc=com 1082E: 37. olcRootPW: secret 1083E: 38. olcDbIndex: uid pres,eq 1084E: 39. olcDbIndex: cn,sn pres,eq,approx,sub 1085E: 40. olcDbIndex: objectClass eq 1086E: 41. olcAccess: to attrs=userPassword 1087E: 42. by self write 1088E: 43. by anonymous auth 1089E: 44. by dn.base="cn=Admin,dc=example,dc=com" write 1090E: 45. by * none 1091E: 46. olcAccess: to * 1092E: 47. by self write 1093E: 48. by dn.base="cn=Admin,dc=example,dc=com" write 1094E: 49. by * read 1095E: 50. 1096 1097Line 29 is a comment. Lines 30-33 identify this entry as a BDB database 1098configuration entry. Line 34 specifies the DN suffix 1099for queries to pass to this database. Line 35 specifies the directory 1100in which the database files will live. 1101 1102Lines 36 and 37 identify the database {{super-user}} entry and associated 1103password. This entry is not subject to access control or size or 1104time limit restrictions. 1105 1106Lines 38 through 40 indicate the indices to maintain for various 1107attributes. 1108 1109Lines 41 through 49 specify access control for entries in this 1110database. For all applicable entries, the {{EX:userPassword}} attribute is writable 1111by the entry itself and by the "admin" entry. It may be used for 1112authentication/authorization purposes, but is otherwise not readable. 1113All other attributes are writable by the entry and the "admin" 1114entry, but may be read by all users (authenticated or not). 1115 1116Line 50 is a blank line, indicating the end of this entry. 1117 1118The next entry defines another 1119BDB database. This one handles queries involving the 1120{{EX:dc=example,dc=net}} subtree but is managed by the same entity 1121as the first database. Note that without line 60, the read access 1122would be allowed due to the global access rule at line 19. 1123 1124E: 51. # BDB definition for example.net 1125E: 52. dn: olcDatabase=bdb,cn=config 1126E: 53. objectClass: olcDatabaseConfig 1127E: 54. objectClass: olcBdbConfig 1128E: 55. olcDatabase: bdb 1129E: 56. olcSuffix: "dc=example,dc=net" 1130E: 57. olcDbDirectory: /usr/local/var/openldap-data-net 1131E: 58. olcRootDN: "cn=Manager,dc=example,dc=com" 1132E: 59. olcDbIndex: objectClass eq 1133E: 60. olcAccess: to * by users read 1134 1135 1136H2: Converting old style {{slapd.conf}}(5) file to {{cn=config}} format 1137 1138Before converting to the {{cn=config}} format you should make sure that the 1139config backend is properly configured in your existing config file. While 1140the config backend is always present inside slapd, by default it is only 1141accessible by its rootDN, and there are no default credentials assigned 1142so unless you explicitly configure a means to authenticate to it, it will be 1143unusable. 1144 1145If you do not already have a {{EX:database config}} section, add something 1146like this to the end of {{EX:slapd.conf}} 1147 1148> database config 1149> rootpw VerySecret 1150 1151Note: Since the config backend can be used to load arbitrary code into the 1152slapd process, it is extremely important to carefully guard whatever 1153credentials are used to access it. Since simple passwords are vulnerable to 1154password guessing attacks, it is usually better to omit the rootpw and only 1155use SASL authentication for the config rootDN. 1156 1157An existing {{slapd.conf}}(5) file can be converted to the new format using 1158{{slaptest}}(8) or any of the slap tools: 1159 1160> slaptest -f /usr/local/etc/openldap/slapd.conf -F /usr/local/etc/openldap/slapd.d 1161 1162Test that you can access entries under {{EX:cn=config}} using the 1163default {{rootdn}} and the {{rootpw}} configured above: 1164 1165> ldapsearch -x -D cn=config -w VerySecret -b cn=config 1166 1167You can then discard the old {{slapd.conf}}(5) file. Make sure to launch 1168{{slapd}}(8) with the {{-F}} option to specify the configuration directory 1169if you are not using the default directory path. 1170 1171Note: When converting from the slapd.conf format to slapd.d format, any 1172included files will also be integrated into the resulting configuration 1173database. 1174