2015-04-02 170 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