The/etc/openldap/slapd.conf文件是独立 LDAP 守护进程的主要配置文件。诸如:权限、密码、数据库类型、数据库位置等等选项都可以在此文件中配置,并将应用于slapd整个守护进程。在下面的例子中,我们配置了slapd.conf文件用于 LDBM 后端数据库。
编辑slapd.conf文件,使用命令 vi/etc/openldap/slapd.conf并添加/调整以下信息
# # See slapd.conf(5) for details on configuration options. # This file should NOT be world readable. # include /etc/openldap/slapd.at.conf include /etc/openldap/slapd.oc.conf schemacheck off #referral ldap://ldap.itd.umich.edu pidfile /var/run/slapd.pid argsfile /var/run/slapd.args ####################################################################### # ldbm database definitions ####################################################################### database ldbm suffix "o=openna, c=com" directory /var/ldap rootdn "cn=admin, o=openna, c=com" rootpw secret # cleartext passwords, especially for the rootdn, should # be avoid. See slapd.conf(5) for details. # ldbm indexed attribute definitions index cn,sn,uid index objectclass pres,eq index default none # ldbm access control definitions defaultaccess read access to attr=userpassword by self write by dn="cn=admin, o=openna, c=com" write by * compare |
您应该确保在您的slapd.conf文件(如上所示)中设置以下选项,然后再启动 slapd 守护进程程序
此选项指定您尝试创建的子树的根的 DN。换句话说,它指示此数据库将保存哪些条目。
此选项指定 LDAP 的数据库和相关索引文件应驻留的目录。我们必须将其设置为/var/ldap因为我们在安装阶段早期专门创建了这个目录来处理 LDAP 的后端数据库。
此选项指定允许对 LDAP 目录执行任何操作的条目的 DN。此处输入的名称可以是不实际存在于您的密码文件中的名称/etc/passwd.
此选项指定可用于验证超级用户数据库条目的密码。这是上述 rootdn 选项的密码。重要的是不要在此处使用明文密码,而是使用加密密码。
这些选项指定您想要在数据库定义中构建和维护的索引定义。我们在我们的slapd.conf文件示例(如上所示)中指定的选项,导致为以下项维护所有索引:cn, sn,和uid属性;-index cn,sn,uid,objectclass 属性的存在和相等索引 -index objectclass pres,eq,以及所有剩余属性的无索引 -index default none。有关更多信息,请参阅您的用户手册。
文件中的最后一个选项slapd.conf与 LDAP 目录中的访问控制有关。
defaultaccess read access to attr=userpassword by self write by dn="cn=admin, o=openna, c=com" write by * compare |