From 3c573fc010733af2d568465ee44a181aeba4b7b7 Mon Sep 17 00:00:00 2001 From: klakier Date: Tue, 11 Sep 2001 22:11:38 +0000 Subject: [PATCH] - at 'start': generate keys if they not exists (moved here from %post) Changed files: opensshd.init -> 1.10 --- opensshd.init | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/opensshd.init b/opensshd.init index e4720f5..47112b1 100644 --- a/opensshd.init +++ b/opensshd.init @@ -28,12 +28,27 @@ fi # See how we were called. case "$1" in start) - # Check if the service is already running? + # generate new keys with empty passwords if they do not exist + if [ ! -f /etc/ssh/ssh_host_key -o ! -s /etc/ssh/ssh_host_key ]; then + /usr/bin/ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_key -N '' 1>&2 + chmod 600 /etc/ssh/ssh_host_key + fi + if [ ! -f /etc/ssh/ssh_host_rsa_key -o ! -s /etc/ssh/ssh_host_rsa_key ]; then + /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' 1>&2 + chmod 600 /etc/ssh/ssh_host_rsa_key + fi + if [ ! -f /etc/ssh/ssh_host_dsa_key -o ! -s /etc/ssh/ssh_host_dsa_key ]; then + /usr/bin/ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N '' 1>&2 + chmod 600 /etc/ssh/ssh_host_dsa_key + fi + if [ ! -f /etc/ssh/ssh_host_key ]; then msg_Not_Running OpenSSH nls "No SSH host key found! You must run \"$0 init\" first." exit 1 fi + + # Check if the service is already running? if [ ! -f /var/lock/subsys/sshd ]; then msg_starting OpenSSH daemon /usr/sbin/sshd -- 2.44.0