Skip to content

Instantly share code, notes, and snippets.

@iocanel
Created September 1, 2015 09:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save iocanel/45ceb0b688aa19a8ea67 to your computer and use it in GitHub Desktop.
Save iocanel/45ceb0b688aa19a8ea67 to your computer and use it in GitHub Desktop.
Jenkins key generation
#Generate master.key and secret
MAGIC="::::MAGIC::::"
mkdir -p /var/jenkins_home/secrets
openssl rand -hex 128 > /var/jenkins_home/secrets/master.key
openssl dgst -sha256 -binary /var/jenkins_home/secrets/master.key > /tmp/master.hashed
HEX_MASTER_KEY=`head -c 16 /tmp/master.hashed | xxd -l 16 -p`
openssl rand 259 > /tmp/base
echo $MAGIC >> /tmp/base
openssl enc -aes-128-ecb -in /tmp/base -K $HEX_MASTER_KEY -out /var/jenkins_home/secrets/hudson.util.Secret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment