Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot restore Jenkins security after disabling it in config.xml

Tags:

jenkins

hudson

Yesterday, I locked myself out of jenkins while trying to configure ldap authentication, so I followed the instructions in the wiki and disabled security in the config.xml file via ssh. Now I want to get back to the normal jenkins security, but the possibility is not given under "Configure Jenkins" anymore. So I'm looking for a possibility to restore normal security through the config.xml.

Here is the relevant part of the current config.xml file:

<hudson>
  <disabledAdministrativeMonitors/>
  <version>1.477</version>
  <numExecutors>3</numExecutors>
  <mode>NORMAL</mode>
  <useSecurity>true</useSecurity>
  <authorizationStrategy class="hudson.security.AuthorizationStrategy$Unsecured"/>
  <securityRealm class="hudson.security.SecurityRealm$None"/>
  ...
</hudson>

Has anyone an idea or maybe a valid part of a config.xml?

like image 266
ManuPogo Avatar asked Aug 20 '13 10:08

ManuPogo


2 Answers

    <hudson>
      <disabledAdministrativeMonitors/>
      <version>2.130</version>
      <numExecutors>2</numExecutors>
      <mode>NORMAL</mode>
      <useSecurity>true</useSecurity>
      <authorizationStrategy class="hudson.security.FullControlOnceLoggedInAuthorizationStrategy">
        <denyAnonymousReadAccess>true</denyAnonymousReadAccess>
      </authorizationStrategy>
      <securityRealm class="hudson.security.HudsonPrivateSecurityRealm">
        <disableSignup>true</disableSignup>
        <enableCaptcha>false</enableCaptcha>
      </securityRealm>
      ...
    </hudson>

I think you are looking for this as i am able to revert it back to my default config.xml remember always make a backup of config before modifying it. just update those two tags authorizationStrategy & securityRealm and your are good to go. And for further reference check out jenkins_xml_reference

like image 102
antoniomerlin Avatar answered Nov 14 '22 23:11

antoniomerlin


Don't forget to remove authorizationStrategy and securityRealm as per point #6:

https://wiki.jenkins-ci.org/display/JENKINS/Disable+security

like image 42
coffeebreaks Avatar answered Nov 14 '22 22:11

coffeebreaks