From 68b8cb094462c86ab6c88d9dc0bca7780ea225d8 Mon Sep 17 00:00:00 2001 From: vrenaville Date: Fri, 26 Mar 2021 13:06:46 +0100 Subject: [PATCH] [ADD] ssh key text as env variable --- README.md | 6 ++++++ rootfs/entrypoint.sh | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8f8651d..8a8a3aa 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/rootfs/entrypoint.sh b/rootfs/entrypoint.sh index 623e72e..974ebcc 100755 --- a/rootfs/entrypoint.sh +++ b/rootfs/entrypoint.sh @@ -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