Skip to content

Instantly share code, notes, and snippets.

@denzhel
Created April 24, 2022 20:28
Show Gist options
  • Save denzhel/d246c2c596d618b5f14e0b3445cd6f9a to your computer and use it in GitHub Desktop.
Save denzhel/d246c2c596d618b5f14e0b3445cd6f9a to your computer and use it in GitHub Desktop.
jenkins decrypt all secrets

To decrypt all Jenkins Secrets, you can use the following code inside Manage Jenkins -> Script Console:

def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
    com.cloudbees.plugins.credentials.common.StandardUsernameCredentials.class,
    Jenkins.instance,
    null,
    null
);
for (c in creds) {
     println( ( c.properties.privateKeySource ? "ID: " + c.id + ", UserName: " + c.username + ", Private Key: " + c.getPrivateKey() : ""))
}
for (c in creds) {
     println( ( c.properties.password ? "ID: " + c.id + ", UserName: " + c.username + ", Password: " + c.password : ""))
}
@J00MZ
Copy link

J00MZ commented Jun 23, 2022

LOL, have the same gist stuffed in my account for finding these 👊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment