#! /bin/sh
#
# senry         Start the sentry Port Scan Detector
#
# Author:       Craig Rowland <crowland@psionic.com>
#
# chkconfig: 345 98 05
# description: Sentry 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: sentry
# pidfile: /var/run/sentry.pid


# Source function library.
. /etc/rc.d/init.d/functions

# Get config.
. /etc/sysconfig/network

# Check that networking is up.
if [ ${NETWORKING} = "no" ]
then
	exit 0
fi

[ -f /usr/sbin/sentry ] || exit 0

# See how we were called.
case "$1" in
  start)
	echo -n "Starting port scan detector: "
	for mode in tcp udp ; do
		sentry -$mode
		echo -n "$mode "
	done
	echo
	touch /var/lock/subsys/sentry
	;;
  stop)
	echo -n "Stopping port scan detector: "
	killall sentry
	rm -f /var/lock/subsys/sentry
	;;
  status)
	status sentry
	;;
  restart|reload)
	$0 stop
	$0 start
	;;
  *)
	echo "Usage: inet {start|stop|status|restart|reload}"
	exit 1
esac

exit 0
