summaryrefslogtreecommitdiff
path: root/network/snort/rc.snort
diff options
context:
space:
mode:
authorNiels Horn <niels.horn@gmail.com>2010-09-20 19:23:25 -0400
committerRobby Workman <rworkman@slackbuilds.org>2010-09-21 22:09:42 -0500
commit75f2ad568a76b131b75575e8054e098dd819a01d (patch)
treef44be5b83ab07e8f3a888e14645d19a1f50b3085 /network/snort/rc.snort
parent68992763c25422917ed066d030ff8d7fb640358b (diff)
downloadslackbuilds-75f2ad568a76b131b75575e8054e098dd819a01d.tar.gz
network/snort: Added (Intrusion Detection and Prevention System)
Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
Diffstat (limited to 'network/snort/rc.snort')
-rw-r--r--network/snort/rc.snort53
1 files changed, 53 insertions, 0 deletions
diff --git a/network/snort/rc.snort b/network/snort/rc.snort
new file mode 100644
index 0000000000..d91941e822
--- /dev/null
+++ b/network/snort/rc.snort
@@ -0,0 +1,53 @@
+#!/bin/sh
+# Start/stop/restart snort
+
+# This tell snort which interface to listen on (any for every interface)
+IFACE=${IFACE:-any}
+
+# Make sure this matches your IFACE
+PIDFILE=/var/run/snort_$IFACE.pid
+
+# You probably don't want to change this, but in case you do
+LOGDIR="/var/log/snort"
+
+# Probably not this either
+CONF=/etc/snort/snort.conf
+
+# Start snort:
+snort_start() {
+ CMDLINE="/usr/bin/snort -d -D -i $IFACE"
+ echo -n "Starting Snort daemon: $CMDLINE"
+ $CMDLINE --pid-path /var/run --create-pidfile -l $LOGDIR -c $CONF
+ echo
+}
+
+# Stop snort:
+snort_stop() {
+ echo -n "Stopping Snort daemon ($IFACE)..."
+ kill $(cat $PIDFILE)
+ echo
+ sleep 1
+ rm -f $PIDFILE
+}
+
+# Restart snort:
+snort_restart() {
+ snort_stop
+ sleep 1
+ snort_start
+}
+
+case "$1" in
+'start')
+ snort_start
+ ;;
+'stop')
+ snort_stop
+ ;;
+'restart')
+ snort_restart
+ ;;
+*)
+ echo "usage $0 start|stop|restart"
+esac
+