Last active
February 4, 2018 01:30
-
-
Save ivan-pinatti/13d51cb2afa452013b597cadd36bf305 to your computer and use it in GitHub Desktop.
Jenkins - Disable old insecure protocols via groovy script - #jenkins #groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!groovy | |
// imports | |
import jenkins.model.Jenkins | |
import jenkins.security.s2m.* | |
// get Jenkins instance | |
Jenkins jenkins = Jenkins.getInstance() | |
// define protocols | |
HashSet<String> oldProtocols = new HashSet<>(jenkins.getAgentProtocols()) | |
oldProtocols.removeAll(Arrays.asList("JNLP3-connect", "JNLP2-connect", "JNLP-connect", "CLI-connect")) | |
// set protocols | |
jenkins.setAgentProtocols(oldProtocols) | |
// save to disk | |
jenkins.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment