2013-03-22 256 views
7

我在运行OpenLDAP 2.4-28 on XUBUNTU 12.04。ldap_bind:无效的证书(49)

我在阅读“掌握OpenLDAP”并配合本书一起配置。

当我尝试执行下面的搜索(第47页):

$ ldapsearch -x -W -D 'cn=Manager,dc=example,dc=com' -b "" -s base 

提示我输入密码。然后我进入 “秘密”,但我得到了以下错误:

ldap_bind: Invalid Credentials (49). 

以下是我的slapd.conf

# slapd.conf - Configuration file for LDAP SLAPD 
########## 
# Basics # 
########## 
include /etc/ldap/schema/core.schema 
include /etc/ldap/schema/cosine.schema 
include /etc/ldap/schema/inetorgperson.schema 
pidfile /var/run/slapd/slapd.pid 
argsfile /var/run/slapd/slapd.args 
loglevel none 
modulepath /usr/lib/ldap 
# modulepath /usr/local/libexec/openldap 
moduleload back_hdb 

########################## 
# Database Configuration # 
########################## 
database hdb 
suffix "dc=example,dc=com" 
rootdn "cn=Manager,dc=example,dc=com" 
rootpw secret 
directory /var/lib/ldap 
# directory /usr/local/var/openldap-data 
index objectClass,cn eq 

######## 
# ACLs # 
######## 
access to attrs=userPassword 
    by anonymous auth 
    by self write 
    by * none 
access to * 
    by self write 
    by * none 

,这里是在ldap.conf:

# LDAP Client Settings 
URI ldap://localhost 
BASE dc=example,dc=com 
BINDDN cn=Manager,dc=example,dc=com 
SIZELIMIT 0 
TIMELIMIT 0 

顺祝商祺 Ali Reza

+0

有点相关:http://wiki.openiam.com/pages/viewpage.action?pageId=7635198 – cregox 2014-08-11 21:17:10

+0

你有没有找到这个@alibaba的答案?我收到了同样的错误。 – Matt 2015-03-20 21:48:28

回答

10

我没有看到一个明显的问题波夫。

这是可能ldap.conf被覆盖,但命令行选项的优先级,ldapsearch将在主ldap.conf忽略BINDDN,这样可能是错误的唯一参数是URI。 (顺序是ETCDIR/ldap.conf然后~/ldaprc~/.ldaprc,然后在当前目录ldaprc,虽然有环境变量可以影响这个也看man ldapconf。)

尝试一个明确的URI:

ldapsearch -x -W -D 'cn=Manager,dc=example,dc=com' -b "" -s base -H ldap://localhost 

或防止违约:

LDAPNOINIT=1 ldapsearch -x -W -D 'cn=Manager,dc=example,dc=com' -b "" -s base 

如果这不起作用,那么一些麻烦eshooting(你可能需要的完整路径slapd二元这些):

  • 确保您slapd.conf正在使用,正确的是(根)

    slapd -T test -f slapd.conf -d 65535

    可能有剩余或默认slapd.d配置目录它优先于您的slapd.conf(除非您明确指定您的配置与-f,slapd.conf正式dep在OpenLDAP-2.4中进行了修改)。如果你没有得到几页输出,那么你的二进制文件被编译为而没有调试支持。

  • 停止OpenLDAP的,然后手动在一个单独的终端/主机与调试启用(如根,^ C退出)

    slapd -h ldap://localhost -d 481

    然后重试的搜索,看是否可以当场问题开始slapd(不幸的是,输出开始时会有很多模式噪声)。 (注:没有-u/-g选项运行slapd可以更改文件所有权可能导致问题,你通常应该使用这些选项,可能-u ldap -g ldap

  • 如果启用调试,然后尝试也

    ldapsearch -v -d 63 -W -D 'cn=Manager,dc=example,dc=com' -b "" -s base