Created
May 12, 2016 05:01
-
-
Save nemosupremo/33561d7ad931ee7231aafdfa58be4abd to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
set -x | |
export VAULT_TOKEN=ROOT TOKEN | |
export VAULT_ADDR="https://vault.channelmeter.com:8200" | |
# do this once | |
# curl -s https://raw.githubusercontent.com/ChannelMeter/vault-gatekeeper-mesos/master/gatekeeper-policy.hcl > /tmp/policy.hcl | |
# vault policy-write tmp-test-gk /tmp/policy.hcl | |
T=`./vault token-create -orphan -policy tmp-test-gk | grep token | head -n 1 | awk '{ print $2 }'` | |
export VAULT_TOKEN=$T | |
curl -X POST -H "X-Vault-Token: ${T}" -d '{"ttl":"1h", "policies":["default"], "num_uses":0}' "${VAULT_ADDR}/v1/auth/token/create-orphan" | |
# {"lease_id":"","renewable":false,"lease_duration":0,"data":null,"warnings":null,"auth":{"client_token":"8919f06e-d758-ec91-9425-ea66193f17ae","accessor":"0e154505-e7ed-9ca7-bd42-f4290ae66605","policies":["default"],"metadata":null,"lease_duration":3600,"renewable":true}} | |
VAULT_TOKEN=8919f06e-d758-ec91-9425-ea66193f17ae vault token-lookup | |
# Key Value | |
# accessor 0e154505-e7ed-9ca7-bd42-f4290ae66605 | |
# creation_time 1.463029004e+09 | |
# creation_ttl 3600 | |
# display_name token | |
# id 8919f06e-d758-ec91-9425-ea66193f17ae | |
# meta <nil> | |
# num_uses 0 | |
# orphan true | |
# path auth/token/create | |
# policies [default] | |
# role | |
# ttl 0 | |
VAULT_ADDR="https://vault.channelmeter.com:8200" VAULT_TOKEN=8919f06e-d758-ec91-9425-ea66193f17ae ./vault token-renew | |
# Error renewing token: Error making API request. | |
# | |
# URL: PUT https://vault.channelmeter.com:8200/v1/auth/token/renew-self | |
# Code: 500. Errors: | |
# * lease not found or lease is not renewable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment