Ldap_bind () freeze / freeze

So, I reduced my problem to a simple PHP script

test.php

<?php 
  ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7); //for logging
  if($con = ldap_connect( 'ldaps:domain.com', 636 )){
    $bind_return = ldap_bind($con, 'username', 'super_secret_password');
  }
?>

When I go to localhost\test.php, the browser indicates that it is waiting for an answer, and will just hang there ... forever (more precisely, until I stop it, sometimes in an hour, but you get the idea) Using xdebug, I can determine exactly how hanging on a call ldap_bind(). When I try to go either to the ldap_bind () line of code, my xdebug freezes and becomes unresponsive.

Recorded output from ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);:

ldap_create
ldap_url_parse_ext(domain.com)
ldap_bind_s
ldap_simple_bind_s
ldap_sasl_bind_s
ldap_sasl_bind
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP domain.com:636
ldap_new_socket: 15
ldap_prepare_socket: 15
ldap_connect_to_host: Trying domain.com:636
ldap_pvt_connect: fd: 15 tm: -1 async: 0

And then nothing after that. I'm not sure what to do about it, and Google was not kind.

ldap_connect() , - - (resource) resource id='2' type='ldap link'. max_execution_time script. - while(true){} , max_execution_time, . , ldap_bind() - php -. try/catch , .

:

1) ,

2) php5, php-ldap, libapache2-mod-php5 apache2

3)

, ldap_bind() , , , , . .

UPDATE:

, ldap-utils ldapsearch -H ldaps://domain.com, . ldapsearch -d 1 -H ldaps://domain.com, :

ldap_url_parse_ext(ldaps://domain.com/)
ldap_create
ldap_url_parse_ext(ldaps://domain.com:636/??base)
ldap_pvt_sasl_getmech
ldap_search
put_filter: "(objectclass=*)"
put_filter: simple
put_simple_filter: "objectclass=*"
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP domain.com:636
ldap_new_socket: 3
ldap_prepare_socket: 3
ldap_connect_to_host: Trying domain.com:636
ldap_pvt_connect: fd: 3 tm: -1 async: 0
^^^^It hangs right here^^^^

, ? strace ,

write(3, "\26\3\0\0p\1\0\0l\3\3T\254/\31\24\200\25 \247\221\7\251\240\271\35\"\272\203V \305"..., 117) = 117
read(3,  

, , "read(3,"

openldap, , strace, . , , , openldap gnuTLS.

+4
2

, - . , , SSL-, LDAP- ..

, ISO.

telnet 636 . , openldap . , . , ( ) , ldap_pvt_connect. , , , - .

+1

, . slapd , -, "localhost" "domain.com" ldap_connect() , IP-.

0

Source: https://habr.com/ru/post/1570092/


All Articles