Skip to content

Instantly share code, notes, and snippets.

@anakaiti
Last active November 25, 2020 10:43
Show Gist options
  • Save anakaiti/7f8ce083ea12c135b27a58e183fd9640 to your computer and use it in GitHub Desktop.
Save anakaiti/7f8ce083ea12c135b27a58e183fd9640 to your computer and use it in GitHub Desktop.
fish shell hashicorp vault helpers
function vault-edit --argument key
set file (mktemp --suffix=.json)
vault read -format=json $key | jq '.data' > $file
$EDITOR $file
vault write $key @$file
end
function vdb --argument role
set res (vault read -format=json database/creds/$role)
echo $res | jq '.data'
read --prompt-str='[Enter] to end session' null
vault lease revoke (echo $res | jq -r '.lease_id')
end
function vsh
vault ssh -role=sre -mode ca $argv;
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment