# (c) 2003 Tassilo Erlewein <tassilo.erlewein@erfrakon.de>
# (c) 2003-2007 Martin Konold <martin.konold@erfrakon.de>
# (c) 2003 Achim Frank <achim.frank@erfrakon.de>
# This program is Free Software under the GNU General Public License (>=v2).
# Read the file COPYING that comes with this packages for details.


# this file is automatically written by the Kolab config backend and should have the 
# file mode 0640

loglevel 1023

modulepath	/usr/lib/ldap
moduleload	back_bdb
moduleload	back_monitor
moduleload	refint
moduleload	unique

# manual additions are lost unless made to the template in the Kolab config directory
# the template is  /etc/kolab/templates/slapd.conf.template

include /etc/ldap/schema/core.schema
include /etc/ldap/schema/cosine.schema
include /etc/ldap/schema/inetorgperson.schema
include /etc/ldap/schema/rfc2739.schema
include /etc/ldap/schema/kolab2.schema
#include /etc/ldap/schema/horde.schema

pidfile		/var/run/slapd/slapd.pid
argsfile	/var/run/slapd/slapd.args

# Depending on the build options of openldap the syncprov module is statically
# or dynamically build.  When build dynamically the module must be loaded.
# As the slapd that comes with the openpkg version of kolab is statically
# build it is not necessary to load the module.
moduleload syncprov

TLSCertificateFile     /etc/kolab/cert.pem
TLSCertificateKeyFile  /etc/kolab/key.pem

rootDSE                /etc/kolab/rootDSE.ldif

defaultsearchbase      "dc=groups,dc=systemausfall,dc=org"

#require 	none
allow 		bind_v2

loglevel	0

database	bdb
suffix		"dc=groups,dc=systemausfall,dc=org"
cachesize       10000
checkpoint 	512 5
idlcachesize    10000

# The idletimeout can be increased if some clients develop problems.
# Please report to kolab-devel@kolab.org if you encounter such a client.
idletimeout	300

# Use syncprov/syncrepl method for ldap replication
overlay syncprov
syncprov-checkpoint 1024 16
syncprov-sessionlog 4096
syncprov-reloadhint TRUE
index entryCSN eq
index entryUUID eq

dirtyread

directory	/var/lib/ldap

rootdn          "cn=manager,cn=internal,dc=groups,dc=systemausfall,dc=org"
rootpw          "{SSHA}e43RDDGP9hJWypUVTRPkouW9+I/1OIT0"

replica uri=ldap://127.0.0.1:9999
        binddn="cn=replicator"
        bindmethod=simple 
	credentials=secret

#### Using overlays to improve data consistency
# Ensure that we never get dangling member attributes
# Checked on rename and delete
overlay refint
refint_attributes member

# The mail and the uid attribute must be unique.
overlay unique
unique_attributes mail uid

index   objectClass     pres,eq
index   uid             approx,sub,pres,eq
index   mail            approx,sub,pres,eq
index   alias           approx,sub,pres,eq
index   cn              approx,sub,pres,eq
index   sn              approx,sub,pres,eq
index   givenName       approx,sub,pres,eq
index   kolabDelegate   approx,sub,pres,eq
index   kolabHomeServer pres,eq
index   kolabDeleteflag pres,eq
index   member          pres,eq

include /etc/ldap/slapd.access

access to dn="dc=groups,dc=systemausfall,dc=org" attrs=children
	by group/kolabGroupOfNames="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org" write
	by group/kolabGroupOfNames="cn=maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" write
	by group/kolabGroupOfNames="cn=domain-maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" write

access to dn="cn=internal,dc=groups,dc=systemausfall,dc=org" attrs=children
	by group/kolabGroupOfNames="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org" write
	by group/kolabGroupOfNames="cn=maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" write
	by group/kolabGroupOfNames="cn=domain-maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" write

access to attrs=userPassword
   	by group/kolabGroupOfNames="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org" =wx
        by group/kolabGroupOfNames="cn=maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" =wx
        by self =wx
        by anonymous =x
        by * none stop

access to attrs=mail
        by group/kolabGroupOfNames="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org" write
        by group/kolabGroupOfNames="cn=maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" write
        by * read stop

access to attrs=alias
        by group/kolabGroupOfNames="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org" write
        by group/kolabGroupOfNames="cn=maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" write
        by * read stop

access to attrs=uid
        by group/kolabGroupOfNames="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org" write
        by group/kolabGroupOfNames="cn=maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" write
        by * read stop

access to attrs=cyrus-userquota
        by group/kolabGroupOfNames="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org" write
        by group/kolabGroupOfNames="cn=maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" write
	by self read stop

access to attrs=kolabHomeServer
        by group/kolabGroupOfNames="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org" write
        by group/kolabGroupOfNames="cn=maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" write
        by * read stop

access to attrs=kolabHomeMTA
        by group/kolabGroupOfNames="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org" write
        by group/kolabGroupOfNames="cn=maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" write
        by * read stop

access to attrs=kolabAllowSMTPRecipient
       by group/kolabGroupOfNames="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org" write
       by group/kolabGroupOfNames="cn=maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" write
       by self read stop

access to dn="cn=nobody,dc=groups,dc=systemausfall,dc=org"
        by anonymous auth stop

access to dn="cn=manager,cn=internal,dc=groups,dc=systemausfall,dc=org"
        by dn="cn=nobody,cn=internal,dc=groups,dc=systemausfall,dc=org" read
        by self write
        by anonymous auth stop

access to dn="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org"
        by group/kolabGroupOfNames="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org" write
        by dn="cn=nobody,cn=internal,dc=groups,dc=systemausfall,dc=org" read
        by self write
        by anonymous auth stop

access to dn="cn=maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org"
        by group/kolabGroupOfNames="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org" write
        by group/kolabGroupOfNames="cn=maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" read
        by dn="cn=nobody,cn=internal,dc=groups,dc=systemausfall,dc=org" read
        by self write
        by anonymous auth stop

access to dn.regex="(.*,)?cn=internal,dc=groups,dc=systemausfall,dc=org"
 	by group/kolabGroupOfNames="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org" write
        by group/kolabGroupOfNames="cn=maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" write
        by self write
	by dn="cn=nobody,cn=internal,dc=groups,dc=systemausfall,dc=org" read 
	by anonymous auth stop

access to dn.regex="(.*,)?cn=external,dc=groups,dc=systemausfall,dc=org"
        by group/kolabGroupOfNames="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org" write
        by group/kolabGroupOfNames="cn=maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" write
	by * read stop

access to dn="cn=external,dc=groups,dc=systemausfall,dc=org"
	by dn="cn=nobody,cn=internal,dc=groups,dc=systemausfall,dc=org" read 
	by * search stop

access to dn="cn=internal,dc=groups,dc=systemausfall,dc=org"
	by dn="cn=nobody,cn=internal,dc=groups,dc=systemausfall,dc=org" read 
        by * search stop

access to dn="k=kolab,dc=groups,dc=systemausfall,dc=org"
	by group/kolabGroupOfNames="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org" write
	by group/kolabGroupOfNames="cn=maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" read
	by group/kolabGroupOfNames="cn=domain-maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" read
	by dn="cn=nobody,cn=internal,dc=groups,dc=systemausfall,dc=org" read 
	by * none stop	

access to * 
        by self write
	by group/kolabGroupOfNames="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org" write
 	by group/kolabGroupOfNames="cn=maintainer,cn=internal,dc=groups,dc=systemausfall,dc=org" write
	by * read stop

include /etc/ldap/slapd.replicas


database	monitor

access to *
	by group/kolabGroupOfNames="cn=admin,cn=internal,dc=groups,dc=systemausfall,dc=org" write
	by * none stop

