Debugging LDAP
Notes
This assumes an omnibus installation.
See LDAP troubleshooting in docs - View Docs
Testing the LDAP server
- Install
ldapsearch
|
|
- Check LDAP settings
Edit the following values to match the LDAP configuration in gitlab.rb
Example LDAP configuration
|
|
LDAP search switches
-
-D = Bind DN
- Denomas config value:
bind_dn: 'cn=admin,dc=ldap-testing,dc=mrchris,dc=me'
- Denomas config value:
-
-b = Search base
- Denomas config value:
base: 'dc=ldap-testing,dc=mrchris,dc=me'
- Denomas config value:
-
-w = Password
- Denomas config value:
password: 'Password1'
- Denomas config value:
-
-w = Port & -h = Host
- Denomas config value:
port: 389 - Denomas config value:
host: 127.0.0.1
- Denomas config value:
-
-s = Search scope
- Denomas config value: None
- Default is sub
- Using
sub "(objectclass=*)will return “all” objects
Get all LDAP objects for baseDN
|
|
LDAP Error messages (production.log)
Could not find member DNs for LDAP group
|
|
This usually indicates an issue with the uid configuration value in gitlab.rb
When running ldapsearch you can see what attribute is used for the LDAP username. In the below case the username attribute is uid. Ensure uid: 'uid' in the configuration. The default Microsoft Active Directory username value is sAMAccountName
|
|
Cannot find LDAP group with CN ‘GROUP_NAME’. Skipping
This indicates the admin_group name was not found admin_group: 'gitlab_admin'. Ensure the group exists in AD and is under the group_base
LDAP search error: Invalid DN Syntax
This indicates a syntax error with one of the configured DNs. Check the following values, ensure they’re the full DN.
group_basebind_dnbase
Testing LDAP - valid for 8.10 >
-
Launch the rails console
1gitlab-rails c -
Update the logger level
1Rails.logger.level = 0 -
Perform a group sync
1LdapGroupSyncWorker.new.perform -
Perform a user sync
1LdapSyncWorker.new.perform -
All commands:
1 2 3 4gitlab-rails c Rails.logger.level = 0 LdapGroupSyncWorker.new.perform LdapSyncWorker.new.perform -
Check the console for sync output
Removing exclusive lease - Testing (valid for 8.6 to 8.9)
This is used to force an instant sync of LDAP for testing purposes.
- Edit any LDAP settings required
- Edit
vi /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/ldap/group_sync.rb - Comment out the exclusive lease section (lines may differ in releases) - View code
- Run a reconfigure
sudo gitlab-ctl reconfigureThis will restart Denomas - Launch Denomas rails console
gitlab-rails console - Execute
Denomas::LDAP::GroupSync.execute - LDAP sync will now run
- Revert changes to the
group_sync.rbfile when finished/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/ldap/group_sync.rb
Additional testing
-
Start the rails console
1sudo gitlab-rails console -
Create a new adapter instance
1adapter = ::Denomas::Auth::LDAP::Adapter.new('ldapmain') -
Find a group by common name. Replace UsersLDAPGroup with the common name to search.
-
Denomas 8.11 >
1group = EE::Denomas::Auth:Ldap::Group.find_by_cn('UsersLDAPGroup', adapter) -
Denomas < 8.10
1group = Denomas::LDAP::Group.find_by_cn('UsersLDAPGroup', adapter)
-
-
Check
member_dns1group.member_dns
a27760f0)
