Skip to content

Troubleshoot LDAP & AD Connection Issues in Mideye

LDAP/Active Directory connectivity issues prevent Mideye Server from authenticating users and retrieving user attributes such as phone numbers. Most LDAP configuration is managed through LDAP Profiles in the web interface.

Mideye Server connects to LDAP/AD for:

  • User authentication — Validating credentials
  • User lookup — Finding users and retrieving attributes (phone number, email)
  • Group membership — Checking authorization groups

Connection issues typically fall into these categories:

  1. Network connectivity (firewalls, DNS)
  2. TLS/certificate issues (LDAPS)
  3. Credential or permission issues
  4. Search filter or attribute mapping
  5. Stale connections in load-balanced environments

Problem: Mideye Server cannot reach the LDAP server.

Symptoms:

  • “Connection timed out” in logs
  • Slow authentication or no authentication
  • Web interface shows LDAP connection error

Diagnostic Steps:

Linux:

Terminal window
# Test network connectivity
nc -zv ldap.example.com 389
nc -zv ldap.example.com 636 # LDAPS
# Test DNS resolution
nslookup ldap.example.com
dig ldap.example.com

Windows:

Terminal window
# Test network connectivity
Test-NetConnection -ComputerName ldap.example.com -Port 389
Test-NetConnection -ComputerName ldap.example.com -Port 636
# Test DNS resolution
Resolve-DnsName ldap.example.com

Solution:

  1. Verify the LDAP server address and port in LDAP Profiles
  2. Check firewall rules allow traffic on port 389 (LDAP) or 636 (LDAPS)
  3. Verify DNS resolution returns the correct IP address
  4. If using a load balancer, check load balancer health

Problem: Secure LDAP (LDAPS) connection fails due to certificate issues.

Symptoms:

  • “PKIX path building failed” in logs
  • “unable to find valid certification path to requested target”
  • Connection works with plain LDAP (389) but not LDAPS (636)

Root Causes:

  • LDAP server uses a self-signed certificate
  • LDAP server uses a certificate signed by an internal CA
  • Certificate has expired
  • Certificate hostname doesn’t match server address

Diagnostic Steps:

Linux:

Terminal window
# View the LDAP server certificate
openssl s_client -connect ldap.example.com:636 -showcerts 2>/dev/null | openssl x509 -noout -subject -issuer -dates
# Check certificate chain
openssl s_client -connect ldap.example.com:636 </dev/null 2>/dev/null

Windows:

Terminal window
# View the LDAP server certificate
$tcpClient = New-Object System.Net.Sockets.TcpClient("ldap.example.com", 636)
$ssl = New-Object System.Net.Security.SslStream($tcpClient.GetStream())
$ssl.AuthenticateAsClient("ldap.example.com")
$cert = $ssl.RemoteCertificate
Write-Host "Subject: $($cert.Subject)"
Write-Host "Issuer: $($cert.Issuer)"
Write-Host "Expires: $($cert.GetExpirationDateString())"
$ssl.Dispose(); $tcpClient.Dispose()

Solution:

Option A — Import the CA certificate (recommended):

  1. Navigate to the Certificate Management page in the web interface
  2. Import the LDAP server’s CA certificate into the trust store
  3. Restart Mideye Server

Option B — Skip certificate validation (testing only):

  1. Navigate to LDAP Profiles
  2. Edit the LDAP profile
  3. Set certificate validation to Skip (not recommended for production)
  4. Save and test the connection

Problem: LDAP connection fails with authentication errors.

Symptoms:

  • “Invalid credentials” error in logs
  • “LDAP error code 49” (invalid credentials)
  • Web interface shows LDAP connection failure

Root Causes:

  • Wrong bind DN or username
  • Wrong password
  • Password expired
  • Account locked

Solution:

  1. Navigate to LDAP Profiles and verify:

    • Bind DN is correct: CN=svc-mideye,OU=Service Accounts,DC=example,DC=com
    • Bind password is correct (re-enter if unsure)
  2. Verify credentials work:

    Linux:

    Terminal window
    ldapsearch -x -H ldap://ldap.example.com:389 \
    -D "CN=svc-mideye,OU=Service Accounts,DC=example,DC=com" \
    -W -b "DC=example,DC=com" "(sAMAccountName=testuser)"

    Windows:

    Terminal window
    # Test AD credentials
    $credential = Get-Credential
    Get-ADUser -Identity testuser -Server ldap.example.com -Credential $credential
  3. Check that the service account:

    • Is not locked
    • Password has not expired
    • Has read permissions to the user OU

Problem: LDAP connection works, but specific users cannot be found.

Symptoms:

  • “User not found” during authentication
  • Some users work, others don’t
  • LDAP connection test succeeds but authentication fails

Root Causes:

  • User is in a different OU than the configured search base
  • Search filter doesn’t match the user
  • User account is disabled in AD

Solution:

  1. Navigate to LDAP Profiles and verify:

    • Search base is broad enough to include all users
    • Search filter matches the username attribute being sent
  2. Test the search manually:

    Linux:

    Terminal window
    # Search for specific user
    ldapsearch -x -H ldap://ldap.example.com:389 \
    -D "CN=svc-mideye,OU=Service Accounts,DC=example,DC=com" \
    -W -b "DC=example,DC=com" "(sAMAccountName=username)" dn

    Windows:

    Terminal window
    # Find user and their OU
    Get-ADUser -Identity username -Properties DistinguishedName | Select-Object DistinguishedName
  3. Common search filter patterns:

    • (sAMAccountName={0}) — Most common for AD
    • (userPrincipalName={0}) — If using UPN format (user@domain.com)
    • (uid={0}) — For non-AD LDAP servers
    • (mail={0}) — If matching by email
  4. Ensure the search base covers the user’s OU:

    • Too narrow: OU=Users,DC=example,DC=com (only finds users in this specific OU)
    • Better: DC=example,DC=com (searches entire domain)

Problem: LDAP server hostname cannot be resolved.

Symptoms:

  • “UnknownHostException” or “Name resolution failed”
  • Connection works by IP but not by hostname

Diagnostic Steps:

Linux:

Terminal window
# Check DNS resolution
nslookup ldap.example.com
dig ldap.example.com
# Check /etc/resolv.conf
cat /etc/resolv.conf
# Check /etc/hosts
grep ldap /etc/hosts

Windows:

Terminal window
Resolve-DnsName ldap.example.com
ipconfig /all | Select-String "DNS"

Solution:

  1. Fix DNS resolution (DNS server configuration, /etc/resolv.conf)

  2. Or add a static hosts entry as a workaround:

    Linux: Add to /etc/hosts:

    10.0.1.50 ldap.example.com

    Windows: Add to C:\Windows\System32\drivers\etc\hosts:

    10.0.1.50 ldap.example.com

6. Stale Connections (Load Balancers / Multiple DCs)

Section titled “6. Stale Connections (Load Balancers / Multiple DCs)”

Problem: LDAP connections become stale when a load balancer or DNS round-robin is used across multiple domain controllers.

Symptoms:

  • Intermittent “connection reset” or “connection closed” errors
  • Authentication works most of the time but fails periodically
  • Errors correlate with idle periods (e.g., overnight, weekends)

Root Cause: Load balancers may silently close idle TCP connections. The pooled connections in Mideye Server become stale.

Solution:

  1. Navigate to LDAP Profiles
  2. Configure connection pooling settings:
    • Reduce idle timeout to less than the load balancer’s idle timeout
    • Enable connection validation if available
  3. If using DNS round-robin, configure multiple LDAP servers in the profile

Problem: LDAP connection works and user is found, but phone number attribute is empty.

Symptoms:

  • User authenticates but OTP delivery fails
  • Phone number shows as empty in user details
  • Other attributes (name, email) work correctly

Solution:

  1. Navigate to LDAP Profiles

  2. Verify the phone number attribute is set correctly:

    • AD: mobile, telephoneNumber, or msDS-cloudExtensionAttribute1
    • Custom: Whatever attribute stores the phone number in your directory
  3. Verify the attribute value exists:

    Linux:

    Terminal window
    ldapsearch -x -H ldap://ldap.example.com:389 \
    -D "CN=svc-mideye,OU=Service Accounts,DC=example,DC=com" \
    -W -b "DC=example,DC=com" "(sAMAccountName=username)" mobile telephoneNumber

    Windows:

    Terminal window
    Get-ADUser -Identity username -Properties mobile, telephoneNumber |
    Select-Object mobile, telephoneNumber
  4. See Phone Number Issues for phone number format requirements.


Use this checklist when setting up or troubleshooting an LDAP profile:

SettingDescriptionExample
ServerLDAP server hostname or IPldap.example.com
Port389 (LDAP) or 636 (LDAPS)636
Use SSLEnable for LDAPSYes
Bind DNService account DNCN=svc-mideye,OU=...
Bind PasswordService account password(configured)
Search BaseWhere to search for usersDC=example,DC=com
Search FilterHow to match usernames(sAMAccountName={0})
Phone AttributeAttribute containing phone numbermobile
Certificate ValidationValidate or Skip (for LDAPS)Validate

All settings are configured in LDAP Profiles.


Run this quick test to verify LDAP connectivity end-to-end:

Linux:

Terminal window
# 1. DNS
nslookup ldap.example.com
# 2. Port
nc -zv ldap.example.com 636
# 3. Certificate (LDAPS)
openssl s_client -connect ldap.example.com:636 </dev/null 2>/dev/null | head -5
# 4. Bind + Search
ldapsearch -x -H ldaps://ldap.example.com:636 \
-D "CN=svc-mideye,OU=Service Accounts,DC=example,DC=com" \
-W -b "DC=example,DC=com" "(sAMAccountName=testuser)" dn mobile

Windows:

Terminal window
# 1. DNS
Resolve-DnsName ldap.example.com
# 2. Port
Test-NetConnection -ComputerName ldap.example.com -Port 636
# 3. AD Search
Get-ADUser -Identity testuser -Server ldap.example.com -Properties mobile |
Select-Object DistinguishedName, mobile

If LDAP issues persist, contact Mideye Support with:

  • LDAP server type (Active Directory, OpenLDAP, etc.)
  • Connection type (LDAP/LDAPS) and port
  • Search base and search filter
  • Error messages from Log Files
  • Whether the issue affects all users or specific users