Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sonar 4.1.1 with LDAP 1.4 Configuration

I am trying to configure the Sonar with windows Active directory. I am getting the below error.

ERROR [rails] Error from external users provider: Unable to retrieve details for user xxx.xxx in

The below configurations are done in sonar.property file

# LDAP configuration
# General Configuration
sonar.security.realm=LDAP
ldap.authentication: simple
sonar.security.savePassword=true
sonar.authenticator.createUsers=true
ldap.url=ldap://xxxx.group.root.ad

# User Configuration
ldap.user.baseDn=OU=Users,OU=Customs,OU=Group,dc=group,dc=root,dc=ad
ldap.user.request=(&(objectClass=inetOrgPerson)(uid={login}))
ldap.user.realNameAttribute=cn
ldap.user.emailAttribute=mail

# Group Configuration
ldap.group.baseDn=OU=Customs,OU=Group,dc=group,dc=root,dc=ad 
#ldap.group.request=(&(objectClass=posixGroup)(memberUid={uid}))
ldap.group.request=((objectClass=group)(member={dn}))

anybody have an idea to fix the issue in sonar.

Regards Arun.

like image 423
user3373735 Avatar asked Nov 11 '22 12:11

user3373735


1 Answers

I had similar issue with LDAP 2.1 on SonarQube 5.6 (LTS)

tl'dr

This format of ldap.user.request worked for me -

ldap.user.request=(uid={login})

If you are still reading ...

Here are some things that helped me resolving the issue

  1. sonar.log :
    Turn the DEBUG ON and look for the actual ldap search query thats getting build and the ldap context.
    2017.03.14 00:35:04 DEBUG web[o.s.p.l.LdapSearch] Search: LdapSearch{baseDn=dc=test,dc=com, scope=subtree, request=(&(objectClass=inetOrgPerson)(uid={0})), parameters=[harvey], attributes=[mail, cn]}
    2017.03.14 00:35:04 DEBUG web[o.s.p.l.LdapContextFactory] Initializing LDAP context {java.naming.provider.url=ldap://ldap.test.com, java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory, java.naming.security.principal=uid=user,ou=People,dc=test,dc=com, com.sun.jndi.ldap.connect.pool=true, java.naming.security.authentication=simple, java.naming.referral=follow}
  1. ldapsearch :
    Run lapsearch command with same parameters from the logs (step #1)
    $ldapsearch -x -L -D"uid=user,ou=People,dc=test,dc=com" -w"pass" -b"ou=People,dc=test,dc=com" "(uid=harvey)" mail cn
  1. sonar.properties - here is my working LDAP configuration

    #General Configuration
    sonar.security.realm=LDAP 
    ldap.url=ldaps://ldap.test.com 
    ldap.bindDn=uid=user,ou=People,dc=test,dc=com 
    ldap.bindPassword=pass 

    #User Configuration
    ldap.user.baseDn=ou=People,dc=test,dc=com
    ldap.user.request=(uid={login})
    ldap.user.realNameAttribute=cn
    ldap.user.emailAttribute=mail

    #Group Configuration
    ldap.group.baseDn=ou=Group,dc=test,dc=com
    ldap.group.request=(&(objectClass=posixGroup)(memberUid={uid}))

  1. ldap.user.request & ldap.group.request
    From the step #1 you could find out whats the correct format for query filter parameter in your case and values for bindDn (-D) and baseDn _-b)

Hope this helps =)

Thanks!

like image 134
Rishi Avatar answered Dec 18 '22 23:12

Rishi