#!/bin/bash
# labrea	This shell script takes care of starting and stopping
#		the labrea tarpit program
#
# chkconfig: 2345 52 48
# description: labrea - the labrea tarpit program. \
#LaBrea is a program that creates a tarpit or, as some have called it, a \
#"sticky honeypot". LaBrea takes over unused IP addresses on a network \
#and creates "virtual machines" that answer to connection attempts. \
#LaBrea answers those connection attempts in a way that causes the \
#machine at the other end to get "stuck", sometimes for a very long time.
# processname: labrea
# config: /etc/labrea.conf
# ##pidfile: /var/run/labrea.pid

PATH=/usr/bin:/sbin:/bin:/usr/sbin
export PATH

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

if [ -f /etc/labrea.conf ]; then
	. /etc/labrea.conf
fi

if [ -z "$LABREAZ" ]; then
	echo You _must_ read the /usr/share/doc/labrea-2.0/LaBrea.README up
	echo to section 7 _and_ edit /etc/labrea.conf before this daemon
	echo will start.
	exit 1
fi

case "$1" in
start)
	echo -n "Starting labrea: "
	nohup /usr/sbin/labrea $LABREAOPTIONS $LABREAZ >>/var/log/labrea 2>&1 &
	touch /var/lock/subsys/labrea
	echo "done"
	;;
stop)
	echo -n "Stopping labrea: "
	killall -TERM /usr/sbin/labrea
	rm -f /var/lock/subsys/labrea
	echo "done"
	;;
restart)
	$0 stop
	$0 start
	exit $?
	;;
status)
	status labrea
	exit $?
	;;
probe)
	exit 0
	;;
*)
	echo "Usage: $0 {start|stop|status|restart}"
	exit 1
esac

exit 0
