Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SonarQube LDAP Authentication seems to load but won't allow login via domain user

I've been trying to setup SonarQube (v4.1) with the LDAP authentication plugin (v1.4) and I just can't get it to authenticate against my domain user. My config is setup as follows:

#########################
# LDAP configuration
#########################
# General Configuration
sonar.security.realm=LDAP
sonar.security.savePassword=true
sonar.security.updateUserAttributes=true
sonar.authenticator.downcase=true
sonar.authenticator.createUsers=true

ldap.authentication=simple
ldap.realm=mydomain.co.uk
ldap.bindDn=CN=USERNAME,OU=developers,DC=mydomain,DC=co,DC=uk
ldap.bindPassword=PASSWORD

# User Configuration
#ldap.user.baseDn=OU=developers,DC=mydomain,DC=co,DC=uk
ldap.user.request=(&(objectClass=user)(sAMAccountName={login}))
ldap.user.realNameAttribute=cn
ldap.user.emailAttribute=mail

# Group Configuration
ldap.group.baseDn=CN=Domain Users,CN=Users,DC=adastra,DC=co,DC=uk
ldap.group.request=(&(objectClass=group)(member={dn}))

and the log outputs the following messges that seem to say that the LDAP connection is working fine:

2014.01.20 16:12:32 INFO  [org.sonar.INFO]  Security realm: LDAP
2014.01.20 16:12:32 INFO  [o.s.p.l.LdapSettingsManager]  Auto discovery mode
2014.01.20 16:12:32 INFO  [o.s.p.l.LdapSettingsManager]  Detected server: ldap://dc02.mydomain.co.uk:389
2014.01.20 16:12:32 INFO  [o.s.p.l.LdapSettingsManager]  User mapping: LdapUserMapping{baseDn=dc=mydomain,dc=co,dc=uk, request=(&(objectClass=user)(sAMAccountName={0})), realNameAttribute=cn, emailAttribute=mail}
2014.01.20 16:12:32 INFO  [o.s.p.l.LdapSettingsManager]  Group mapping: LdapGroupMapping{baseDn=CN=Domain Users,CN=Users,DC=mydomain,DC=co,DC=uk, idAttribute=cn, requiredUserAttributes=[dn], request=(&(objectClass=group)(member={0}))}
2014.01.20 16:12:32 INFO  [o.s.p.l.LdapContextFactory]  Test LDAP connection on ldap://dc02.mydomain.co.uk:389: OK
2014.01.20 16:12:32 INFO  [org.sonar.INFO]  Security realm started

But it just doesn't seem to work for my user unless I use a local user. When enabling logging on the wrapper by setting:

wrapper.console.loglevel=DEBUG

I get the following error in the logs which doesn't really help that much! :)

2014.01.20 17:07:10 ERROR [rails]  Error from external users provider: 
like image 511
caveman_dick Avatar asked Jan 20 '14 17:01

caveman_dick


People also ask

How do I authenticate users using LDAP?

In order to authenticate a user with an LDAP directory you first need to obtain their DN as well as their password. With a login form, people typically enter a simple identifier such as their username or email address. You don't expect them to memorise the DN of their directory entry.


1 Answers

Using port 3268 did the trick for me. Here is my configuration that works with SonarQube 5.0.1 and Active Directory:

sonar.security.realm=LDAP
sonar.security.savePassword=true
sonar.security.updateUserAttributes=true
sonar.authenticator.createUsers=true

ldap.url=ldap://dc101.office.company.com:3268
ldap.bindDn=CN=Service Account,OU=Windows Service,OU=Accounts,OU=Resources,DC=office,DC=company,DC=com
ldap.bindPassword=PASSWORD

ldap.user.baseDn=DC=office,DC=company,DC=com
ldap.user.request=(&(objectClass=user)(sAMAccountName={login}))
ldap.user.realNameAttribute=cn
ldap.user.emailAttribute=mail
like image 56
Nathan Avatar answered Oct 04 '22 03:10

Nathan