##// END OF EJS Templates
release of new installer/docker stack updates...
release of new installer/docker stack updates Tons of changes to move towards new rccontrol docker stack based installer

File last commit:

r1:29323844
r23:ffcea5dc
Show More
ssh-entrypoint.sh
49 lines | 1.3 KiB | application/x-sh | BashLexer
#!/usr/bin/env bash
set -Eeo pipefail
function generate_ssh_keys() {
keys_dir=/etc/rhodecode/conf/ssh
if [[ ! -d $keys_dir ]]; then
echo "Generating $keys_dir/ssh_host_rsa_key ..."
mkdir -p $keys_dir
fi
# Generate ssh host key for the first time
if [[ ! -f $keys_dir/ssh_host_rsa_key ]]; then
echo "Generating $keys_dir/ssh_host_rsa_key ..."
ssh-keygen -f $keys_dir/ssh_host_rsa_key -N '' -t rsa
chmod 0600 $keys_dir/ssh_host_rsa_key
fi
if [[ ! -f $keys_dir/ssh_host_ecdsa_key ]]; then
echo "Generating $keys_dir/ssh_host_ecdsa_key ..."
ssh-keygen -f $keys_dir/ssh_host_ecdsa_key -N '' -t ecdsa
chmod 0600 $keys_dir/ssh_host_ecdsa_key
fi
if [[ ! -f $keys_dir/ssh_host_ed25519_key ]]; then
echo "Generating $keys_dir/ssh_host_ed25519_key ..."
ssh-keygen -f $keys_dir/ssh_host_ed25519_key -N '' -t ed25519
chmod 0600 $keys_dir/ssh_host_ed25519_key
fi
if [[ ! -f $keys_dir/authorized_keys ]]; then
echo "Generating $keys_dir/authorized_keys..."
touch $keys_dir/authorized_keys
fi
sed -i "s/AllowUsers USER/AllowUsers $RC_USER/" $SSHD_CONF_FILE
}
echo "ENTRYPOINT: Running with cmd '$1'"
if [ "$SSH_BOOTSTRAP" = 1 ]; then
# generate SSH keys
generate_ssh_keys
fi
mkdir -p /run/sshd
exec "$@"