SonarQube LDAP 身份验证似乎已加载,但不允许通过域用户登录 [英] SonarQube LDAP Authentication seems to load but won't allow login via domain user

查看:35
本文介绍了SonarQube LDAP 身份验证似乎已加载,但不允许通过域用户登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用 LDAP 身份验证插件 (v1.4) 设置 SonarQube (v4.1),但我无法让它针对我的域用户进行身份验证.我的配置设置如下:

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}))

并且日志输出以下消息,似乎表明 LDAP 连接工作正常:

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: 

推荐答案

感谢@aaron 为我指明了正确的方向!对于我的问题,这是自动发现和我连接到的森林的问题.根据 http://technet.microsoft.com/en-us/library/cc978012.aspx 你应该在连接到森林时使用不同的端口,以便它可以搜索整个森林,而不是你碰巧连接到的域(我想这在自动发现模式下可能不是正确的).最后对我有用的配置是:

Thanks to @aaron who managed to point me in the right direction! For my issue it was a problem with the auto-discovery and the forest I was connecting to. According to http://technet.microsoft.com/en-us/library/cc978012.aspx you should use a different port when connecting to a forest so that it can then search the whole forest rather that the domain you happen to connect to (which I suppose might not be the correct one in auto-discovery mode). In the end the configuration that worked for me was:

# General Configuration
ldap.realm=mydomain.com
sonar.security.realm=LDAP
sonar.authenticator.createUsers=true
sonar.security.savePassword=true
sonar.security.updateUserAttributes=true
ldap.url=ldap://dc.mydomain.com:3268 

# User Configuration
ldap.user.request=(&(objectClass=user)(sAMAccountName={login}))
ldap.user.realNameAttribute=cn
ldap.user.emailAttribute=mail

这实际上非常简单,不需要用户帐户即可连接.这意味着它处于 SIMPLE 身份验证模式(我似乎无法让它在其他任何情况下工作)但这对我来说很好,因为它是一个仅限内部的系统.

Which is actually quite simple and doesn't require a user account to connect with. This means it is in SIMPLE authentication mode (I can't seem to get it to work in anything else) but that is fine with me as it's an internal only system.

这篇关于SonarQube LDAP 身份验证似乎已加载,但不允许通过域用户登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆