Skip to content

Commit

Permalink
Add support to custom ssh keys
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcnunes committed Sep 23, 2015
1 parent e510714 commit e7e5b25
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ONVAULT
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ set -e
# allow overriding default VAULT_URI at runtime
: ${VAULT_URI:=http://172.17.42.1:14242}

# allow overriding default VAULT_SSH_KEY at runtime
: ${VAULT_SSH_KEY:=id_rsa}

log () {
GREEN='\033[1;32m'
NC='\033[0m' # No Color
Expand All @@ -19,6 +22,12 @@ if curl -s "${VAULT_URI}/_ping"; then
curl -s "${VAULT_URI}/ssh.tgz" | tar -C ~/.ssh/ -zxf -
chown `whoami` ~/.ssh/*

log "Using ssh key: $VAULT_SSH_KEY"
if [[ "$VAULT_SSH_KEY" != "id_rsa" ]]; then
# configure the ssh to any host to use this ssh key
echo -e "\nHost *\nIdentityFile ~/.ssh/$VAULT_SSH_KEY" >> ~/.ssh/config
fi

log "Executing command: $@"
eval $@

Expand Down

0 comments on commit e7e5b25

Please sign in to comment.