#!/bin/bash #%rlevels: 3:s 4:s 5:s 0:k 1:k 2:k 6:k #%start: 30 #%stop: 30 #deps #%needs: #%before: #%after: source /etc/sysconfig/rc source $rc_functions gen_keys() { if [ ! -e /etc/ssh/ssh_host_key ] then echo -e ${COLOREDSTAR}"Generating SSH-Hostkey ..." /usr/bin/ssh-keygen -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N '' fi if [ ! -e /etc/ssh/ssh_host_dsa_key ] then echo -e ${COLREDSTAR}"Generating DSA-Hostkey ..." /usr/bin/ssh-keygen -d -f /etc/ssh/ssh_host_dsa_key -N '' fi if [ ! -e /etc/ssh/ssh_host_rsa_key ] then echo -e ${COLOREDSTAR}"Generating RSA-Hostkey ..." /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' fi } case "$1" in start) gen_keys echo -e ${COLOREDSTAR}"Starting SSH Server ..." loadproc /usr/sbin/sshd update_svcstatus $1 splash svc_started "$(basename $0)" 0 ;; stop) echo -e ${COLOREDSTAR}"Stopping SSH Server ..." killproc /usr/sbin/sshd update_svcstatus $1 splash svc_stopped "$(basename $0)" 0 ;; reload) echo -e ${COLOREDSTAR}"Reloading SSH Server ..." reloadproc /usr/sbin/sshd ;; restart) $0 stop sleep 1 $0 start ;; status) statusproc /usr/sbin/sshd ;; *) echo "Usage: $0 {start|stop|reload|restart|status}" exit 1 ;; esac