Add at-spi2-core and at-spi2-atk
[hvlinux.git] / stage3 / bootscripts / sshd
index 83e4349..66d635c 100755 (executable)
@@ -5,22 +5,29 @@
 # Source functions library
 source /etc/rc.d/init.d/functions
 
+source /etc/sysconfig/network/network-parameters
+
 log_script_name "$0 $*"
 
-SSHD="/usr/sbin/sshd -4"
+DAEMON="/usr/sbin/sshd"
+DAEMON_DESC="SSH server"
+DAEMON_OPTS="-4"
+
+KEYLEN_BITS=4096
+
+# Check if SSH server is desired
+if [ "x${SSH_SERVER_ENA}" != "xyes" -a "x${SSH_SERVER_ENA}" != "xYes" -a "x${SSH_SERVER_ENA}" != "xYES" ]; then
+    exit ${EXIT_CODE_SUCCESS}
+fi
 
 gen_keys() {
-    if [ ! -e /etc/ssh/ssh_host_key ] ; then
-       echo "Generating 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 "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 "Generating RSA-Hostkey..."
-       /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
+       echo "Generating RSA hostkey..."
+       /usr/bin/ssh-keygen -t rsa -b ${KEYLEN_BITS} -f /etc/ssh/ssh_host_rsa_key -N ''
+    fi
+    if [ ! -e /etc/ssh/ssh_host_ed25519_key ] ; then
+       echo "Generating Ed25519 hostkey..."
+        /usr/bin/ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N ''
     fi
 }
 
@@ -33,28 +40,28 @@ sshd_start() {
     fi
 
     gen_keys
-    
+
     if [ $? -ne 0 ]; then
        exit ${EXIT_CODE_FAILURE}
     else
-       loadproc ${SSHD}
+       loadproc ${DAEMON} ${DAEMON_OPTS}
     fi
 }
 
 # See how we were called
 case "$1" in
     start)
-       cmd_run_log_box_warn "sshd start" sshd_start
+       cmd_run_log_box_warn "${DAEMON_DESC} start" sshd_start
        ;;
-    
+
     stop)
-       cmd_run_log_box_warn "sshd stop" killproc sshd
+       cmd_run_log_box_warn "${DAEMON_DESC} stop" killproc ${DAEMON}
        ;;
-   
+
     reload)
-       reloadproc sshd
+       reloadproc ${DAEMON}
        ;;
-    
+
     restart)
        $0 stop
        sleep 1
@@ -62,9 +69,9 @@ case "$1" in
        ;;
 
     status)
-       statusproc sshd
+       statusproc ${DAEMON}
        ;;
-    
+
     *)
        echo "Usage: $0 {reload|restart|start|status|stop}"
        exit ${EXIT_CODE_FAILURE}