目录
一,背景介绍
在企业搭建Gerrit时,一般需要企业账号来认证,也就是gerrit的ldap方案接入。
二,配置
2.1 开启ldap认证
在《Gerrit搭建》文档中,创建gerrit服务时,需要设置gerrit的工作目录。进入gerrit工作目录后,修改配置文件,
打开配置文件gerrit.config,设置如下,
[gerrit]
basePath = git
canonicalWebUrl = http://10.119.*.*:8080/
serverId = d02c679b-ed29-4766-b83d-******
[container]
javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"
javaOptions = "-Dflogger.logging_context=com.google.gerrit.server.logging.LoggingContext#getInstance"
user = root
javaHome = /home/*/Downloads/jdk-11.0.17
[index]
type = lucene
[auth]
type = LDAP
gitBasicAuthPolicy = LDAP
[ldap]
server = ldap://10.*.*.*
username = gerrit
accountBase = OU=*,DC=*,DC=Auto
groupBase = OU=*,DC=*,DC=Auto
[receive]
enableSignedPush = false
maxBatchCommits = 1000000
timeout = 120min
[sendemail]
smtpServer = *
smtpServerPort = 587
sslVerify = false
smtpUser = *
smtpPass = *
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = http://*:8080/
[cache]
directory = cache
[web]
defaultCharset = UTF-8
dateFormat = yyyy??MM??dd?? HH:mm:ss Z
timeFormat = HH:mm:ss Z
dateTimeFormat = yyyy??MM??dd?? HH:mm:ss Z
2.2 设置ldap公共账号和密码
在secure.config文件中,设置ldap密码信息,其中ldap的账号密码信息,需要找公司的ldap团队提供,
[auth]
registerEmailPrivateKey = *
[ldap]
password = "*"
[sendemail]
smtpPass = *
注意,出于公司保密要求,上述部分涉密信息用*代替。
ldap配置成功后,浏览器输入gerrit服务器地址,见到如下界面,