Last active
November 15, 2016 14:11
-
-
Save travispaul/91006a145302923e410c5d4f19c41902 to your computer and use it in GitHub Desktop.
Get users from CloudAPI using cURL
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
# Update these if your ssh keys exist in another location: | |
sshkey=~/.ssh/id_rsa | |
sshpub=${sshkey}.pub | |
now=$(date -u "+%a, %d %h %Y %H:%M:%S GMT"); | |
signature=$(echo ${now} | tr -d '\n' | openssl dgst -sha256 -sign $sshkey | openssl enc -e -a | tr -d '\n'); | |
fingerprint=$(ssh-keygen -l -E md5 -f $sshpub | awk '{print $2}' | sed -e 's/MD5://') | |
curl -i -H "Accept: application/json" -H "accept-version: ~8" -H "Date: ${now}" -H "Authorization: Signature keyId=\"/$SDC_ACCOUNT/keys/${fingerprint}\",algorithm=\"rsa-sha256\" ${signature}" --url $SDC_URL/$SDC_ACCOUNT/users; | |
echo ""; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment