Last active
January 9, 2019 11:37
-
-
Save sriedel/d95dda65ae877ea88f499f5e3d322954 to your computer and use it in GitHub Desktop.
Automate vault access
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
#!/usr/bin/bash | |
VAULT_USER=sr | |
SSH_SOCKET=$HOME/.ssh/control/vault | |
REMOTE_HOST=app1.staging.givve.io | |
VAULT_HOST=vault.givve.io | |
export VAULT_ADDR="https://$VAULT_HOST:8200" | |
export VAULT_CACERT="/home/sr/src/givve/givve/config/certs/vault_cacert.pem" | |
ssh -M -S $SSH_SOCKET -fNT -L 8200:$VAULT_HOST:8200 $REMOTE_HOST | |
vault status | |
vault login -method=userpass username=$VAULT_USER | |
bash | |
ssh -S $SSH_SOCKET -O exit $REMOTE_HOST | |
unset VAULT_ADDR | |
unset VAULT_CACERT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment