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