#!/bin/bash # # Startup script for SSH Black List by Vadim Reznik # See http://www.pettingers.org/code/sshblack.html for details # # chkconfig: 345 86 14 # description: SSH Black monitors ssh connections for attacks # # processname: sshblack # pidfile: /var/run/sshblack.pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 # See how we were called. case "$1" in start) echo -n "Starting sshblack: " /usr/local/sshblackD/sshblack.pl echo touch /var/lock/subsys/sshblack ;; stop) echo -n "Shutting down sshblack: " pid=`ps axw | awk {'if(match($7, "/usr/local/sshblackD/sshblack.pl")) print$1}'` kill -9 $pid RETVAL=$? echo rm -f /var/lock/subsys/sshblack rm -f /var/run/sshblack.pid ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit 0