#!/bin/sh
#
#    Copyright (c) 1996-2004 Brocade Communications Systems, Inc.
#    All rights reserved.
#
#    Initialization script to start/stop sshd.
#

# Source common library
. /etc/init.d/functions

SSHD=/usr/sbin/sshd
CIPHERS="Ciphers=3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc"
MACS="Macs=hmac-sha1"

case "$1" in

'start')
    $ECHO "Secure shell daemon:\c"

	if $CHECK sshd; then
	    ${KILLALL} sshd
	    if test -x $SSHD; then
				fipsmode=`cat /etc/fabos/fabos.0.conf |grep fips.mode| cut -d':' -f2`
				#if [ "$fipsmode" == "1" ]; then
				#	$SSHD -o $CIPHERS -o $MACS `cat ${CONFIGDIR}/sshd.options 2> ${NULL}`
				#else
					/bin/sed '/PermitUserEnvironment/ s/yes/no/' /etc/sshd_config > /tmp/sshd_config.temp
					/bin/cp /tmp/sshd_config.temp /etc/sshd_config
					/bin/cp /tmp/sshd_config.temp /mnt/etc/sshd_config 
					/bin/rm /tmp/sshd_config.temp 
					$SSHD `cat ${CONFIGDIR}/sshd.options 2> ${NULL}`
				#fi
				$ECHO " sshd\c"
	    fi
	fi

    $ECHO "."
    ;;

'stop')
    ${KILLALL} sshd
    ;;    

*)
    echo "usage: $0 {start | stop}"
    ;;

esac
