-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sample): add script to workaround key volume perms
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
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
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 |