#!/bin/bash # # portsentry Start the portsentry portscan detector # # chkconfig: 345 98 05 # description: PortSentry Port Scan Detector is part of the Abacus Project \ # suite of tools. The Abacus Project is an initiative to release \ # low-maintenance, generic, and reliable host based intrusion \ # detection software to the Internet community. # processname: portsentry # configfile: /usr/local/portsentry/portsentry.conf # pidfile: /var/run/portsentry.pid # Source function library. . /etc/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 0 # For this script to work on non english systems export LANG=C SENTRYDIR="/usr/local/portsentry" RETVAL=0 start() { # Check for modes defined in the config file if [ -s $SENTRYDIR/portsentry.modes ] ; then modes=`cut -d "#" -f 1 $SENTRYDIR/portsentry.modes` else modes="tcp udp" fi for i in $modes ; do action $"Starting portsentry -$i: " $SENTRYDIR/portsentry -$i RETVAL=$? done [ $RETVAL -eq 0 ] && touch /var/lock/subsys/portsentry return $RETVAL } stop() { echo -n $"Stopping portsentry: " killproc portsentry RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/portsentry return $RETVAL } # See how we were called. case $1 in start) start ;; stop) stop ;; status) status portsentry RETVAL=$? ;; restart) stop start RETVAL=$? ;; condrestart) if [ -f /var/lock/subsys/portsentry ]; then stop start RETVAL=$? fi ;; *) echo $"Usage: portsentry {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL