I don't explain how to configure tls-ldap on server, on google there is a lot of stuff to configure it(create tls certs, create ldif, import ldif, try ldapsearch -ZZ, etc..). Is also easy to force the tls from server, so connection without -Z or -ZZ are refused
ldapsearch -LLL -D "cn=ldapadm,dc=ldap1,dc=mydom,dc=priv" -wPASSWORD -b dc=ldap1,dc=mydom,dc=priv uidNumber=10009 uidNumber
ldap_bind: Confidentiality required (13)
additional info: TLS confidentiality required
with ldapsearch using -Z is ok
ldapsearch -Z -LLL -D "cn=ldapadm,dc=ldap1,dc=mydom,dc=priv" -wPASSWORD -b dc=ldap1,dc=mydom,dc=priv uidNumber=10009 uidNumber
dn: sambaSID=S-1-5-21-38458588-165473958-13245875-1289,ou=idmap,dc=ldap1,dc=mydom,dc=priv
uidNumber: 10009
I have force TLS using this ldif on server
dn: olcDatabase={1}mdb,cn=config
changetype: modify
add: olcSecurity
olcSecurity: tls=1
Now the problem, even with the tls force the password can be sniffed from the lan
I run the command without -Z, connection is refused
ldapsearch -LLL -D "cn=ldapadm,dc=ldap1,dc=mydom,dc=priv" -wPASSWORD -b dc=ldap1,dc=mydom,dc=priv uidNumber=10009 uidNumber
ldap_bind: Confidentiality required (13)
additional info: TLS confidentiality required
but tcpdump can see the password!
tcpdump -i any port 389 -vvv -Xx|egrep --colour cn= -A 11
tcpdump: listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
blah blah blah blah blah blah blah blah blah blah .`7...."cn=ldapa
blah blah blah blah blah blah blah blah blah blah dm,dc=ldap1,dc=m
blah blah blah blah blah blah blah blah blah blah ydom,dc=priv..PAS
blah blah blah blah blah blah blah blah blah blah SSWORDCLEAR!
....
The question is simple, is possible to force ldapsearch and all ldap clients to use -Z when tls is forced on server? If not possible as it seems, I can propose some "ideas"
1)An rc file with options for ldap clients which contain the options to pass for clients, for example
LDAPSEARCH_OPTIONS="-ZZ"
2)A mechanism wich recognize the tls forced server and automatic enable the -ZZ with the exception for localhost or ldapi.