Created
September 28, 2016 10:28
-
-
Save SnuktheGreat/a59b14721e8669d93614b06f4b56488d to your computer and use it in GitHub Desktop.
vault bash scripts
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/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 |
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/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 |
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/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