|  | 级别: 初级 IBM,
2002 年 8 月 01 日 IBM eServer 开发者园地收集的适用于 IBM eServer 硬件和相关软件开发人员的内容和资源在不断增加,专注于 iSeries、pSeries、xSeries 和 zSeries 开发人员的内容,IBM eServer 开发者园地提供了文章、样本代码、教程、how-to、工具、新闻、案例学习、论坛 — 几乎包含开发人员希望或需要能帮助他们完成工作的所有东西。
描述
LDAP 服务器为 Sendmail 服务提供邮件本地地址(Mail Local Address)。期望状态:用于更新和管理的具有单点控制的快速 LDAP 响应。
为了用最小的网络流量提供最快的速度,每台邮件服务器机器都有一台本地 LDAP 服务器。我们将服务器配置为一台主服务器带有两台从服务器。LDAP 从服务器维护一份主数据库的只读副本,并且主服务器维护其所有的更新。更新流量在本测试中不存在,因此复制不是性能考虑事项。
构建
OpenLDAP 使用众所周知的 GNU
configue脚本来设置源软件包。在我们的 Red Hat 7.1 系统(glibc 2.2.2)上,用标准 GNU 方法可以很好地构建软件包:
./configure
make
make install
|
我们在
/usr/local/etc/openldap下安装二进制文件和配置文件。LDAP 数据文件和运行时文件位于
/usr/local/var下。
重要说明
- 缺省情况下用 PREFIX=
/usr/local安装源软件包。用 PREFIX=
/安装 RedHat rpm 版本。不要同时使用二者 :) 安装将在 $PREFIX/etc/openldap 和 $PREFIX/var 中存储文件。
- LDAP 目录使用的属性在一个
schema文件中定义。如果找不到属性定义,不会发生什么事情。在
slapd.conf文件中用 include 伪指令指定模式文件。缺省情况下,该文件只包括 core.schema。
- 可以用 LDAP 工具(ldapadd 等)或脱机工具(slapadd 等)构建数据库。脱机工具快很多倍。请使用它们。
- LDAP 需要安全的配置文件。chmod 0600 slapd.conf
安装 — 配置文件
所有配置文件都应该在 $PREFIX/etc/openldap 目录中。下面是我们安装中带有注解的文件:
Master slapd.conf
# $OpenLDAP: pkg/ldap/servers/slapd/slapd.conf,v 1.8.8.6 2001/04/20 23:32:43 kurt Exp $
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include /usr/local/etc/openldap/schema/core.schema
include /usr/local/etc/openldap/schema/cosine.schema
include /usr/local/etc/openldap/schema/inetorgperson.schema
include /usr/local/etc/openldap/schema/misc.schema
|
#LDAP 目录使用
OID语法来描述事物。通过这些模式文件描述该语法。如果这些文件中没有列出您需要的属性类型,那么您就有很多麻烦了。缺省 slapd.conf 只包括 core.schema,因此始终要检查该项。
# 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 /usr/local/var/slapd.pid
argsfile /usr/local/var/slapd.args
replogfile /usr/local/var/slapd.replog
|
#运行时信息的位置
# Load dynamic backend modules:
# modulepath /usr/local/libexec/openldap
# moduleload back_ldap.la
# moduleload back_ldbm.la
# moduleload back_passwd.la
# moduleload back_shell.la
#######################################################################
# ldbm database definitions
#######################################################################
database ldbm
suffix "dc=sequent,dc=com"
rootdn "dc=ent,dc=sequent,dc=com"
|
#这两项定义根专有(Root Distinguished)名称,并且将被所有的数据库实用程序使用。
# Cleartext passwords, especially for the rootdn, should
# be avoid. See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
rootpw secret
|
#我们不是很安全
# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd/tools. Mode 700 recommended.
directory /usr/local/var/openldap-ldbm
# Indices to maintain
index objectClass eq
index mailLocalAddress pres,eq
index cn pres,eq
index sn pres,eq
index mailroutingaddress pres,eq
|
#数据库始终少不了索引。LDAP 也不例外
replica host=slave3:389
binddn="cn=Manager,dc=ent,dc=sequent,dc=com"
bindmethod=simple credentials=secret
replica host=slave5:389
bindmethod=simple credentials=secret
binddn="cn=Manager,dc=ent,dc=sequent,dc=com"
|
#复制入口点指向我们的 LDAP 从服务器。
从服务器 slapd.conf
除了是复制的以外,这和主服务器相同。只要主服务器有
replica伪指令,从服务器就有伪指令指示谁可以执行更新:
updatedn "cn=Manager,dc=ent,dc=sequent,dc=com"
|
参考资料
样本 OID 表示法
#
attributetype ( 2.16.840.1.113730.3.1.13
NAME 'mailLocalAddress'
DESC 'RFC822 email address of this recipient'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )
|
关于作者  | |  | IBM has authored this article |
对本文的评价
|  | IBM 公司保留在 developerWorks 网站上发表的内容的著作权。未经IBM公司或原始作者的书面明确许可,请勿转载。如果您希望转载,请通过 提交转载请求表单 联系我们的编辑团队。 |