2015-10-03 04:54:55 +08:00
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
2015-10-12 23:39:40 +08:00
|
|
|
|
# Check if host keys are present, else create them
|
2015-10-13 05:13:22 +08:00
|
|
|
|
if ! test -f /data/ssh/ssh_host_key; then
|
2015-10-03 04:54:55 +08:00
|
|
|
|
ssh-keygen -q -f /data/ssh/ssh_host_key -N '' -t rsa1
|
2015-10-12 23:39:40 +08:00
|
|
|
|
fi
|
|
|
|
|
|
2015-10-13 05:13:22 +08:00
|
|
|
|
if ! test -f /data/ssh/ssh_host_rsa_key; then
|
2015-10-03 04:54:55 +08:00
|
|
|
|
ssh-keygen -q -f /data/ssh/ssh_host_rsa_key -N '' -t rsa
|
2015-10-12 23:39:40 +08:00
|
|
|
|
fi
|
|
|
|
|
|
2015-10-13 05:13:22 +08:00
|
|
|
|
if ! test -f /data/ssh/ssh_host_dsa_key; then
|
2015-10-03 04:54:55 +08:00
|
|
|
|
ssh-keygen -q -f /data/ssh/ssh_host_dsa_key -N '' -t dsa
|
2015-10-12 23:39:40 +08:00
|
|
|
|
fi
|
|
|
|
|
|
2015-10-13 05:13:22 +08:00
|
|
|
|
if ! test -f /data/ssh/ssh_host_ecdsa_key; then
|
2015-10-03 04:54:55 +08:00
|
|
|
|
ssh-keygen -q -f /data/ssh/ssh_host_ecdsa_key -N '' -t ecdsa
|
2015-10-12 23:39:40 +08:00
|
|
|
|
fi
|
|
|
|
|
|
2015-10-13 05:13:22 +08:00
|
|
|
|
if ! test -f /data/ssh/ssh_host_ed25519_key; then
|
2015-10-03 04:54:55 +08:00
|
|
|
|
ssh-keygen -q -f /data/ssh/ssh_host_ed25519_key -N '' -t ed25519
|
|
|
|
|
fi
|
2015-10-12 23:39:40 +08:00
|
|
|
|
|
|
|
|
|
# Set correct right to ssh keys
|
|
|
|
|
chown -R root:root /data/ssh/*
|
|
|
|
|
chmod 600 /data/ssh/*
|