Skip to content

Instantly share code, notes, and snippets.

@travispaul
Last active November 15, 2016 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save travispaul/91006a145302923e410c5d4f19c41902 to your computer and use it in GitHub Desktop.
Save travispaul/91006a145302923e410c5d4f19c41902 to your computer and use it in GitHub Desktop.
Get users from CloudAPI using cURL
# 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