Skip to content

Instantly share code, notes, and snippets.

@reaperes
Created January 12, 2022 23:45
Show Gist options
  • Save reaperes/5f604859d49999f464fdeac05584d219 to your computer and use it in GitHub Desktop.
Save reaperes/5f604859d49999f464fdeac05584d219 to your computer and use it in GitHub Desktop.
Generate github actions oidc thumbprints
#!/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