Skip to Content

LDAP search error Cannot contact LDAP server

Error: LDAP search error: Can't contact LDAP server

1. Append log_level trace in /usr/local/etc/ezlogin/ez.conf to get the debug log.

root@gateway ~]# vim /usr/local/etc/ezlogin/ez.conf

log_level trace

2. Tail the latest application log to see the detailed error log.

root@gateway ~]# cd $(awk '/^system_folder/ {print $2}' /usr/local/etc/ezlogin/ez.conf)/application/logs/

Refer below example to tail application log

root@gateway ~]# cd $(awk '/^system_folder/ {print $2}' /usr/local/etc/ezlogin/ez.conf)/application/logs/

root@gateway ~]# ls

log-2022-02-03.php log-2022-02-05.php log-2022-04-16.php

root@gateway ~]# tail -f log-2022-04-16.php

3. You can find below error from application log

DEBUG - 2022-04-28 08:56:00 --> uri: ldap://192.168.1.100
DEBUG - 2022-04-28 08:56:00 --> Connected: ldap://192.168.1.100
DEBUG - 2022-04-28 08:56:00 --> No StartTLS
DEBUG - 2022-04-28 08:56:00 --> Bind as: CN=Administrator,CN=Users,DC=cloudweg,DC=com
DEBUG - 2022-04-28 08:56:00 --> Bind successful
DEBUG - 2022-04-28 08:56:00 --> Filter: (sAMAccountName=*)
DEBUG - 2022-04-28 08:56:00 --> LDAP attributes queried: Array
(
   [0] => sAMAccountName
   [1] => displayName
   [2] => userPrincipalName
)

ERROR - 2022-04-28 08:56:00 --> LDAP search error: Can't contact LDAP server
DEBUG - 2022-04-28 08:56:00 --> AJAX response sent

Make sure to use the correct base dn in Ezeelogin GUI.

4. Run ldapsearch to ensure that results are correctly fetched from the LDAP server.

root@gateway ~]# ldapsearch -v -x -H ldap://192.168.1.100 -b "DC=cloudweg,DC=com" -D "CN=Administrator,CN=Users,DC=cloudweg,DC=com" -W

5. ldapsearch will list the details of all users present in the base dn.

Refer below example:

# jake, cloudweg.com
dn: CN=jake,DC=cloudweg,DC=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: user
cn: jake
distinguishedName: CN=jake,DC=cloudweg,DC=com
instanceType: 4
whenCreated: 20220402134641.0Z
whenChanged: 20220402134844.0Z
displayName: jake
uSNCreated: 20577
uSNChanged: 20585
name: jake
objectGUID:: YBID4j+LM06zE9V+aOwVBw==
userAccountControl: 66048
badPwdCount: 0
codePage: 0
countryCode: 0
badPasswordTime: 0
lastLogoff: 0
lastLogon: 0
pwdLastSet: 132933808016965684
primaryGroupID: 513
objectSid:: AQUAAAAAAAUVAAAAVypHCV5jLN3fP7biUAQAAA==
accountExpires: 9223372036854775807
logonCount: 0
sAMAccountName: jake
sAMAccountType: 805306368
userPrincipalName: [email protected]
objectCategory: CN=Person,CN=Schema,CN=Configuration,DC=cloudweg,DC=com
dSCorePropagationData: 20220402134641.0Z
dSCorePropagationData: 16010101000000.0Z

  Copy-paste the base dn and paste it in Ezeelogin GUI -> Settings -> LDAP -> Edit. Refer below screenshot.

6. After successfully saving LDAP settings navigate to Users -> LDAP and import the users to Ezeelogin by clicking on the option on the right side. Refer below screenshot.

 

 

Related Articles

Can we map existing user group in ldap to ezeelogin as ezeelogin user group ?

Assigning user group for LDAP users?