ldap_bind:凭据无效 (49)

ldap_bind:凭据无效 (49)

我正在尝试设置一个 openLdap 服务器,在按照说明进行操作后,我陷入了无法添加任何数据的境地。

我得到的错误是

ldap_bind: Invalid credentials (49)

请帮助我解决这个问题。阅读调试数据和slapd.conf文件时请耐心等待,因为它们相当长。

我的系统是:Red Hat Enterprise Linux 6.0
使用安装了 openLdap yum openldap*

这是我的slapd.conf文件:

#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#

include     /etc/openldap/schema/corba.schema
include     /etc/openldap/schema/core.schema
include     /etc/openldap/schema/cosine.schema
include     /etc/openldap/schema/duaconf.schema
include     /etc/openldap/schema/dyngroup.schema
include     /etc/openldap/schema/inetorgperson.schema
include     /etc/openldap/schema/java.schema
include     /etc/openldap/schema/misc.schema
include     /etc/openldap/schema/nis.schema
include     /etc/openldap/schema/openldap.schema
include     /etc/openldap/schema/ppolicy.schema
include     /etc/openldap/schema/collective.schema

# Allow LDAPv2 client connections.  This is NOT the default.
allow bind_v2

# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral   ldap://root.openldap.org

pidfile     /var/run/openldap/slapd.pid
argsfile    /var/run/openldap/slapd.args

# Load dynamic backend modules:
# Module syncprov.la is now statically linked with slapd and there
# is no need to load it here
# modulepath    /usr/lib/openldap # or /usr/lib64/openldap
# moduleload accesslog.la
# moduleload auditlog.la
## To load this module, you have to install openldap-server-sql first
# moduleload back_sql.la
## Following two modules can't be loaded simultaneously
# moduleload dyngroup.la
# moduleload dynlist.la
# moduleload lastmod.la
# moduleload pcache.la
# moduleload ppolicy.la
# moduleload refint.la
# moduleload retcode.la
# moduleload rwm.la
# moduleload translucent.la
# moduleload unique.la
# moduleload valsort.la

# The next three lines allow use of TLS for encrypting connections using a
# dummy test certificate which you can generate by changing to
# /etc/pki/tls/certs, running "make slapd.pem", and fixing permissions on
# slapd.pem so that the ldap user or group can read it.  Your client software
# may balk at self-signed certificates, however.
# TLSCACertificateFile /etc/pki/tls/certs/ca-bundle.crt
# TLSCertificateFile /etc/pki/tls/certs/slapd.pem
# TLSCertificateKeyFile /etc/pki/tls/certs/slapd.pem

# Sample security restrictions
#   Require integrity protection (prevent hijacking)
#   Require 112-bit (3DES or better) encryption for updates
#   Require 63-bit encryption for simple bind
# security ssf=1 update_ssf=112 simple_bind=64

# Sample access control policy:
#   Root DSE: allow anyone to read it
#   Subschema (sub)entry DSE: allow anyone to read it
#   Other DSEs:
#       Allow self write access
#       Allow authenticated users read access
#       Allow anonymous users to authenticate
#   Directives needed to implement policy:
# access to dn.base="" by * read
# access to dn.base="cn=Subschema" by * read
# access to *
#   by self write
#   by users read
#   by anonymous auth
#
# if no access controls are present, the default policy
# allows anyone and everyone to read anything but restricts
# updates to rootdn.  (e.g., "access to * by * read")
#
# rootdn can always read and write EVERYTHING!

#######################################################################
# ldbm and/or bdb database definitions
#######################################################################

database    bdb
suffix dc=ttsbroot,dc=teleotele
#checkpoint 1024 15
rootdn cn=shamal,dc=ttsbroot,dc=teleotele
# Cleartext passwords, especially for the rootdn, should
# be avoided.  See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
rootpw {crypt}49/WKVk.6oz3o
# rootpw        secret
# rootpw        {crypt}ijFYNcSNctBYg

# The database directory MUST exist prior to running slapd AND 
# should only be accessible by the slapd and slap tools.
# Mode 700 recommended.
directory   /var/lib/ldap

# Indices to maintain for this database
index objectClass                       eq,pres
index ou,cn,mail,surname,givenname      eq,pres,sub
index uidNumber,gidNumber,loginShell    eq,pres
index uid,memberUid                     eq,pres,sub
index nisMapName,nisMapEntry            eq,pres,sub

# Replicas of this database
#replogfile /var/lib/ldap/openldap-master-replog
#replica host=ldap-1.example.com:389 starttls=critical
#     bindmethod=sasl saslmech=GSSAPI
#     authcId=host/[email protected]


# enable monitoring
database monitor

# allow onlu rootdn to read the monitor
access to * by * write by * read by * search by * auth

我正在添加添加参数时返回的调试数据-d 255

[root@TTSBROOT Documents]# ldapadd -D "cn=shamal,dc=TTSBROOT,dc=teleotele" -W -x -a -f teleotele.ldif -d 255
ldap_create
Enter LDAP Password: 
ldap_sasl_bind
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP localhost:389
ldap_new_socket: 4
ldap_prepare_socket: 4
ldap_connect_to_host: Trying 127.0.0.1:389
ldap_pvt_connect: fd: 4 tm: -1 async: 0
ldap_open_defconn: successful
ldap_send_server_request
ber_scanf fmt ({it) ber:
ber_dump: buf=0x18345d0 ptr=0x18345d0 end=0x1834612 len=66
  0000:  30 84 00 00 00 3c 02 01  01 60 84 00 00 00 33 02   0....<...`....3.  
  0010:  01 03 04 22 63 6e 3d 73  68 61 6d 61 6c 2c 64 63   ..."cn=shamal,dc  
  0020:  3d 54 54 53 42 52 4f 4f  54 2c 64 63 3d 74 65 6c   =TTSBROOT,dc=tel  
  0030:  65 6f 74 65 6c 65 80 0a  73 68 61 6d 61 6c 31 32   eotele..shamal12  
  0040:  33 34                                              34                
ber_scanf fmt ({i) ber:
ber_dump: buf=0x18345d0 ptr=0x18345d9 end=0x1834612 len=57
  0000:  60 84 00 00 00 33 02 01  03 04 22 63 6e 3d 73 68   `....3...."cn=sh  
  0010:  61 6d 61 6c 2c 64 63 3d  54 54 53 42 52 4f 4f 54   amal,dc=TTSBROOT  
  0020:  2c 64 63 3d 74 65 6c 65  6f 74 65 6c 65 80 0a 73   ,dc=teleotele..s  
  0030:  68 61 6d 61 6c 31 32 33  34                        hamal1234         
ber_flush2: 66 bytes to sd 4
  0000:  30 84 00 00 00 3c 02 01  01 60 84 00 00 00 33 02   0....<...`....3.  
  0010:  01 03 04 22 63 6e 3d 73  68 61 6d 61 6c 2c 64 63   ..."cn=shamal,dc  
  0020:  3d 54 54 53 42 52 4f 4f  54 2c 64 63 3d 74 65 6c   =TTSBROOT,dc=tel  
  0030:  65 6f 74 65 6c 65 80 0a  73 68 61 6d 61 6c 31 32   eotele..shamal12  
  0040:  33 34                                              34                
ldap_write: want=66, written=66
  0000:  30 84 00 00 00 3c 02 01  01 60 84 00 00 00 33 02   0....<...`....3.  
  0010:  01 03 04 22 63 6e 3d 73  68 61 6d 61 6c 2c 64 63   ..."cn=shamal,dc  
  0020:  3d 54 54 53 42 52 4f 4f  54 2c 64 63 3d 74 65 6c   =TTSBROOT,dc=tel  
  0030:  65 6f 74 65 6c 65 80 0a  73 68 61 6d 61 6c 31 32   eotele..shamal12  
  0040:  33 34                                              34                
ldap_result ld 0x182c3e0 msgid 1
wait4msg ld 0x182c3e0 msgid 1 (infinite timeout)
wait4msg continue ld 0x182c3e0 msgid 1 all 1
** ld 0x182c3e0 Connections:
* host: localhost  port: 389  (default)
  refcnt: 2  status: Connected
  last used: Fri Apr 22 14:24:17 2011


** ld 0x182c3e0 Outstanding Requests:
 * msgid 1,  origid 1, status InProgress
   outstanding referrals 0, parent count 0
  ld 0x182c3e0 request count 1 (abandoned 0)
** ld 0x182c3e0 Response Queue:
   Empty
  ld 0x182c3e0 response count 0
ldap_chkResponseList ld 0x182c3e0 msgid 1 all 1
ldap_chkResponseList returns ld 0x182c3e0 NULL
ldap_int_select
read1msg: ld 0x182c3e0 msgid 1 all 1
ber_get_next
ldap_read: want=8, got=8
  0000:  30 84 00 00 00 10 02 01                            0.......          
ldap_read: want=14, got=14
  0000:  01 61 84 00 00 00 07 0a  01 31 04 00 04 00         .a.......1....    
ber_get_next: tag 0x30 len 16 contents:
ber_dump: buf=0x1835a50 ptr=0x1835a50 end=0x1835a60 len=16
  0000:  02 01 01 61 84 00 00 00  07 0a 01 31 04 00 04 00   ...a.......1....  
read1msg: ld 0x182c3e0 msgid 1 message type bind
ber_scanf fmt ({eAA) ber:
ber_dump: buf=0x1835a50 ptr=0x1835a53 end=0x1835a60 len=13
  0000:  61 84 00 00 00 07 0a 01  31 04 00 04 00            a.......1....     
read1msg: ld 0x182c3e0 0 new referrals
read1msg:  mark request completed, ld 0x182c3e0 msgid 1
request done: ld 0x182c3e0 msgid 1
res_errno: 49, res_error: <>, res_matched: <>
ldap_free_request (origid 1, msgid 1)
ldap_parse_result
ber_scanf fmt ({iAA) ber:
ber_dump: buf=0x1835a50 ptr=0x1835a53 end=0x1835a60 len=13
  0000:  61 84 00 00 00 07 0a 01  31 04 00 04 00            a.......1....     
ber_scanf fmt (}) ber:
ber_dump: buf=0x1835a50 ptr=0x1835a60 end=0x1835a60 len=0

ldap_msgfree
ldap_err2string
ldap_bind: Invalid credentials (49)

答案1

错误代码49表示密码错误!请确保您在创建 crypt-hash 时输入了相同的密码。也许您想调试这部分并在以下位置使用明文密码而不是哈希slapd.conf

rootpw {crypt}49/WKVk.6oz3o

顺便提一句。您使用哪个 ldap 版本?据我所知,它支持更好的哈希机制,例如 MD5 或 SHA1。不确定,但/你的加密货币哈希值可能有问题!?

答案2

要排除密码问题,为什么不在conf 文件中尝试使用明文简单密码并重新启动 LDAP?

相关内容