2012-02-27 10 views
21

Sto cercando di utilizzare ldapsearch su SSL/TLS, ma non funziona:ldapsearch su SSL/TLS non funziona

ldapsearch -ZZ -d 5 -b "cn=Users,dc=my,dc=server,dc=com" -s sub -D 
"cn=mydevice,cn=Users,dc=my,dc=server,dc=com" -h my.server.com -p 3269 
-w "mypass" -x "(cn=test)" 

ldap_create 
ldap_url_parse_ext(ldap://my.server.com:3269) 
ldap_extended_operation_s 
ldap_extended_operation 
ldap_send_initial_request 
ldap_new_connection 1 1 0 
ldap_int_open_connection 
ldap_connect_to_host: TCP my.server.com:3269 
ldap_new_socket: 3 
ldap_prepare_socket: 3 
ldap_connect_to_host: Trying 10.199.46.70:3269 
ldap_connect_timeout: fd: 3 tm: -1 async: 0 
ldap_open_defconn: successful 
ldap_send_server_request 
ber_scanf fmt ({it) ber: 
ber_scanf fmt ({) ber: 
ber_flush: 31 bytes to sd 3 
ldap_result ld 0x95ff590 msgid 1 
wait4msg ld 0x95ff590 msgid 1 (infinite timeout) 
wait4msg continue ld 0x95ff590 msgid 1 all 1 
** ld 0x95ff590 Connections: 
* host: my.server.com port: 3269 (default) 
refcnt: 2 status: Connected 
last used: Mon Feb 27 10:59:43 2012 

** ld 0x95ff590 Outstanding Requests: 
* msgid 1, origid 1, status InProgress 
outstanding referrals 0, parent count 0 
** ld 0x95ff590 Response Queue: 
Empty 
ldap_chkResponseList ld 0x95ff590 msgid 1 all 1 
ldap_chkResponseList returns ld 0x95ff590 NULL 
ldap_int_select 
read1msg: ld 0x95ff590 msgid 1 all 1 
ber_get_next 
ldap_perror 
ldap_start_tls: Can't contact LDAP server (-1) 

Il messaggio di errore non dà indizio su ciò che è enought sbagliato. Al contrario, una semplice rilegatura e ricerca vanno bene senza problemi sulla porta 389.

Qualche suggerimento?

P.S. Ecco la mia ldap.conf:

TLS_REQCERT demand 
TLS_CACERT ./cacert.pem 

Ho anche provato a cambiare TLS_REQCERT a never, ma ancora non funziona. :-(

+1

Non sembra il suo tentativo di utilizzare TLS. È possibile utilizzare invece l'opzione -H con un URL LDAP: ldapsearch -ZZ -d 5 -b "cn = Utenti, dc = my, dc = server, dc = com" -s sub -D "cn = mydevice , cn = Utenti, dc = my, dc = server, dc = com "-H ldaps: //my.server.com: 3269 -w" mypass "-x" (cn = test) " – dearlbry

risposta

44

In primo luogo, sostituire -h my.server.com -p 3269 con -H ldaps://my.server.com:3269 come suggerito da @dearlbry

Poi, in /etc/openldap/ldap.conf (o /etc/ldap/ldap.conf sulla mia Ubuntu 13.04), disattivare la verifica del certificato aggiungendo questo:.

HOST my.server.com 
PORT 3269 
TLS_REQCERT ALLOW 

È anche possibile creare un file ldaprc nella directory corrente con lo stesso contenuto se non si desidera influenzare l'intero sistema

Questo wil l abilitare ldapsearch su SSL, ma senza verifica. Segui questi steps to add certificate validation nel mix.