Skip to content

Commit

Permalink
[ADD] ssh key text as env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
vrenaville committed Mar 26, 2021
1 parent 91ad8b5 commit 68b8cb0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ the `known_hosts` file is provided. This can help avoid issues for hosts with
dynamic IP addresses, but removes some additional protection against DNS
spoofing attacks. Host IP Checking is enabled by default.

#### ENV_SSH_KEY

You can specify the SSH key using Environnement variable, please note
that SSH_KEY_FILE parameter will be ignored


#### SSH_KEY_FILE

In the event you wish to store the key in Docker Secrets, you may wish to
Expand Down
7 changes: 5 additions & 2 deletions rootfs/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/usr/bin/dumb-init /bin/sh
source version.sh

if [ -n "${ENV_SSH_KEY}" ]; then
echo "$ENV_SSH_KEY" > /id_rsa/custom_rsa
KEY_FILE=/id_rsa/custom_rsa
else KEY_FILE=${SSH_KEY_FILE:=/id_rsa}
fi
# Set up key file
KEY_FILE=${SSH_KEY_FILE:=/id_rsa}
if [ ! -f "${KEY_FILE}" ]; then
echo "[FATAL] No SSH Key file found"
exit 1
Expand Down

0 comments on commit 68b8cb0

Please sign in to comment.