2

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) $
[email protected]:/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');

3 Answers 3

2

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
1

I was facing the same issue in CentOS 7. Once SELinux configuration is modified using the below command, resolved this issue.

setsebool -P httpd_can_connect_ldap on
-2

Disable SELinux
vi /etc/selinux/config

SELINUX=enforce >> SELINUX=disabled
SELINUXTYPE=targeted >> # SELINUXTYPE=targeted

save and reboot

1
  • While this is an working answer, disabling security settings should in my opinion only be used in testing enviroments for troubleshooting, never as a default option to get something working. instead one should rather fix the issue as written by the other 2 answers with the parameter you have to change in SELinux configuration May 29, 2018 at 7:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .