Created
September 27, 2017 02:00
-
-
Save brianoflan/568ab6da420dad450929658d904015b6 to your computer and use it in GitHub Desktop.
How to get sha256 fingerprints for use with Jenkins Swarm client's -sslFingerprints option
This file contains hidden or 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
#!/bin/bash | |
sslFingerprint=$(echo \ | |
| openssl s_client -showcerts -connect $some_jenkins_server_fqdn_name:443 2> /dev/null \ | |
| openssl x509 -noout -sha256 -fingerprint | awk -F'=' '{print $NF}') | |
# Note that you can strip the colons for a shorter fingerprint: | |
echo $sslFingerprint | tr -d ':' | |
# But you do not need to strip them. | |
# (SwarmClient.DefaultTrustManager will do it for you: | |
# https://github.com/jenkinsci/swarm-plugin/blob/master/client/src/main/java/hudson/plugins/swarm/SwarmClient.java , | |
# esp. "StringUtils.remove(fingerprint.toLowerCase(), ':')" | |
# on line 723, https://github.com/jenkinsci/swarm-plugin/blob/44568f3e23b1d3433a0ab86078b2cc8160e906ff/client/src/main/java/hudson/plugins/swarm/SwarmClient.java#L723) | |
# See Jenkins's Swarm Plugin for more: | |
# * https://wiki.jenkins.io/display/JENKINS/Swarm+Plugin | |
# * https://github.com/jenkinsci/swarm-plugin | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment