在本文中,我们使用OpenLDAP来作为认证中心,供其他程序使用。 OpenLDAP在邮件系统中处于核心的地位,他存储着非常重要的用户信息(用户名,密码,Homedir等等)。当然您也可以选择使用MySQL来做为认证中心,但是LDAP协议本身的特点(良好的查询性能)以及邮件系统拥有的特性(认证信息的不经常变动),决定了LDAP更适合使用在邮件系统中,他能给我们带来更好的性能。
shell
安装时选择:
TCP_WRAPPERS BDB DYNAMIC_BACKENDS SLUPD
编辑/etc/hosts或者修改你的DNS服务器:
shell
增加如下两个域名。
192.168.1.111 ldap.extmail.org 192.168.1.111 ldap-master.extmail.org
拷贝extmail.schema到OpenLDAP的schema目录
shell
编辑slapd.conf文件:
shell
内容类似如下:
include /usr/local/etc/openldap/schema/core.schema include /usr/local/etc/openldap/schema/cosine.schema include /usr/local/etc/openldap/schema/nis.schema include /usr/local/etc/openldap/schema/extmail.schema pidfile /var/run/openldap/slapd.pid argsfile /var/run/openldap/slapd.args modulepath /usr/local/libexec/openldap moduleload back_bdb database bdb suffix "dc=extmail.org" rootdn "cn=Manager,dc=extmail.org" rootpw secret directory /var/db/openldap-data index objectClass eq index mail,active,virtualDomain,mailLocalAddress eq,pres
编辑ldap.conf文件:
shell
内容类似如下:
BASE dc=extmail.org URI ldap://ldap.extmail.org ldap://ldap-master.extmail.org:389 SIZELIMIT 12 TIMELIMIT 15 DEREF never
编辑/etc/rc.conf文件:
shell
增加如下一行:
slapd_enable="YES"
启动并初始化LDAP
shell
OpenLDAP配置完成