#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include		/etc/ldap/openldap/schema/core.schema
include         /etc/ldap/openldap/schema/cosine.schema
include         /etc/ldap/openldap/schema/nis.schema
include         /etc/ldap/openldap/schema/misc.schema
include         /etc/ldap/openldap/schema/inetorgperson.schema
include         /etc/ldap/openldap/schema/sendmail.schema
include         /etc/ldap/openldap/schema/samba.schema
include         /etc/ldap/openldap/schema/mozillaOrgPerson_V0.6.schema
include         /etc/ldap/openldap/schema/greenmta.schema
include         /etc/ldap/openldap/schema/gruene.schema

# Schema check allows for forcing entries to
# match schemas for their objectClasses's
schemacheck     on

# Gentle shutdown when SIGHUP is received
gentlehup	on

# Define global ACLs to disable default read access.

# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral	ldap://root.openldap.org

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

# TLS keys and certificates
#TLSCACertificateFile    /etc/ldap/cacert.pem
#TLSCertificateFile      /etc/ldap/newcert_master.example.net.pem
#TLSCertificateKeyFile   /etc/ldap/newreq_master.example.net.pem

# Limits 'R us
sizelimit	262144
timelimit	300

# TLS
TLSCACertificateFile    /etc/ldap/openldap/cacert.pem
TLSCertificateFile      /etc/ldap/openldap/master.example.net.cert
TLSCertificateKeyFile   /etc/ldap/openldap/master.example.net.key
TLSRandFile		/dev/random

# Sample security restrictions
#	Require integrity protection (prevent hijacking)
#	Require 112-bit (3DES or better) encryption for updates
#	Require 63-bit encryption for simple bind
# security ssf=1 update_ssf=112 simple_bind=64

# Sample access control policy:
#	Root DSE: allow anyone to read it
#	Subschema (sub)entry DSE: allow anyone to read it
#	Other DSEs:
#		Allow self write access
#		Allow authenticated users read access
#		Allow anonymous users to authenticate
#	Directives needed to implement policy:
# access to dn.base="" by * read
# access to dn.base="cn=Subschema" by * read
# access to *
#	by self write
#	by users read
#	by anonymous auth
#
# if no access controls are present, the default policy
# allows anyone and everyone to read anything but restricts
# updates to rootdn.  (e.g., "access to * by * read")
#
# rootdn can always read and write EVERYTHING!

#######################################################################
# BDB database definitions
#######################################################################

database	bdb
suffix		"dc=example,dc=net"
rootdn		"cn=ldaproot,dc=example,dc=net"
#updatedn	"cn=repladmin,dc=example,dc=net"
# Cleartext passwords, especially for the rootdn, should
# be avoid.  See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
#
rootpw		{SSHA}Rwilfur49jrtPsw7dJJPp5RBoX2f+gHV

# The database directory MUST exist prior to running slapd AND 
# should only be accessible by the slapd and slap tools.
# Mode 700 recommended.
directory	/home/ldap/var/openldap-data

# Indices to maintain
index	accountStatus					eq
index	objectClass,uidNumber,gidNumber			eq
index	cn,sn,uid,displayName,mail			eq,pres,sub
index	lookupKey,lookupName				eq
index	memberUid,givenname				eq,subinitial
index	mailAlternateAddress,mailForwardingAddress	eq,sub
index	mailLocalAddress				pres,eq
index   mailroutingaddress				pres,eq
index   mailQuotaSize,mailQuotaCount,mailSizeMax	eq
index   sambaSID,sambaPrimaryGroupSID,sambaDomainName	eq
index   userPassword					eq

# Maintain last modified records
lastmod		on

# Ensure read access to the base for things like
# supportedSASLMechanisms.  Without this you may
# have problems with SASL not knowing what
# mechanisms are available and the like.
# Note that this is covered by the 'access to *'
# ACL below too but if you change that as people
# are wont to do you'll still need this if you
# want SASL (and possible other things) to work 
# happily.
access to dn.base="" by * read

# The userPassword by default can be changed
# by the entry owning it if they are authenticated.
# Others should not be able to see it, except the
# admin entry below
access to attrs=userPassword
        by dn="cn=ldaproot,dc=example,dc=net" write
	by dn="cn=cyrus,ou=system,ou=accounts,dc=example,dc=net" write
        by anonymous auth
        by self write
        by * none

access to *
	by dn="cn=postfix,ou=system,ou=accounts,dc=example,dc=net" read
	by dn="cn=cyrus,ou=system,ou=accounts,dc=example,dc=net" read

# Subtrees can be manages by tree admins
access to dn.regex="^cn=[^,]+,ou=marketing,dc=example,dc=net$"
	attrs=children
	by dn.exact="cn=admin,ou=marketing,dc=example,dc=net" write

# The admin dn has full write access, everyone else
# can read everything.
access to *
        by dn="cn=ldaproot,dc=example,dc=net" write
        by users read

# Replication
# 
# parvati.gruene.at
# 
replogfile /var/run/ldap/replogfile
replica uri="ldaps://slave1.example.net" starttls=yes bindmethod=simple binddn="cn=ldaproot,dc=example,dc=net" credentials="6202f430d9c9a97da8d041946847643f"
replica uri="ldaps://slave2.example.net" starttls=yes bindmethod=simple binddn="cn=ldaproot,dc=example,dc=net" credentials="6202f430d9c9a97da8d041946847643f"

