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