Skip to content

Commit

Permalink
Merge pull request #22 from katesybernaut/master
Browse files Browse the repository at this point in the history
Add secondary global ssh key to default ssh agent
  • Loading branch information
xiaket authored Jul 7, 2021
2 parents 7431bfa + 349bc21 commit 3fdd780
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions hooks/environment
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ get-ssm () {

if [ -n "${AWS_PARAMSTORE_SECRETS_GLOBAL_SSH}" ]
then
echo "Adding Global SSH deploy key to a default SSH agent"
# shellcheck disable=SC2046
# AWS_PARAMSTORE_SECRETS_GLOBAL_SSH can optionally be a list delimited by `:`
GLOBAL_SSH_KEYS=(${AWS_PARAMSTORE_SECRETS_GLOBAL_SSH//:/ })
eval $(/usr/bin/ssh-agent | sed "/^echo/d")
get-ssm "${AWS_PARAMSTORE_SECRETS_GLOBAL_SSH}" | ssh-add - 2>/dev/null
for KEY in ${GLOBAL_SSH_KEYS[@]}
do
echo "Adding ${KEY} deploy key to a default SSH agent"
# shellcheck disable=SC2046
get-ssm "${KEY}" | ssh-add - 2>/dev/null
done
fi

exports=$(bk-ssm-secrets)
Expand Down

0 comments on commit 3fdd780

Please sign in to comment.