ldaps does not work with ldapsearch

za flag

I'm running ldapsearch against a active directory server,

with ldap protocol it works:

ldapsearch -h IP -p 389 -b 'DC=testnet,DC=com' -D 'CN=admin,CN=Users,DC=testnet,DC=com' -w 'XX'

with ldaps protocol it fails:

ldapsearch -H ldaps:// -b 'DC=testnet,DC=com' -D 'CN=admin,CN=Users,DC=testnet,DC=com' -w 'XXX'

strace output:
connect(3, {sa_family=AF_INET, sin_port=htons(636), sin_addr=inet_addr("")}, 16) = 0
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)

From nmap both 389 and 636 ports are open, what was wrong?


A certificate is available on port 636:

# openssl s_client -connect -showcerts
Can't use SSL_get_servername
depth=0 CN =
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 CN =
verify error:num=21:unable to verify the first certificate
verify return:1
Certificate chain
 0 s:CN =
   i:DC = com, DC = testnet, CN = testnet-SRV1-CA
cn flag
Domain controllers do not have a certificate installed by default and do not listen on tcp/636 by default. Have you validated the certificate and that the DC is listening on tcp/636?
daisy avatar
za flag
@GregAskew In my environment, It's available by default. Edited question

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.