entrypoint.sh 506 Bytes
#!/bin/bash

set -ex

configure_ssh_known_hosts() {
	if [[ -z $SSH_KNOWN_HOSTS ]]; then return; fi
	for host in $SSH_KNOWN_HOSTS; do
		ssh-keyscan $host 2>/dev/null
	done > "/home/tool/.ssh/known_hosts"
	chown tool:tool "/home/tool/.ssh/known_hosts"
}

configure_ssh_config() {
	{
		echo "Host *"
		echo " PubkeyAcceptedAlgorithms +ssh-rsa"
	} > "/home/tool/.ssh/config"
	chown tool:tool "/home/tool/.ssh/config"
}

configure_ssh_known_hosts
configure_ssh_config

[[ $# -eq 0 ]] && set -- "bash"
exec "$@"