Centos – phpldapadmin can not connect to openldap

centosopenldap

I have a freshly installed openldap server, version 2.4.39.
phpldapadmin is also installed on the same server, version 1.2.3

Openldap is working . I can connect to it using other ldap brower tools.

[root@openldap httpd]# slapd -V @(#) $OpenLDAP: slapd 2.4.39 (Mar  6 2015 04:35:49) $
mockbuild@worker1.bsys.centos.org:/builddir/build/BUILD/openldap-4.39/openldap-2.4.39/servers/slapd

[root@openldap httpd]# ldapsearch -x -W -D 'cn=admin,dc=cloud-lab,dc=com' -b "" -s base -H ldap://localhost
Enter LDAP Password: 
# extended LDIF
#
# LDAPv3
# base <> with scope baseObject
# filter: (objectclass=*)
# requesting: ALL
#
# dn: objectClass: top objectClass: OpenLDAProotDSE
# search result search: 2 result: 0 Success
# numResponses: 2
# numEntries: 1 

When I log into phpldapadmin through web brower. it shows the following error message. From the slapd.log I notice that, there is no connection from phpldapadmin process.

error   Unable to connect to LDAP server Cloud-Lab.Com
error: Can't contact LDAP server (-1) for user
error   Failed to Authenticate to server

Invalid Username or Password.

config.php from phpldapadmin:

$servers = new Datastore();
$servers->newServer('ldap_pla');
$servers->setValue('server','name','Cloud-Lab.Com');
$servers->setValue('server','host','127.0.0.1');
$servers->setValue('server','port',389);
$servers->setValue('server','base',array('dc=cloud-lab,dc=com'));
$servers->setValue('login','auth_type','session');
$servers->setValue('login','bind_id','cn=admin,dc=cloud-lab,dc=com');
$servers->setValue('login','bind_pass','secret');

Best Answer

I suspect the default SELinux configuration for CentOS is getting in the way.

# getsebool httpd_can_connect_ldap
httpd_can_connect_ldap --> off
# setsebool -P httpd_can_connect_ldap on
# getsebool httpd_can_connect_ldap
httpd_can_connect_ldap --> on
Related Topic