问题描述
在迁移Jenkins后无法登录,分析日志可知是LDAP配置导致的,新环境并不能访问LDAP服务。
解决方案
在config.xml配置文件中找到这段关于ldap认证的信息:
<securityRealm class="hudson.security.LDAPSecurityRealm" plugin="[email protected]">
<disableMailAddressResolver>false</disableMailAddressResolver>
<configurations>
<jenkins.security.plugins.ldap.LDAPConfiguration>
<server>ldap://XXXXXX.com:389</server>
<rootDN>dc=XXXXXX,dc=com</rootDN>
<inhibitInferRootDN>false</inhibitInferRootDN>
<userSearchBase></userSearchBase>
<userSearch>uid={0}</userSearch>
<groupMembershipStrategy class="jenkins.security.plugins.ldap.FromGroupSearchLDAPGroupMembershipStrategy">
<filter>cn=jenkins</filter>
</groupMembershipStrategy>
<managerDN>uid=jarry,ou=People,dc=XXXXXX,dc=com</managerDN>
<managerPasswordSecret>{AQAAABAAAAAQWfZrb7qoIjewuj3SK/z53/oRo86cW5wi/t07QeW/4mM=}</managerPasswordSecret>
<displayNameAttributeName>uid</displayNameAttributeName>
<mailAddressAttributeName>mail</mailAddressAttributeName>
<ignoreIfUnavailable>false</ignoreIfUnavailable>
<extraEnvVars class="linked-hash-map">
<entry>
<string></string>
<string></string>
</entry>
</extraEnvVars>
</jenkins.security.plugins.ldap.LDAPConfiguration>
</configurations>
<userIdStrategy class="jenkins.model.IdStrategy$CaseInsensitive"/>
<groupIdStrategy class="jenkins.model.IdStrategy$CaseInsensitive"/>
<disableRolePrefixing>true</disableRolePrefixing>
</securityRealm>
上面的配置不当导致了无法通过ldap认证,而且导致jenkins也无法正常登陆了,可以把上面一段修改成以下样子:
<securityRealm class="hudson.security.HudsonPrivateSecurityRealm">
<disableSignup>false</disableSignup>
<enableCaptcha>false</enableCaptcha>
</securityRealm>