Skip to content

Commit

Permalink
feat(sample): add script to workaround key volume perms
Browse files Browse the repository at this point in the history
  • Loading branch information
Zekfad committed Sep 21, 2023
1 parent 4e13815 commit ab3ad4d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions sample/scripts/fix-ssh-key-perms.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# This scripts copies (or removes copy) private key with correct permissions

if [ "$1" == "remove-copy" ]; then
if [[ -n "$SSH_KEY_SRC" && -n "$SSH_KEY" && -e $SSH_KEY_SRC && "$SSH_KEY_SRC" != "$SSH_KEY" ]]; then
rm -f $SSH_KEY
export SSH_KEY=$SSH_KEY_SRC
export SSH_KEY_SRC=
else
echo "Invalid values for SSH_KEY_SRC and SSH_KEY" 1>&2
fi
else
key_source=$SSH_KEY
if [ -n "$key_source" ]; then
export SSH_KEY_SRC=$(realpath $key_source)
export SSH_KEY="$SSH_KEY_SRC.priv"
cp -f $SSH_KEY_SRC $SSH_KEY
chmod 400 -R $SSH_KEY
fi
fi

0 comments on commit ab3ad4d

Please sign in to comment.