1# $OpenLDAP$ 2# Copyright 1999-2019 The OpenLDAP Foundation, All Rights Reserved. 3# COPYING RESTRICTIONS APPLY, see COPYRIGHT. 4 5H1: The slapd Configuration File 6 7This chapter describes configuring {{slapd}}(8) via the {{slapd.conf}}(5) 8configuration file. {{slapd.conf}}(5) has been deprecated and should 9only be used if your site requires one of the backends that hasn't yet 10been updated to work with the newer {{slapd-config}}(5) system. Configuring 11{{slapd}}(8) via {{slapd-config}}(5) is described in the previous chapter. 12 13The {{slapd.conf}}(5) file is normally installed in the 14{{EX:/usr/local/etc/openldap}} directory. An alternate configuration 15file location can be specified via a command-line option to {{slapd}}(8). 16 17 18H2: Configuration File Format 19 20The {{slapd.conf}}(5) file consists of three types of configuration 21information: global, backend specific, and database specific. Global 22information is specified first, followed by information associated 23with a particular backend type, which is then followed by information 24associated with a particular database instance. Global directives can 25be overridden in backend and/or database directives, and backend directives 26can be overridden by database directives. 27 28Blank lines and comment lines beginning with a '{{EX:#}}' character 29are ignored. If a line begins with whitespace, it is considered a 30continuation of the previous line (even if the previous line is a 31comment). 32 33The general format of slapd.conf is as follows: 34 35> # global configuration directives 36> <global config directives> 37> 38> # backend definition 39> backend <typeA> 40> <backend-specific directives> 41> 42> # first database definition & config directives 43> database <typeA> 44> <database-specific directives> 45> 46> # second database definition & config directives 47> database <typeB> 48> <database-specific directives> 49> 50> # second database definition & config directives 51> database <typeA> 52> <database-specific directives> 53> 54> # subsequent backend & database definitions & config directives 55> ... 56 57A configuration directive may take arguments. If so, they are 58separated by whitespace. If an argument contains whitespace, 59the argument should be enclosed in double quotes {{EX:"like this"}}. If 60an argument contains a double quote or a backslash character `{{EX:\}}', 61the character should be preceded by a backslash character `{{EX:\}}'. 62 63The distribution contains an example configuration file that will 64be installed in the {{F: /usr/local/etc/openldap}} directory. 65A number of files containing schema definitions (attribute types 66and object classes) are also provided in the 67{{F: /usr/local/etc/openldap/schema}} directory. 68 69 70H2: Configuration File Directives 71 72This section details commonly used configuration directives. For 73a complete list, see the {{slapd.conf}}(5) manual page. This section 74separates the configuration file directives into global, 75backend-specific and data-specific categories, describing each 76directive and its default value (if any), and giving an example of 77its use. 78 79 80 81H3: Global Directives 82 83Directives described in this section apply to all backends 84and databases unless specifically overridden in a backend or 85database definition. Arguments that should be replaced 86by actual text are shown in brackets {{EX:<>}}. 87 88 89H4: access to <what> [ by <who> [<accesslevel>] [<control>] ]+ 90 91This directive grants access (specified by <accesslevel>) to a set 92of entries and/or attributes (specified by <what>) by one or more 93requestors (specified by <who>). See the {{SECT:Access Control}} section of 94this guide for basic usage. 95 96!if 0 97More details discussion of this directive can be found in the 98{{SECT:Advanced Access Control}} chapter. 99!endif 100 101Note: If no {{EX:access}} directives are specified, the default 102access control policy, {{EX:access to * by * read}}, allows all 103both authenticated and anonymous users read access. 104 105 106H4: attributetype <{{REF:RFC4512}} Attribute Type Description> 107 108This directive defines an attribute type. 109Please see the {{SECT:Schema Specification}} chapter 110for information regarding how to use this directive. 111 112H4: idletimeout <integer> 113 114Specify the number of seconds to wait before forcibly closing 115an idle client connection. An idletimeout of 0, the default, 116disables this feature. 117 118 119H4: include <filename> 120 121This directive specifies that slapd should read additional 122configuration information from the given file before continuing 123with the next line of the current file. The included file should 124follow the normal slapd config file format. The file is commonly 125used to include files containing schema specifications. 126 127Note: You should be careful when using this directive - there is 128no small limit on the number of nested include directives, and no 129loop detection is done. 130 131H4: loglevel <level> 132 133This directive specifies the level at which debugging statements 134and operation statistics should be syslogged (currently logged to 135the {{syslogd}}(8) {{EX:LOG_LOCAL4}} facility). You must have 136configured OpenLDAP {{EX:--enable-debug}} (the default) for this 137to work (except for the two statistics levels, which are always 138enabled). Log levels may be specified as integers or by keyword. 139Multiple log levels may be used and the levels are additive. To display what 140numbers correspond to what kind of debugging, invoke slapd with {{EX:-d?}} 141or consult the table below. The possible values for <integer> are: 142 143!block table; colaligns="RL"; align=Center; \ 144 title="Table 6.1: Debugging Levels" 145Level Keyword Description 146-1 any enable all debugging 1470 no debugging 1481 (0x1 trace) trace function calls 1492 (0x2 packets) debug packet handling 1504 (0x4 args) heavy trace debugging 1518 (0x8 conns) connection management 15216 (0x10 BER) print out packets sent and received 15332 (0x20 filter) search filter processing 15464 (0x40 config) configuration processing 155128 (0x80 ACL) access control list processing 156256 (0x100 stats) stats log connections/operations/results 157512 (0x200 stats2) stats log entries sent 1581024 (0x400 shell) print communication with shell backends 1592048 (0x800 parse) print entry parsing debugging 16016384 (0x4000 sync) syncrepl consumer processing 16132768 (0x8000 none) only messages that get logged whatever log level is set 162!endblock 163 164The desired log level can be input as a single integer that 165combines the (ORed) desired levels, both in decimal or in hexadecimal 166notation, as a list of integers (that are ORed internally), or as a list of the names that are shown between brackets, such that 167 168> loglevel 129 169> loglevel 0x81 170> loglevel 128 1 171> loglevel 0x80 0x1 172> loglevel acl trace 173 174are equivalent. 175 176\Examples: 177 178E: loglevel -1 179 180This will cause lots and lots of debugging information to be 181logged. 182 183E: loglevel conns filter 184 185Just log the connection and search filter processing. 186 187E: loglevel none 188 189Log those messages that are logged regardless of the configured loglevel. This 190differs from setting the log level to 0, when no logging occurs. At least the 191{{EX:None}} level is required to have high priority messages logged. 192 193\Default: 194 195E: loglevel stats 196 197Basic stats logging is configured by default. However, if no loglevel is 198defined, no logging occurs (equivalent to a 0 level). 199 200H4: objectclass <{{REF:RFC4512}} Object Class Description> 201 202This directive defines an object class. 203Please see the {{SECT:Schema Specification}} chapter for 204information regarding how to use this directive. 205 206 207H4: referral <URI> 208 209This directive specifies the referral to pass back when slapd 210cannot find a local database to handle a request. 211 212\Example: 213 214> referral ldap://root.openldap.org 215 216This will refer non-local queries to the global root LDAP server 217at the OpenLDAP Project. Smart LDAP clients can re-ask their 218query at that server, but note that most of these clients are 219only going to know how to handle simple LDAP URLs that 220contain a host part and optionally a distinguished name part. 221 222 223H4: sizelimit <integer> 224 225This directive specifies the maximum number of entries to return 226from a search operation. 227 228\Default: 229 230> sizelimit 500 231 232See the {{SECT:Limits}} section of this guide and {{slapd.conf}}(5) 233for more details. 234 235H4: timelimit <integer> 236 237This directive specifies the maximum number of seconds (in real 238time) slapd will spend answering a search request. If a 239request is not finished in this time, a result indicating an 240exceeded timelimit will be returned. 241 242\Default: 243 244> timelimit 3600 245 246See the {{SECT:Limits}} section of this guide and {{slapd.conf}}(5) 247for more details. 248 249 250H3: General Backend Directives 251 252Directives in this section apply only to the backend in which 253they are defined. They are supported by every type of backend. 254Backend directives apply to all databases instances of the 255same type and, depending on the directive, may be overridden 256by database directives. 257 258H4: backend <type> 259 260This directive marks the beginning of a backend declaration. 261{{EX:<type>}} should be one of the 262supported backend types listed in Table 6.2. 263 264!block table; align=Center; coltags="EX,N"; \ 265 title="Table 6.2: Database Backends" 266Types Description 267bdb Berkeley DB transactional backend (deprecated) 268dnssrv DNS SRV backend 269hdb Hierarchical variant of bdb backend (deprecated) 270ldap Lightweight Directory Access Protocol (Proxy) backend 271mdb Memory-Mapped DB backend 272meta Meta Directory backend 273monitor Monitor backend 274passwd Provides read-only access to {{passwd}}(5) 275perl Perl Programmable backend 276shell Shell (extern program) backend 277sql SQL Programmable backend 278!endblock 279 280\Example: 281 282> backend mdb 283 284This marks the beginning of a new {{TERM:MDB}} backend 285definition. 286 287 288H3: General Database Directives 289 290Directives in this section apply only to the database in which 291they are defined. They are supported by every type of database. 292 293H4: database <type> 294 295This directive marks the beginning of a database instance 296declaration. 297{{EX:<type>}} should be one of the 298supported backend types listed in Table 6.2. 299 300\Example: 301 302> database mdb 303 304This marks the beginning of a new {{TERM:MDB}} database instance 305declaration. 306 307 308H4: limits <selector> <limit> [<limit> [...]] 309 310Specify time and size limits based on the operation's initiator or base 311DN. 312 313See the {{SECT:Limits}} section of this guide and {{slapd.conf}}(5) 314for more details. 315 316 317H4: readonly { on | off } 318 319This directive puts the database into "read-only" mode. Any 320attempts to modify the database will return an "unwilling to 321perform" error. If set on a consumer, modifications sent by 322syncrepl will still occur. 323 324\Default: 325 326> readonly off 327 328 329H4: rootdn <DN> 330 331This directive specifies the DN that is not subject to 332access control or administrative limit restrictions for 333operations on this database. The DN need not refer to 334an entry in this database or even in the directory. The 335DN may refer to a SASL identity. 336 337Entry-based Example: 338 339> rootdn "cn=Manager,dc=example,dc=com" 340 341SASL-based Example: 342 343> rootdn "uid=root,cn=example.com,cn=digest-md5,cn=auth" 344 345See the {{SECT:SASL Authentication}} section for information on 346SASL authentication identities. 347 348 349H4: rootpw <password> 350 351This directive can be used to specifies a password for the DN for 352the rootdn (when the rootdn is set to a DN within the database). 353 354\Example: 355 356> rootpw secret 357 358It is also permissible to provide hash of the password in {{REF:RFC2307}} 359form. {{slappasswd}}(8) may be used to generate the password hash. 360 361\Example: 362 363> rootpw {SSHA}ZKKuqbEKJfKSXhUbHG3fG8MDn9j1v4QN 364 365The hash was generated using the command {{EX:slappasswd -s secret}}. 366 367 368H4: suffix <dn suffix> 369 370This directive specifies the DN suffix of queries that will be 371passed to this backend database. Multiple suffix lines can be 372given, and at least one is required for each database 373definition. 374 375\Example: 376 377> suffix "dc=example,dc=com" 378 379Queries with a DN ending in "dc=example,dc=com" 380will be passed to this backend. 381 382Note: When the backend to pass a query to is selected, slapd 383looks at the suffix line(s) in each database definition in the 384order they appear in the file. Thus, if one database suffix is a 385prefix of another, it must appear after it in the config file. 386 387 388H4: syncrepl 389 390> syncrepl rid=<replica ID> 391> provider=ldap[s]://<hostname>[:port] 392> searchbase=<base DN> 393> [type=refreshOnly|refreshAndPersist] 394> [interval=dd:hh:mm:ss] 395> [retry=[<retry interval> <# of retries>]+] 396> [filter=<filter str>] 397> [scope=sub|one|base] 398> [attrs=<attr list>] 399> [exattrs=<attr list>] 400> [attrsonly] 401> [sizelimit=<limit>] 402> [timelimit=<limit>] 403> [schemachecking=on|off] 404> [network-timeout=<seconds>] 405> [timeout=<seconds>] 406> [bindmethod=simple|sasl] 407> [binddn=<DN>] 408> [saslmech=<mech>] 409> [authcid=<identity>] 410> [authzid=<identity>] 411> [credentials=<passwd>] 412> [realm=<realm>] 413> [secprops=<properties>] 414> [keepalive=<idle>:<probes>:<interval>] 415> [starttls=yes|critical] 416> [tls_cert=<file>] 417> [tls_key=<file>] 418> [tls_cacert=<file>] 419> [tls_cacertdir=<path>] 420> [tls_reqcert=never|allow|try|demand] 421> [tls_cipher_suite=<ciphers>] 422> [tls_crlcheck=none|peer|all] 423> [tls_protocol_min=<major>[.<minor>]] 424> [suffixmassage=<real DN>] 425> [logbase=<base DN>] 426> [logfilter=<filter str>] 427> [syncdata=default|accesslog|changelog] 428 429 430This directive specifies the current database as a replica of the 431master content by establishing the current {{slapd}}(8) as a 432replication consumer site running a syncrepl replication engine. 433The master database is located at the replication provider site 434specified by the {{EX:provider}} parameter. The replica database is 435kept up-to-date with the master content using the LDAP Content 436Synchronization protocol. See {{REF:RFC4533}} 437for more information on the protocol. 438 439The {{EX:rid}} parameter is used for identification of the current 440{{EX:syncrepl}} directive within the replication consumer server, 441where {{EX:<replica ID>}} uniquely identifies the syncrepl specification 442described by the current {{EX:syncrepl}} directive. {{EX:<replica ID>}} 443is non-negative and is no more than three decimal digits in length. 444 445The {{EX:provider}} parameter specifies the replication provider site 446containing the master content as an LDAP URI. The {{EX:provider}} 447parameter specifies a scheme, a host and optionally a port where the 448provider slapd instance can be found. Either a domain name or IP 449address may be used for <hostname>. Examples are 450{{EX:ldap://provider.example.com:389}} or {{EX:ldaps://192.168.1.1:636}}. 451If <port> is not given, the standard LDAP port number (389 or 636) is used. 452Note that the syncrepl uses a consumer-initiated protocol, and hence its 453specification is located at the consumer site, whereas the {{EX:replica}} 454specification is located at the provider site. {{EX:syncrepl}} and 455{{EX:replica}} directives define two independent replication 456mechanisms. They do not represent the replication peers of each other. 457 458The content of the syncrepl replica is defined using a search 459specification as its result set. The consumer slapd will 460send search requests to the provider slapd according to the search 461specification. The search specification includes {{EX:searchbase}}, 462{{EX:scope}}, {{EX:filter}}, {{EX:attrs}}, {{EX:exattrs}}, {{EX:attrsonly}}, 463{{EX:sizelimit}}, and {{EX:timelimit}} parameters as in the normal 464search specification. The {{EX:searchbase}} parameter has no 465default value and must always be specified. The {{EX:scope}} defaults 466to {{EX:sub}}, the {{EX:filter}} defaults to {{EX:(objectclass=*)}}, 467{{EX:attrs}} defaults to {{EX:"*,+"}} to replicate all user and operational 468attributes, and {{EX:attrsonly}} is unset by default. Both {{EX:sizelimit}} 469and {{EX:timelimit}} default to "unlimited", and only positive integers 470or "unlimited" may be specified. The {{EX:exattrs}} option may also be used 471to specify attributes that should be omitted from incoming entries. 472 473The {{TERM[expand]LDAP Sync}} protocol has two operation 474types: {{EX:refreshOnly}} and {{EX:refreshAndPersist}}. 475The operation type is specified by the {{EX:type}} parameter. 476In the {{EX:refreshOnly}} operation, the next synchronization search operation 477is periodically rescheduled at an interval time after each 478synchronization operation finishes. The interval is specified 479by the {{EX:interval}} parameter. It is set to one day by default. 480In the {{EX:refreshAndPersist}} operation, a synchronization search 481remains persistent in the provider {{slapd}} instance. Further updates to the 482master replica will generate {{EX:searchResultEntry}} to the consumer slapd 483as the search responses to the persistent synchronization search. 484 485If an error occurs during replication, the consumer will attempt to reconnect 486according to the retry parameter which is a list of the <retry interval> 487and <# of retries> pairs. For example, retry="60 10 300 3" lets the consumer 488retry every 60 seconds for the first 10 times and then retry every 300 seconds 489for the next three times before stop retrying. + in <# of retries> means 490indefinite number of retries until success. 491 492The schema checking can be enforced at the LDAP Sync consumer site 493by turning on the {{EX:schemachecking}} parameter. 494If it is turned on, every replicated entry will be checked for its 495schema as the entry is stored into the replica content. 496Every entry in the replica should contain those attributes 497required by the schema definition. 498If it is turned off, entries will be stored without checking 499schema conformance. The default is off. 500 501The {{EX:network-timeout}} parameter sets how long the consumer will 502wait to establish a network connection to the provider. Once a 503connection is established, the {{EX:timeout}} parameter determines how 504long the consumer will wait for the initial Bind request to complete. The 505defaults for these parameters come from {{ldap.conf}}(5). 506 507The {{EX:binddn}} parameter gives the DN to bind as for the 508syncrepl searches to the provider slapd. It should be a DN 509which has read access to the replication content in the 510master database. 511 512The {{EX:bindmethod}} is {{EX:simple}} or {{EX:sasl}}, 513depending on whether simple password-based authentication or 514{{TERM:SASL}} authentication is to be used when connecting 515to the provider {{slapd}} instance. 516 517Simple authentication should not be used unless adequate data 518integrity and confidentiality protections are in place (e.g. TLS 519or IPsec). Simple authentication requires specification of {{EX:binddn}} 520and {{EX:credentials}} parameters. 521 522SASL authentication is generally recommended. SASL authentication 523requires specification of a mechanism using the {{EX:saslmech}} parameter. 524Depending on the mechanism, an authentication identity and/or 525credentials can be specified using {{EX:authcid}} and {{EX:credentials}}, 526respectively. The {{EX:authzid}} parameter may be used to specify 527an authorization identity. 528 529The {{EX:realm}} parameter specifies a realm which a certain 530mechanisms authenticate the identity within. The {{EX:secprops}} 531parameter specifies Cyrus SASL security properties. 532 533The {{EX:keepalive}} parameter sets the values of idle, probes, and interval 534used to check whether a socket is alive; idle is the number of seconds a 535connection needs to remain idle before TCP starts sending keepalive probes; 536probes is the maximum number of keepalive probes TCP should send before 537dropping the connection; interval is interval in seconds between individual 538keepalive probes. Only some systems support the customization of these 539values; the keepalive parameter is ignored otherwise, and system-wide 540settings are used. For example, keepalive="240:10:30" will send a keepalive 541probe 10 times, every 30 seconds, after 240 seconds of idle activity. If 542no response to the probes is received, the connection will be dropped. 543 544The {{EX:starttls}} parameter specifies use of the StartTLS extended 545operation to establish a TLS session before authenticating to the provider. 546If the {{EX:critical}} argument is supplied, the session will be aborted 547if the StartTLS request fails. Otherwise the syncrepl session continues 548without TLS. The tls_reqcert setting defaults to {{EX:"demand"}} and the 549other TLS settings default to the same as the main slapd TLS settings. 550 551The {{EX:suffixmassage}} parameter allows the consumer to pull entries 552from a remote directory whose DN suffix differs from the local directory. 553The portion of the remote entries' DNs that matches the searchbase will 554be replaced with the suffixmassage DN. 555 556Rather than replicating whole entries, the consumer can query logs 557of data modifications. This mode of operation is referred to as 558{{delta syncrepl}}. In addition to the above parameters, the 559{{EX:logbase}} and {{EX:logfilter}} parameters must be set appropriately 560for the log that will be used. The {{EX:syncdata}} parameter must 561be set to either {{EX:"accesslog"}} if the log conforms to the 562{{slapo-accesslog}}(5) log format, or {{EX:"changelog"}} if the log 563conforms to the obsolete {{changelog}} format. If the {{EX:syncdata}} 564parameter is omitted or set to {{EX:"default"}} then the log 565parameters are ignored. 566 567The {{syncrepl}} replication mechanism is supported by the {{bdb}}, 568{{hdb}}, and {{mdb}} backends. 569 570See the {{SECT:LDAP Sync Replication}} chapter of this guide for 571more information on how to use this directive. 572 573 574H4: updateref <URL> 575 576This directive is only applicable in a {{slave}} (or {{shadow}}) 577{{slapd}}(8) instance. It 578specifies the URL to return to clients which submit update 579requests upon the replica. 580If specified multiple times, each {{TERM:URL}} is provided. 581 582\Example: 583 584> updateref ldap://master.example.net 585 586 587H3: BDB and HDB Database Directives 588 589Directives in this category only apply to both the {{TERM:BDB}} 590and the {{TERM:HDB}} database. 591That is, they must follow a "database bdb" or "database hdb" line 592and come before any 593subsequent "backend" or "database" line. For a complete reference 594of BDB/HDB configuration directives, see {{slapd-bdb}}(5). 595 596 597H4: directory <directory> 598 599This directive specifies the directory where the BDB files 600containing the database and associated indices live. 601 602\Default: 603 604> directory /usr/local/var/openldap-data 605 606 607H2: Configuration File Example 608 609The following is an example configuration file, interspersed 610with explanatory text. It defines two databases to handle 611different parts of the {{TERM:X.500}} tree; both are {{TERM:BDB}} 612database instances. The line numbers shown are provided for 613reference only and are not included in the actual file. First, the 614global configuration section: 615 616E: 1. # example config file - global configuration section 617E: 2. include /usr/local/etc/schema/core.schema 618E: 3. referral ldap://root.openldap.org 619E: 4. access to * by * read 620 621Line 1 is a comment. Line 2 includes another config file 622which contains {{core}} schema definitions. 623The {{EX:referral}} directive on line 3 624means that queries not local to one of the databases defined 625below will be referred to the LDAP server running on the 626standard port (389) at the host {{EX:root.openldap.org}}. 627 628Line 4 is a global access control. It applies to all 629entries (after any applicable database-specific access 630controls). 631 632The next section of the configuration file defines a BDB 633backend that will handle queries for things in the 634"dc=example,dc=com" portion of the tree. The 635database is to be replicated to two slave slapds, one on 636truelies, the other on judgmentday. Indices are to be 637maintained for several attributes, and the {{EX:userPassword}} 638attribute is to be protected from unauthorized access. 639 640E: 5. # BDB definition for the example.com 641E: 6. database bdb 642E: 7. suffix "dc=example,dc=com" 643E: 8. directory /usr/local/var/openldap-data 644E: 9. rootdn "cn=Manager,dc=example,dc=com" 645E: 10. rootpw secret 646E: 11. # indexed attribute definitions 647E: 12. index uid pres,eq 648E: 13. index cn,sn pres,eq,approx,sub 649E: 14. index objectClass eq 650E: 15. # database access control definitions 651E: 16. access to attrs=userPassword 652E: 17. by self write 653E: 18. by anonymous auth 654E: 19. by dn.base="cn=Admin,dc=example,dc=com" write 655E: 20. by * none 656E: 21. access to * 657E: 22. by self write 658E: 23. by dn.base="cn=Admin,dc=example,dc=com" write 659E: 24. by * read 660 661Line 5 is a comment. The start of the database definition is marked 662by the database keyword on line 6. Line 7 specifies the DN suffix 663for queries to pass to this database. Line 8 specifies the directory 664in which the database files will live. 665 666Lines 9 and 10 identify the database {{super-user}} entry and associated 667password. This entry is not subject to access control or size or 668time limit restrictions. 669 670Lines 12 through 14 indicate the indices to maintain for various 671attributes. 672 673Lines 16 through 24 specify access control for entries in this 674database. For all applicable entries, the {{EX:userPassword}} attribute is writable 675by the entry itself and by the "admin" entry. It may be used for 676authentication/authorization purposes, but is otherwise not readable. 677All other attributes are writable by the entry and the "admin" 678entry, but may be read by all users (authenticated or not). 679 680The next section of the example configuration file defines another 681BDB database. This one handles queries involving the 682{{EX:dc=example,dc=net}} subtree but is managed by the same entity 683as the first database. Note that without line 39, the read access 684would be allowed due to the global access rule at line 4. 685 686E: 33. # BDB definition for example.net 687E: 34. database bdb 688E: 35. suffix "dc=example,dc=net" 689E: 36. directory /usr/local/var/openldap-data-net 690E: 37. rootdn "cn=Manager,dc=example,dc=com" 691E: 38. index objectClass eq 692E: 39. access to * by users read 693