Fix StrictHostKeyChecking-related failure (#211)

* Fix StrictHostKeyChecking-related failure

For ssh-through git connections, the git pull fails because the host key will not be automatically added to known_hosts.

This should fix that by allowing the key to be put into the known_hosts.

Note that if the remote server ssh key changes, the git operation will fail. That seems a reasonably safe security fallback.

* Update config.json
This commit is contained in:
Alex Barcelo
2017-12-09 22:56:38 +01:00
committed by Pascal Vizeli
parent 670f6ac16e
commit ebd0f5931b
2 changed files with 7 additions and 3 deletions

View File

@@ -10,11 +10,15 @@ AUTO_RESTART=$(jq --raw-output '.auto_restart' $CONFIG_PATH)
REPEAT_ACTIVE=$(jq --raw-output '.repeat.active' $CONFIG_PATH)
REPEAT_INTERVAL=$(jq --raw-output '.repeat.interval' $CONFIG_PATH)
# prepare the private key, if provided
# prepare ssh access, if the deployment key has been provided
if [ ! -z "$DEPLOYMENT_KEY" ]; then
echo "[Info] setup deployment_key on id_${DEPLOYMENT_KEY_PROTOCOL}"
mkdir -p ~/.ssh
echo "[Info] disable StrictHostKeyChecking for ssh"
echo "Host *" > ~/.ssh/config
echo " StrictHostKeyChecking no" >> ~/.ssh/config
echo "[Info] setup deployment_key on id_${DEPLOYMENT_KEY_PROTOCOL}"
while read -r line; do
echo "$line" >> "${HOME}/.ssh/id_${DEPLOYMENT_KEY_PROTOCOL}"
done <<< "$DEPLOYMENT_KEY"