- 论坛徽章:
- 0
|
(原创)
最近为了架构新的邮件系统和在企业内统一帐号的验证,研究了一下kerberosV和OpenLDAP的结合,来实现类似于Microsoft windows下的Active Directory的应用,总结了一些经验。
1,KerberosV的实现体,有MIT KerberosV,Heimdal,Shishi等,能够以LDAP做后台数据库的只有Heimdal。所以选用了Heimdal。
2,OpenLDAP相当完善,有的实现已经形成了LDAP的新的标准。Backend支持BerkeleyDB,LDBM,LDAP等。
3,Cyrus-SASL是广泛被采用的中间层验证接口库,Openldap的2.1.x以上的版本都采用Cyrus-SASL作为验证接口。
4,BerkeleyDB是广泛被采用的DB库构造,有很强的数据操作接口,可以很方便的实现应用。
我大体介绍安装BerkeleyDB+Cyrus-SASL+Heimdal+OpenLDAP的步骤:(这是一个实际的实现,我已经安装成功)
安装以下各包需要一些开发工具包,比如:gcc,bison,flex,awk等。
A.首先安装BerkeleyDB,我采用了最新的BerkeleyDB-4.3.21,可以到http://www.sleepycat.com上下载。
tar db-4.3.21.tar.gz
cd db-4.3.21/build_unix/
../dist/configure \
--prefix=/usr \
--enable-compat185 --enable-cxx --enable-tcl \
--with-tcl=/usr/lib --with-gnu-ld
make
make install
编译选项:
--enable-compat185 兼容通行的版本
--enable-cxx 支持C++API,(基本上没有意义,GCC各分支版本的C++差异很大)
--enable-tcl TCL支持
B. 安装Heimdal(第一次,不带OpenLDAP支持,但需要BerkeleyDB库)
./configure --prefix=/usr --libexecdir=/usr/sbin --sysconfdir=/etc --localstatedir=/var/heimdal \
--enable-shared --with-openssl=/usr
make
make install
编译选项
"--prefix=/usr --libexecdir=/usr/sbin --sysconfdir=/etc --localstatedir=/var/heimdal"皆为指定安装位置
--enable-shared 编译共享库
--with-openssl=/usr 指出Openssl安装的位置
C. Cyrus-SASL的安装配置(第一次)
./configure --prefix=/usr --enable-static --enable-gssapi=/usr --enable-login --enable-ntlm \
--with-dblib=berkeley --with-openssl=/usr --with-gss_impl=heimdal
make
make install
编译选项
--prefix=/usr 指定安装位置
--enable-static 编译静态链接库
--enable-gssapi=/usr 支持GSSAPI(Kerberos支持)
--enable-login 支持一些不标准的登录协议,比如Microsoft Outlook Express的用户验证需要。
--enable-ntlm 支持 Lan Manager,Microsoft网络验证支持
--with-dblib=berkeley 指出使用的DB库类型为BerkeleyDB
--with-openssl=/usr 指出Openssl安装的位置
--with-gss_impl=heimdal 支持使用GSSAPI的类型为Heimdal
这时,可以添加环境变量:export SASL_PATH=/usr/lib/sasl2
D. OpenLDAP的安装配置
注意:OpenLDAP后台使用BerkeleyDB4.3需要打补丁,打完补丁后需要用autoconf重新生成Configure文件。
autoconf需要使用指定的autoconf-2.13.1版本。
先安装autoconf
tar -zxvf autoconf-2.13.1.tar.gz
cd autoconf-2.13.1
./configure --prefix=/root/autoconf
make
make install
tar -zxvf openldap-2.2.18.tgz
cd openldap-2.2.18
patch -Np1 -i ../cachefix.diff
patch -Np1 -i ../bdb4-3.diff
/root/autoconf/bin/autoconf
./configure --prefix=/usr --libexecdir=/usr/sbin --sysconfdir=/etc \
--localstatedir=/var/lib --enable-syslog --enable-local \
--with-cyrus-sasl --with-threads --with-tls --with-kerberos \
--enable-crypt --enable-lmpasswd --enable-spasswd --enable-modules \
--enable-hdb --enable-ldap --enable-monitor --enable-dyngroup --enable-proxycache
make depend
make
make test
make install
补丁在 Stanford的ITSS网站上:
http://www.stanford.edu/services ... guration/index.html
OpenLDAP的编译选项
./configure --prefix=/usr --libexecdir=/usr/sbin --sysconfdir=/etc --localstatedir=/var/lib 指出安装位置
--enable-local 本地Unix IPC 支持,这个选项对Heimdal以OpenLDAP为后台数据库很重要,一定要带上
--with-kerberos 这个选项不是标准选项,help列表里已经没有了,OpenLDAP已经移除了这个选项,但这个选项对Heimdal以OpenLDAP为后台数据库很重要,一定要带上
--with-cyrus-sasl 支持SASL中间层验证,LDAPv3的标准,没有它就是LDAPv2了。
--with-threads 线程支持,在使用MIT kerberos的情况下是不安全的。
--with-tls TLS支持,支持传输加密。
--enable-crypt 字加密支持
--enable-lmpasswd Mirosoft口令验证协议NTLM支持(包括以上的SASL中的编译选项,是为windows 客户端以Heimdal作验证做准备)
--enable-spasswd SASL校验支持
--enable-modules 模块化支持
E. 重新安装Heimdal以支持OpenLDAP.
./configure --prefix=/usr --libexecdir=/usr/sbin --sysconfdir=/etc --localstatedir=/var/lib/heimdal \
--enable-shared --with-openssl=/usr --with-openldap=/usr
make
make install
编译选项
--with-openldap=/usr 指出OpenLDAP安装的位置
其他解释同上。
F. 重新安装Cyrus-SASL
./configure --prefix=/usr --enable-static --enable-gssapi=/usr --enable-login --enable-ntlm \
--with-dblib=berkeley --with-openssl=/usr --with-gss_impl=heimdal --with-ldap=/usr
make
make install
编译选项
--with-ldap=/usr 指出OpenLDAP安装的位置
其他解释同上。
好,4个包都安装好了,下一步就是配置了,
a,首先要配置好OpenLDAP的slapd.conf了,还要加入 krb5-kdc.schema在里边,可以在
Stanford的ITSS网站上:
http://www.stanford.edu/services ... guration/index.html
找到。
导入支持kerberos的基本LDIF
b,在/etc下建立krb5.conf文件
c,然后初始化kdc的库
c,调整slapd.conf配置
好,Ok 开始检测。
以上是我在实现上的一些经验,如果有需要配置的详情,我可以另贴一个帖子,如有错误请指正,谢谢。franktian@163.com
[ 本帖最后由 miceleo 于 2006-1-8 13:22 编辑 ] |
|