# $OpenLDAP: pkg/ldap/servers/slapd/slapd.conf,v 1.23.2.8 2003/05/24 23:19:14 kurt Exp $
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include		/etc/openldap/schema/core.schema
include		/etc/openldap/schema/cosine.schema
include		/etc/openldap/schema/inetorgperson.schema
include		/etc/openldap/schema/nis.schema
include		/etc/openldap/schema/mozilla.schema
include		/etc/openldap/schema/eduPerson.schema
include		/etc/openldap/schema/kyoto-uEduPerson.schema
include		/etc/openldap/schema/redhat/autofs.schema

# Allow LDAPv2 client connections.  This is NOT the default.
allow bind_v2

# Log Level
#loglevel 128

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

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

# Load dynamic backend modules:
# modulepath	/usr/sbin/openldap
# moduleload	back_bdb.la
# moduleload	back_ldap.la
# moduleload	back_ldbm.la
# moduleload	back_passwd.la
# moduleload	back_shell.la

# The next three lines allow use of TLS for connections using a dummy test
# certificate, but you should generate a proper certificate by changing to
# /usr/share/ssl/certs, running "make slapd.pem", and fixing permissions on
# slapd.pem so that the ldap user or group can read it.
TLSCertificateFile /usr/local/etc/openldap/ldapsvcert.pem
TLSCertificateKeyFile /usr/local/etc/openldap/private/ldapsvkey.pem
TLSCACertificateFile /usr/local/etc/openldap/cacert.pem

# Sizelimit
sizelimit       unlimited

# 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 is:
#	Allow read by all
#
# rootdn can always write!

#
# cn=admin,ou=groupsに関するアクセス権
# Administratorおよびadminグループのオーナーにはwrite
# グループのメンバーにはread
access to dn="cn=admin,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" 
        by dn="cn=Administrator,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/owner="cn=admin,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember="cn=admin,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" read
        by * none

#
# cn=(.+),cn=(.+),ou=groupsに関するアクセス権
# 管理者(Administratorおよびadminグループのメンバ)とグループのオーナーにはwrite
# グループカテゴリの管理者(cn=$2,ou=groupsのメンバ)にはwrite
# グループのメンバーにはread
access to dn.regex="cn=(.+),cn=(.+),ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp"
        by dn="cn=Administrator,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember="cn=admin,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember.expand="cn=$2,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/owner.expand="cn=$1,cn=$2,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember.expand="cn=$1,cn=$2,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" read
        by * none

# 以下のou=groupsに関するアクセス権1～3により、次のようなアクセス制御となる。
# cn=*,ou=groups... :
#	ownerは変更削除可能 uniqueMemberは読み取り可能
# cn=*,cn=*,ou=groups... : 
#	ownerは変更削除可能 uniqueMemberは読み取り可能
#       さらに
#	ou=*,ou=groups...のuniqueMemberは変更削除追加可能

#
# ou=groupsに関するアクセス権1
# ou=groups直下のエントリ自身(attrs=entry)に対する権限を設定する。
# 管理者(Administratorおよびadminグループのメンバ)とグループのオーナーにはwrite
# グループのメンバーにはread
access to dn.regex="cn=(.+),ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" attrs=entry
        by dn="cn=Administrator,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/owner.expand="cn=$1,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember="cn=admin,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember.expand="cn=$1,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" read
        by * none

#
# ou=groupsに関するアクセス権2
# ou=groups直下のエントリの1階層下(attrs=children)に対する権限を設定する。
# 管理者(Administratorおよびadminグループのメンバ)とグループのオーナーにはwrite
# グループのメンバーにはread
access to dn.regex="cn=(.+),ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" attrs=children
        by dn="cn=Administrator,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember="cn=admin,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember.expand="cn=$1,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by * none

#
# ou=groupsに関するアクセス権3
# ou=groups直下のエントリに対する権限を設定する。
# 管理者(Administratorおよびadminグループのメンバ)とグループのオーナーにはwrite
# グループのメンバーにはread
access to dn.regex="cn=(.+),ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp"
        by dn="cn=Administrator,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/owner.expand="cn=$1,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember="cn=admin,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember.expand="cn=$1,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" read
        by * none

#
# ou=usersのuserPasswordに関するアクセス権
# 管理者と自分自身にはwrite
# 基本的にアクセス不可
access to dn.subtree="ou=users,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" attrs=userPassword
        by self write
        by dn="cn=Administrator,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember="cn=admin,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by anonymous auth
        by * none

#
# ou=peopleのuserPasswordに関するアクセス権
# 管理者と自分自身にはwrite
# w-peopleグループのメンバにはwrite
# 基本的にアクセス不可
access to dn.subtree="ou=people,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" attrs=userPassword
        by self write
        by dn="cn=Administrator,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember="cn=admin,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember="cn=w-people,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by anonymous auth
        by * none

#
# ou=peopleに関するアクセス権
# 管理者(Administratorおよびadminグループのメンバ)にはwrite
# w-peopleグループのメンバにはwrite
access to dn.subtree="ou=people,o=kogaku,dc=kyoto-u,dc=ac,dc=jp"
        by self write
        by dn="cn=Administrator,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember="cn=admin,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember="cn=w-people,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by users read
        by * none

#
# ou=organizationに関するアクセス権
# 管理者(Administratorおよびadminグループのメンバ)にはwrite
# w-organizationグループのメンバにはwrite
access to dn.subtree="ou=organization,o=kogaku,dc=kyoto-u,dc=ac,dc=jp"
        by self write
        by dn="cn=Administrator,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember="cn=admin,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember="cn=w-organization,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by users read
        by * none
#
# ou=groups配下に関するアクセス権
# 管理者(Administratorおよびadminグループのメンバ)にはwrite
# w-organizationグループのメンバにはwrite
#access to dn="ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" attrs=children
#        by users write
#        by * none

#
# その他に関するアクセス権
# 管理者と自分自身にはwrite
# ユーザはread
# その他はアクセス不可
access to *
        by self write
        by dn="cn=Administrator,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by group/groupOfUniqueNames/uniqueMember="cn=admin,ou=groups,o=kogaku,dc=kyoto-u,dc=ac,dc=jp" write
        by users read
        by * none

#######################################################################
# ldbm and/or bdb database definitions
#######################################################################

database	ldbm
suffix		"o=kogaku,dc=kyoto-u,dc=ac,dc=jp"
rootdn	 	"cn=Administrator,o=kogaku,dc=kyoto-u,dc=ac,dc=jp"


# Cleartext passwords, especially for the rootdn, should
# be avoided.  See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
# rootpw		secret
rootpw		{MD5}sbnT8A8ilbacC0FC1PrKfg==
# The database directory MUST exist prior to running slapd AND 
# should only be accessible by the slapd and slap tools.
# Mode 700 recommended.
directory	/var/lib/ldap

# Indices to maintain for this database
index objectClass                       eq,pres
index ou,cn,mail,surname,givenname      eq,pres,sub
index uidNumber,gidNumber,loginShell    eq,pres
index uid,memberUid                     eq,pres,sub
index nisMapName,nisMapEntry            eq,pres,sub
index o                                 eq,pres,sub
index kyoto-uEduOrgUniqueNumber         eq
index kyoto-uEduOrgUnitUniqueNumber     eq
index dc                                eq,pres
index kyoto-uEduPersonOIN               eq
index eduPersonPrincipalName            eq,pres
index eduPersonAffiliation              eq,pres
index eduPersonOrgUnitDN                eq
index telephoneNumber                   eq,pres,sub

# Replicas of this database
replogfile /var/lib/ldap/openldap-master-replog
replica uri=ldaps://www2.kogaku.kyoto-u.ac.jp:636
	binddn="cn=Administrator,o=kogaku,dc=kyoto-u,dc=ac,dc=jp"
	bindmethod=simple credentials=secret

#database        ldap
#suffix          "dc=kyoto-u,dc=ac,dc=jp"
#uri             ldaps://10.249.98.180/
