Estou usando um Centos 6.6 e estou tentando usar o ldapsearch para conectar ao meu servidor de anúncios do Windows e não consigo me conectar usando a porta 636.
Eu exportei o certificado raiz da CA do meu servidor de anúncios em base64 e adicionei-o ao diretório do certificado ldap (a.cer)
meu /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
quando tento me conectar com 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)
O ldapsearch com a porta 389 está funcionando:
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
Eu devo ter feito algo errado com o certificado, a ajuda seria muito apreciada.
Por favor, deixe-me saber se eu esqueci alguma coisa e se você quiser que eu adicione mais informações