2015-04-02 298 views
2

我正在尝试使用ldap获取gerrit设置。我格里特LDAP配置如下:配置Gerrit以使用LDAP

[ldap] 
    server = ldap://foobar.local 
    username = foobar\\gstralko 
    password = mypassword 
    accountBase = dc=foobar,dc=local 
    groupBase = dc=foobar,dc=local 

当我通过启动格里特:

java -jar /home/glassfish/gerrit-2.8.3.war init -d gerrit 

我收到以下错误日志中:

[2015年4月2日18:19:07,491] ERROR com.google.gerrit.server.auth.ldap.LdapRealm:无法查询LDAP以验证用户身份 javax.naming.AuthenticationException:[LDAP:error code 49 - 80090308:LdapErr:DSID-0C0903AA,comment :AcceptSecurityContext错误,数据775,v1772] 在com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3067)

我知道LDAP用户是否设置正确,因为我可以做的ldapsearch如下:

ldapsearch -h foobar.local -x -LLL -b "dc=foobar,dc=local" -D 'foobar\gstralko' -W 

而且工作。所以我想知道我在我的gerrit.config文件中缺少了什么。

感谢,

+0

这看起来像一个ADS系统和错误表示LDAP authetnication的问题。试试'username = gstralko @ yourd-ads-domain'或类似的。 – volker 2015-04-03 21:33:48

回答

0

我怀疑Java的配置文件分析器被绊倒你的密码参数,
所以查找出任何“\”字符包装在引号的标志密码,
像这样:

... 
password = "mypassword" 
... 

看到这个格里特documentat离子,例如:

...
配置文件解析器吃反斜线的一个级别,
所以字符类\ s需要\\ S中的配置文件中
解析器也会在第一个#,
处终止该行,因此包含#的匹配表达式必须用双引号括起来。

(从https://review.openstack.org/Documentation/config-gerrit.html#_file_code_etc_gerrit_config_code