"Fossies" - the Fresh Open Source Software Archive

Member "sshdfilter-1.5.7/etc/init.d/rc.ssh.slackware" (3 Jun 2006, 1228 Bytes) of package /linux/privat/old/sshdfilter-1.5.7.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 # Start/stop/restart the secure shell server:
    3 
    4 sshd_start() {
    5   # Create host keys if needed.
    6   if [ ! -r /etc/ssh/ssh_host_key ]; then
    7     /usr/bin/ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_key -N '' 
    8   fi
    9   if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
   10     /usr/bin/ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
   11   fi
   12   if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
   13     /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
   14   fi
   15   /usr/sbin/sshdfilter
   16 }
   17 
   18 sshd_stop() {
   19   killall sshd
   20 }
   21 
   22 sshd_restart() {
   23   if [ -r /var/run/sshd.pid ]; then
   24     echo "WARNING: killing listener process only.  To kill every sshd process, you must"
   25     echo "         use 'rc.sshd stop'.  'rc.sshd restart' kills only the parent sshd to"
   26     echo "         allow an admin logged in through sshd to use 'rc.sshd restart' without"
   27     echo "         being cut off.  If sshd has been upgraded, new connections will now"
   28     echo "         use the new version, which should be a safe enough approach."
   29     kill `cat /var/run/sshd.pid`
   30   else
   31     killall sshd
   32   fi
   33   sleep 1
   34   sshd_start
   35 }
   36 
   37 case "$1" in
   38 'start')
   39   sshd_start
   40   ;;
   41 'stop')
   42   sshd_stop
   43   ;;
   44 'restart')
   45   sshd_restart
   46   ;;
   47 *)
   48   echo "usage $0 start|stop|restart"
   49 esac
   50