Created
January 12, 2022 23:45
-
-
Save reaperes/5f604859d49999f464fdeac05584d219 to your computer and use it in GitHub Desktop.
Generate github actions oidc thumbprints
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
#!/usr/bin/env sh | |
# ref: | |
# - https://github.com/awsdocs/iam-user-guide/blob/main/doc_source/id_roles_providers_create_oidc_verify-thumbprint.md | |
# - https://stackoverflow.com/questions/69247498/how-can-i-calculate-the-thumbprint-of-an-openid-connect-server | |
HOST=$(curl https://token.actions.githubusercontent.com/.well-known/openid-configuration | jq -r '.jwks_uri | split("/")[2]') | |
echo | openssl s_client -servername $HOST -showcerts -connect $HOST:443 2> /dev/null \ | |
| sed -n -e '/BEGIN/h' -e '/BEGIN/,/END/H' -e '$x' -e '$p' | tail +2 \ | |
| openssl x509 -fingerprint -noout \ | |
| sed -e "s/.*=//" -e "s/://g" \ | |
| tr "ABCDEF" "abcdef" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment