Search code examples
jenkinsjenkins-plugins

How to login to jenkins when LDAP server is not available?


I did setup jenkins with LDAP and i'm able to login. But when i stop the LDAP server I'm unable to login to jenkins using jenkin's local user account. Also always editing the config.xml is not a good idea to change security settings. Please help me.


Solution

  • What Ive done in a previous role - is a copy of Jenkins config that allows admin & a selection of other users access when LDAP is down.

    When LDAP is down , I switch manually

    mv config.xml config.ldap.xml
    mv config.internal.xml config.xml 
    

    Restart Jenkins ( https://stackoverflow.com/a/8077830/1935094 )

    The config.internal.xml was setup before I configured LDAP. You could also backup your config.xml , configure Jenkins for internal user access , copy that off and copy back in your LDAP configured config.xml.

    Anyway - the idea is that you can still get in , run jobs etc until LDAP is back.

    Ive had thoughts about automating it , if LDAP is detected as down ( you could run a lookup periodically , then switch if need be...