Skip to content

Instantly share code, notes, and snippets.

@SnuktheGreat
Created September 28, 2016 10:28
Show Gist options
  • Save SnuktheGreat/a59b14721e8669d93614b06f4b56488d to your computer and use it in GitHub Desktop.
Save SnuktheGreat/a59b14721e8669d93614b06f4b56488d to your computer and use it in GitHub Desktop.
vault bash scripts
#!/bin/sh
if [ $# -gt 2 ] || [ $# -lt 1 ]
then
echo 'Specify the path to the value first and optionally the field name second.' 1>&2
exit 0
fi
if [ $# -eq 2 ]
then
field=$2
else
field=value
fi
vault read -field=$field $1 | xclip -selection c
#!/bin/sh
if [ $# -gt 2 ] || [ $# -lt 1 ]
then
echo 'Specify the path to the value first and optionally the field name second.' 1>&2
exit 0
fi
if [ $# -eq 2 ]
then
field=$2
else
field=value
fi
generated_password=$(pwgen -s 12 1 -y)
vault write $1 $field=$generated_password
vault_copy $1 $field
#!/bin/sh
vault_copy auth/token/lookup-self id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment