2

I'm trying to leverage my existing (fully configured and working) Samba AD DC as authentication for XWiki, and other apps.

As such, I'm first trying to do a successful ldapsearch from the XWiki server. The following command works on the Samba server, but not on the XWiki client:

ubuntu@xwiki:~$ ldapsearch -x -LLL -E pr=200/noprompt -H ldaps://10.0.1.191/ -D "CN=Administrator,CN=Users,DC=ad,DC=nitssolutions,DC=com" -w 'SambaNovi2018' -b 'DC=ad,DC=nitssolutions,DC=com' -s sub '(sAMAccountName=*)' cn mail memberOf
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)

However, if I do:

ping 10.0.1.191

I get:

ubuntu@xwiki:~$ ping 10.0.1.191
PING 10.0.1.191 (10.0.1.191) 56(84) bytes of data.
64 bytes from 10.0.1.191: icmp_seq=1 ttl=64 time=135 ms
64 bytes from 10.0.1.191: icmp_seq=2 ttl=64 time=138 ms
64 bytes from 10.0.1.191: icmp_seq=3 ttl=64 time=146 ms
^C
--- 10.0.1.191 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 135.741/140.317/146.970/4.832 ms

and if I do:

telnet 10.0.1.191 636

I'm able to connect.

EDIT: Additional information:

I added a -d 1 to the ldapsearch command line, and now I get:

ubuntu@xwiki:~$ ldapsearch -d 1 -x -LLL -E pr=200/noprompt -H ldaps://10.0.1.191/ -D "CN=Administrator,CN=Users,DC=ad,DC=nitssolutions,DC=com" -w 'SambaNovi2018' -b 'DC=ad,DC=nitssolutions,DC=com' -s sub '(sAMAccountName=*)' cn mail memberOf
ldap_url_parse_ext(ldaps://10.0.1.191/)
ldap_create
ldap_url_parse_ext(ldaps://10.0.1.191:636/??base)
ldap_sasl_bind
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP 10.0.1.191:636
ldap_new_socket: 3
ldap_prepare_socket: 3
ldap_connect_to_host: Trying 10.0.1.191:636
ldap_pvt_connect: fd: 3 tm: -1 async: 0
attempting to connect:
connect success
TLS: peer cert untrusted or revoked (0x42)
TLS: can't connect: (unknown error code).
ldap_err2string
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)

Note, in particular, this line:

TLS: peer cert untrusted or revoked (0x42)

I'm going to try researching this error further, but as of now, I'm still stuck...

EDIT2: Still more additional information:

When I run this command, with the -d 1 parameter on the Samba server, the command works, in spite of having the:

TLS: peer cert untrusted or revoked (0x42)

in the debug output....

Continuing to dig....

Help?

Mark J. Bobak
  • 13,720
  • 6
  • 39
  • 67

1 Answers1

3

And here I go, answering my own question again...sigh. I should post here more often. Helps me clearly lay out the problem, which inevitably leads to finding a solution.

Anyhow, the solution was: I had a file, /etc/ldap/ldap.conf on my sambadc machine as well as my xwiki client machine, but the content differed. The sambadc machine had:

#
# 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

# TLS certificates (needed for GnuTLS)
#TLS_CACERT     /etc/ssl/certs/ca-certificates.crt
TLS_REQCERT allow

Which worked.

But, my xwiki machine had:

#
# 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

# TLS certificates (needed for GnuTLS)
TLS_CACERT     /etc/ssl/certs/ca-certificates.crt

which failed.

When I commented out the TLS_CACERT line, and added the TLS_REQCERT line, it all started working as expected.

Mark J. Bobak
  • 13,720
  • 6
  • 39
  • 67