ssh/init

33 lines
632 B
Plaintext
Raw Normal View History

2023-07-26 10:56:43 +00:00
#!/bin/sh
#set -e
generate_host_key_type() {
local bit_size key_type
key_type=$1
if [ ! -f /etc/ssh/ssh_host_"${key_type}"_key ]; then
case $key_type in
ecdsa) bit_size="$ecdsa_bit_size";;
rsa) bit_size="$rsa_bit_size";;
esac
ssh-keygen \
-q \
-f ${SSH_KEY_PATH}/ssh_host_"$key_type"_key \
-N '' \
-t "$key_type" \
${bit_size:+ -b ${bit_size}} || return 1
fi
}
for type in ${key_types_to_generate:-dsa ecdsa ed25519 rsa}; do
generate_host_key_type "$type" || return 1
done
/usr/sbin/sshd -e
# Sleep,enabling our SIGTERM to shut us down gracefully
(while true; do sleep 3600; done) &
wait