Sonarqube LDAP 身份验证失败

Sonarqube LDAP 身份验证失败

我正在尝试针对 Active Directory 服务器安装带有 ldap 身份验证的 sonarqube 7.7,但无法使其正常工作。我从同一主机上运行的另一台服务器复制了设置,其 ldap 设置可以正常工作。

这是我在 sonarqube 中的当前配置:

ldap.url=ldap://myADserver.mydomain.local:389
ldap.bindDn="CN=myldapuser,OU=Users,DC=mydomain,DC=local"
# ldap.bindPassword=mypassword
ldap.authentication=simple
ldap.realm=mydomain.local
ldap.user.baseDn="OU=myadgroup,DC=mydomain,DC=local"
ldap.user.request="(&(objectClass=user)(sAMAccountName={login}))"
ldap.user.realNameAttribute=cn

如果我提供密码,sonarqube 会在启动时关闭,并在 web.log 中出现以下错误消息:

Caused by: javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C09042F, comment: AcceptSecurityContext error, data 52e, v2580

此消息表面上表示用户正确,但密码不正确。然而,该密码在另一台服务器和 ldapsearch 中均有效。

如果我像上面一样注释掉密码,sonarqube 会启动,但无法验证 ldap 用户。我使用默认管理员用户登录。

DEBUG web[AWqxWJwHqJPbGHfaAAAX][o.s.p.l.LdapUsersProvider] User mypersonaluser not found in <default>
ERROR web[AWqxWJwHqJPbGHfaAAAX][o.s.s.a.CredentialsExternalAuthentication] Error during authentication
org.sonar.plugins.ldap.LdapException: Unable to retrieve details for user mypersonaluser in <default>
Caused by: javax.naming.directory.InvalidSearchFilterException: invalid attribute description
DEBUG web[AWqxWJwHqJPbGHfaAAAX][auth.event] login failure [cause|Unable to retrieve details for user mypersonaluser in <default>][method|FORM][provider|REALM|LDAP][IP|server_internal_IP|office_pub_IP][login|mypersonaluser]

为了完整性,其他服务器和 ldapsearch 命令行的配置如下:

base = "OU=myadgroup,DC=mydomain,DC=local", 
bind_dn = "CN=myldapuser,CN=Users,DC=mydomain,DC=local",
host = "myADserver.mydomain.local", 
label = "ldap", 
method = "plain", 
password = "mypassword", 
port = 389, 
uid = "sAMAccountName"

ldapsearch -D "cn=myldapuser,cn=users,DC=mydomain,DC=local" -p 389 -h myADserver.mydomain.local -b "OU=myadgroup,DC=mydomain,DC=local"  "(&(objectClass=user)(sAMAccountName=mypersonaluser))" -u myldapuser -w mypassword

我的 sonarqube 配置有什么问题?如何修复?

答案1


看起来您已将密码字段注释掉#?

# ldap.bindPassword=mypassword

你也不需要用“”括住参数

除非你的服务器允许匿名访问 LDAP 目录,否则你需要设置 bindBn 和 bindPassword

# Bind DN is the username of an LDAP user to connect (or bind) with.
ldap.bindDn=cn=user,OU=ou,DC=mycompany,DC=local
 
# Bind Password is the password of the user to connect with.
ldap.bindPassword=secret

相关内容