如何在OpenLDAP中configuration正确的凭据

我不明白如何在OpenLDAP服务器上configuration用户和密码。 我在这个问题中描述的是基于CentOS 7上的OpenLDAP 2.4的干净安装(通过yum)。

启动slapd我执行命令

 [root@papp ~]# slapcat -n0 | grep olcRootDN olcRootDN: cn=Manager,dc=my-domain,dc=com 

这告诉我,我们已经拥有了一个拥有dn cn=Manager,dc=my-domain,dc=com的root用户。 该用户没有设置密码。

 [root@papp ~]# slapcat -n0 | grep olcRootPW 

接下来我尝试手动设置密码:

 [root@papp ~]# ldappasswd -H ldap://localhost -x -D "dn=Manager,dc=my- domain,dc=com" -W -A -S Old password: (empty) Re-enter old password: (empty) New password: password Re-enter new password: password Enter LDAP Password: (what is that?? I use empty) ldap_bind: Invalid DN syntax (34) additional info: invalid DN 

这给了我一个无效的DN。 这是为什么 ? 我没有看到无效的DN。 这是否意味着我无法使用ldappasswd命令对OpenLDAP进行ldappasswd安装?

接下来我尝试上传一个模式文件

 # /tmp/pass.ldif dn: olcDatabase={0}config,cn=config changetype: modify replace: olcRootPW olcRootPW: password [root@papp ~]# ldapmodify -Y EXTERNAL -H ldapi:/// -f /tmp/pass.ldif SASL/EXTERNAL authentication started SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth SASL SSF: 0 modifying entry "olcDatabase={0}config,cn=config" 

现在已经设置了密码,因为我可以通过确认

 [root@papp ~]# slapcat -n0 | grep olcRootPW olcRootPW:: cGFzc3dvcmQ= 

然而,search仍然无法正常工作

 ldapsearch -D "cn=Manager,dc=my-domain,dc=com" -v -x -b '' -s base '(objectClass=*)' -w password ldap_bind: Invalid credentials (49) 

我也尝试使用Apache目录工作室来浏览我的LDAP树,但我只能使用“无身份validation”连接到LDAP。 只要我用dn = cn=Manager,dc=my-domain,dc=com使用简单身份validation,就会得到一个身份validation错误(凭据无效)。

那么首先是:不要设置明文密码,即使configuration以某种方式散列它。 首先使用slappasswd 。 其次,你不能使用ldappasswd作为目录pipe理器。 第三,我不确定,但有些东西告诉我其他的东西是错误configuration的,而且你还没有清楚说明你是如何改变你的olcRootDN的。

我试图重复你所做的,但不能重现相同的错误或问题。

 # yum install openldap-servers -y # systemctl start slapd # slappasswd New password: Re-enter new password: {SSHA}piJmuKxgnMh7DVBOQtCgz3/httcjc4kP # /tmp/manager.ldif dn: olcDatabase={0}config,cn=config changetype: modify replace: olcRootDN olcRootDN: cn=manager,dc=angelsofclockwork,dc=net - replace: olcRootPW olcRootPW: {SSHA}piJmuKxgnMh7DVBOQtCgz3/httcjc4kP # ldapmodify -QY EXTERNAL -H ldapi:/// -f /tmp/manager.ldif # ldapsearch -D "cn=Manager,dc=bromosapien,dc=net" -v -x -b '' -s base '(objectClass=*)' -W -h localhost ldap_initialize( ldap://localhost ) Enter LDAP Password: filter: (objectClass=*) requesting: All userApplication attributes # extended LDIF # # LDAPv3 # base <> with scope baseObject # filter: (objectClass=*) # requesting: ALL # # dn: objectClass: top objectClass: OpenLDAProotDSE # search result search: 2 result: 0 Success # numResponses: 2 # numEntries: 1 

您可能需要阅读指南以帮助您浏览/了解您需要采取的步骤。 http://www.angelsofclockwork.net/wiki/centos/openldap.html