我正在使用 Centos 6.6,并尝试使用 ldapsearch 连接到我的 Windows 广告服务器,但我无法使用端口 636 进行连接。
我以 base64 格式导出了我的广告服务器的 CA 根证书,并将其添加到 ldap 证书目录 (a.cer)
我的 /etc/openldap/ldap.conf
# LDAP Defaults
#
# See ldap.conf(5) for details
# This file should be world readable but not world writable.
#BASE dc=example,dc=com
#URI ldap://ldap.example.com ldap://ldap-master.example.com:666
#SIZELIMIT 12
#TIMELIMIT 15
#DEREF never
PORT 636
TLS_REQCERT demand
TLS_CERT /etc/openldap/certs/a.cer
TLS_CACERTDIR /etc/openldap/certs
当我尝试连接 ldaps 时:
ldapsearch -x -H 'ldaps://myadserv.intranet.mydom.com' -D 'userx' -W sAMAccountName=userx -b "dc=intranet,dc=mydom,dc=com" 'uid=user' -d1
ldap_url_parse_ext(ldaps://myadserv.intranet.mydom.com)
ldap_create
ldap_url_parse_ext(ldaps://myadserv.intranet.mydom.com:636/??base)
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 myadserv.intranet.mydom.com:636
ldap_new_socket: 3
ldap_prepare_socket: 3
ldap_connect_to_host: Trying 10.32.20.24:636
ldap_pvt_connect: fd: 3 tm: -1 async: 0
attempting to connect:
connect success
TLS: certdb config: configDir='/etc/openldap/certs' tokenDescription='ldap(0)' certPrefix='' keyPrefix='' flags=readOnly
TLS: using moznss security dir /etc/openldap/certs prefix .
TLS: certificate [CN=myadserv.intranet.mydom.com] is not valid - error -8179:Peer's Certificate issuer is not recognized..
TLS: error: connect - force handshake failure: errno 22 - moznss error -8179
TLS: can't connect: TLS error -8179:Peer's Certificate issuer is not recognized..
ldap_err2string
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
端口 389 的 ldapsearch 正在运行:
ldapsearch -h myadserv.intranet.mydom.com -p 389 -D userx -w 'password' -b "dc=intranet,dc=mydom,dc=com" 'uid=user'
# extended LDIF
#
# LDAPv3
# base <dc=intranet,dc=mydom,dc=com> with scope subtree
# filter: uid=user
# requesting: ALL
#
# search reference
ref: ldap://ForestDnsZones.intranet.mydom.com/DC=ForestDnsZones,DC=intran
et,DC=mydom,DC=com
# search reference
ref: ldap://DomainDnsZones.intranet.mydom.com/DC=DomainDnsZones,DC=intran
et,DC=mydom,DC=com
# search reference
ref: ldap://intranet.mydom.com/CN=Configuration,DC=intranet,DC=mydom
,DC=com
# search result
search: 2
result: 0 Success
# numResponses: 4
# numReferences: 3
我肯定对证书做了一些错误的事情,如果能得到帮助我将非常感激。
如果我忘记了什么,或者你想让我添加更多信息,请告诉我