Kerberos+LDAP认证整合

来源:互联网 发布:中兴软件测试怎么样 编辑:程序博客网 时间:2024/05/22 09:14

请确保Kerberos和LDAP已经配置好了

参考个人写的文章:http://blog.csdn.net/ZhouyuanLinli/article/details/78323331


Kerberos+LDAP认证整合配置

方案:LDAP 账号管理,Kerberos进行认证。


1)采用该 LDAP作为用户认证。

只需要对用户 (如uid=test,ou=People,dc=example,dc=com)添加 userPassword成员即可。如果通过 命令行添加,需要先准备如下文件(userPassword对应的密码为123456):

dn: uid=test,ou=People,dc=example,dc=com

changetype: modify

add: userPassword

userPassword:: e1NTSEF9Ym0rZXloV1ExalB1aWNEVU1BaHlNM0hZVHh3REIrWU4K

然后执行命令

# ldapmodify -x -D 'cn=root,dc=example,dc=com' -w 12345678 -h 127.0.0.1 -f /tmp/test.ldif

命令执行成功后,通过

# ldapsearch -x -D 'uid=test,ou=People,dc=example,dc=com' -w 123456 127.0.0.1 -b 'ou=People,dc=example,dc=com'

确认。


2使用 Kerberos 认证

需要将用户的密码域做如下修改(userPassword 对应的密码由echo -n "{SASL}test@EXAMPLE.COM" | base64生成):

dn: uid=test,ou=People,dc=example,dc=com

changetype: modify

replace: userPassword

userPassword:: e1NBU0x9dGVzdEBFWEFNUExFLkNPTQ==

执行ldapmodify -x -D 'cn=root,dc=example,dc=com' -w 12345678 -h 127.0.0.1 -f /tmp/test.ldif应用该修改。


3)修改配置

# vim /etc/sysconfig/saslauthd

修改值

MECH=kerberos5

重启:service saslauthd restart


创建vim /etc/sasl2/slapd.conf文件

内容:

pwcheck_method: saslauthd

重启:service slapd restart


4)执行命令:service saslauthd status -l查看是否报错

 

执行如下操作:

# kadmin.local -q "ank -clearpolicy -randkey host/c2bde55"

# kadmin.local -q "ktadd host/c2bde55"

# service saslauthd restart

# ps -aux | grep saslauthd


# kadmin.local -q 'ank -pw 123456 test'

配置 test 用户的密码为:123456


# testsaslauthd -u test -p 123456

至此, Kerberos 认证测试成功。


执行 ldapsearch测试LDAP 认证是否成功

ldapsearch -x -D 'uid=test,ou=People,dc=example,dc=com' -w 123456 -h 127.0.0.1 -b 'ou=People,dc=example,dc=com'


参考链接:http://blog.clanzx.net/2013/09/27/ldap-kerberos.html



原创粉丝点击