From 50c6b1ba8223f469dcd1921f878b2f602771d244 Mon Sep 17 00:00:00 2001 From: edwin Date: Thu, 4 Sep 2003 13:48:27 +0000 Subject: irc.d script for security/snort This is a sample script for ${PREFIX}/etc/rc.d that will wake snort up on boot, and take it down on shutdown. Nothing fancy here. This is needed, because I'm planning on teaching ACID many new things, and ACID expects snort to help itself. There is only one thing that requires thinking here: This should run only after {MySQL|PostgreSQL} server is up, as snort might want to report to the local server. PR: ports/49047 Submitted by: Yonatan@xpert.com Approved by: maintainer timeout --- security/snort/Makefile | 2 ++ security/snort/files/snort.sh.sample | 21 +++++++++++++++++++++ security/snort/pkg-plist | 1 + 3 files changed, 24 insertions(+) create mode 100644 security/snort/files/snort.sh.sample (limited to 'security/snort') diff --git a/security/snort/Makefile b/security/snort/Makefile index 607aec4a51f4..1cddf5da1d7e 100644 --- a/security/snort/Makefile +++ b/security/snort/Makefile @@ -80,6 +80,8 @@ post-install: ${CP} ${DATADIR}/reference.config-sample \ ${DATADIR}/reference.config; \ fi; \ + ${INSTALL_DATA} ${FILESDIR}/snort.sh.sample \ + ${PREFIX}/etc/rc.d/snort.sh.sample; \ ${INSTALL_DATA} ${WRKSRC}/etc/snort.conf \ ${PREFIX}/etc/snort.conf-sample; \ if [ ! -f ${PREFIX}/etc/snort.conf ]; then \ diff --git a/security/snort/files/snort.sh.sample b/security/snort/files/snort.sh.sample new file mode 100644 index 000000000000..b1bb94874977 --- /dev/null +++ b/security/snort/files/snort.sh.sample @@ -0,0 +1,21 @@ +#!/bin/sh + +if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then + echo "$0: Cannot determine the PREFIX" >&2 + exit 1 +fi + +case "$1" in +start) + ${PREFIX}/bin/snort -Dqc ${PREFIX}/etc/snort.conf > /dev/null && echo -n " snort" + ;; +stop) + kill `cat /var/run/snort_*.pid` + ;; +restart) + killall -1 `cat /var/run/snort_*.pid` + ;; +*) + echo "Usage: snort.sh [start|stop|restart]" + ;; +esac diff --git a/security/snort/pkg-plist b/security/snort/pkg-plist index fc0fd72a17e6..ad6472b370c2 100644 --- a/security/snort/pkg-plist +++ b/security/snort/pkg-plist @@ -1,6 +1,7 @@ bin/snort @unexec if [ -f %D/etc/snort.conf ] && cmp -s %D/etc/snort.conf %D/etc/snort.conf-sample; then rm -f %D/etc/snort.conf; fi etc/snort.conf-sample +etc/rc.d/snort.sh.sample @exec [ -f %B/snort.conf ] || cp %B/%f %B/snort.conf %%PORTDOCS%%share/doc/snort/AUTHORS %%PORTDOCS%%share/doc/snort/NEWS -- cgit