Skip to main content

Disable Jenkins CLI

Comments

4 comments

  • Henry Dobson

    Just been looking at this functionality myself and found I was able to disable CLI in a much simplier way:

    ```

    #!groovy
    import jenkins.*

    def enableCli = CLI.get()
    enableCli.setEnabled(false)

    ```

    Being fairly green with Groovy and the Jenkins classes, how do these approaches differ?

    0
  • Denys Digtiar

    Hi Henry,

    This script automates the creation of the init script on top of disabling the CLI using the approach in an original security advisory. The approach has since been improved and this script is a bit outdated now

    Please refer to https://github.com/jenkinsci-cert/SECURITY-218

    0
  • Allan Tony Selvan

    Is this document up-to-date?

    0
  • Yeung Siu

    I am getting the following error message with version 2.176.2

    "groovy.lang.MissingPropertyException: No such property: jenkins for class: security"

    Below is my code. It seems the CLI is not part of the jenkins class anymore? 

    import jenkins.model.*
    import jenkins.model.Jenkins
    import jenkins.model.Jenkins.*
    import jenkins.CLI.*
    import hudson.model.User
    import hudson.security.*
    import hudson.security.csrf.DefaultCrumbIssuer
    import jenkins.security.s2m.AdminWhitelistRule

    jenkins.CLI.get().setEnabled(false)

    0

Please sign in to leave a comment.

About CloudBees Support

Our Support Engineers are available to help with any questions or problems you may have with any of our products.