summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-analyzer/daemonlogger/files')
-rw-r--r--net-analyzer/daemonlogger/files/daemonlogger-confd19
-rw-r--r--net-analyzer/daemonlogger/files/daemonlogger-initd26
-rw-r--r--net-analyzer/daemonlogger/files/daemonlogger.confd.159
-rw-r--r--net-analyzer/daemonlogger/files/daemonlogger.rc.154
4 files changed, 113 insertions, 45 deletions
diff --git a/net-analyzer/daemonlogger/files/daemonlogger-confd b/net-analyzer/daemonlogger/files/daemonlogger-confd
deleted file mode 100644
index 39240d3a0..000000000
--- a/net-analyzer/daemonlogger/files/daemonlogger-confd
+++ /dev/null
@@ -1,19 +0,0 @@
-# Config file for /etc/init.d/daemonlogger.
-# Note that you can run daemonlogger as a non-daemon without the init script.
-
-# Set the listening interface.
-IFACE="eth0"
-
-# Set the output interface for tapping.
-# Note that this disables the logging option below.
-#TAP="eth1"
-
-# The directory to which logged pcap-files are stored.
-LOGDIR="/var/log/daemonlogger"
-
-# The user/group to which the program drops privileges.
-# Note that if you change this, please adjust the permissions of LOGDIR accordingly.
-USER="daemonlogger"
-
-# This gathers the above options.
-DAEMONLOGGER_OPTS="-d -i $IFACE -u $USER -g $USER -l $LOGDIR"
diff --git a/net-analyzer/daemonlogger/files/daemonlogger-initd b/net-analyzer/daemonlogger/files/daemonlogger-initd
deleted file mode 100644
index f9b172169..000000000
--- a/net-analyzer/daemonlogger/files/daemonlogger-initd
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/sbin/runscript
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-if [ -n "${TAP}" ] ; then
- DAEMONLOGGER_OPTS="${DAEMONLOGGER_OPTS} -o ${TAP}"
-fi
-
-depend() {
- need net
-}
-
-start() {
- ebegin "Starting daemonlogger on ${IFACE}"
- start-stop-daemon --start --exec /usr/sbin/daemonlogger \
- --pidfile /var/run/daemonlogger_$IFACE.pid --background \
- -- -P /var/run -p daemonlogger_$IFACE.pid ${DAEMONLOGGER_OPTS}
- eend $?
-}
-
-stop() {
- ebegin "Stopping daemonlogger on ${IFACE}"
- start-stop-daemon --stop --quiet --retry 5 --pidfile /var/run/daemonlogger_$IFACE.pid
- eend $?
-}
diff --git a/net-analyzer/daemonlogger/files/daemonlogger.confd.1 b/net-analyzer/daemonlogger/files/daemonlogger.confd.1
new file mode 100644
index 000000000..63e168225
--- /dev/null
+++ b/net-analyzer/daemonlogger/files/daemonlogger.confd.1
@@ -0,0 +1,59 @@
+# Config file for /etc/init.d/daemonlogger
+
+#### Service related options ####
+# This tell daemonlogger which interface to listen on
+IFACE="eth0"
+#
+# User and Group to run as
+DL_USER="daemonlogger"
+DL_GROUP="daemonlogger"
+#
+# Define the location of your BPF file.
+BPF="/etc/daemonlogger/daemonlogger.bpf"
+#
+# Set the number of bytes to capture per packet.
+# Specify 0 (zero) to capture the full packet.
+# 'man tcpdump' for more info about snaplen.
+SNAP="0"
+#
+# This option determins if daemonlogger will log captured packets
+# to disk (log mode) or redirect them out a second interface (tap mode).
+# Valid options are "log" or "tap"
+DL_MODE="log"
+###########################
+
+##### Log Mode Options #####
+# If you specified "log" above, then these options will be used
+# when you start the daemonlogger init script.
+#
+# Directory to log pcap files to.
+LOG_DIR="/var/log/daemonlogger"
+#
+# The pcap files can be rolled over based on size, time or both.
+# If you want to use only size or time, then comment out the one you do not
+# wish to use. If you use both, then the first boundry the file reaches
+# will cause the pcap file to roll over.
+#
+# Rollover the log file if it reaches this size in bytes.
+#LOG_SIZE="1073741824"
+#
+# Rollover the log file on time intervals. Append an 'm' to rollover on minute
+# boundaries, 'h' to rollover on hour boundaries and 'd' to rollover on day boundaries.
+# See the README in the doc directory for more information.
+LOG_TIME="1h"
+#
+# This option will write log files to the disk until it reaches this % utilization and
+# then roll over and delete the oldest log file.
+LOG_PCT="80"
+############################
+
+##### Tap Mode Options #####
+# If you specified "tap" above, then these options will be used
+# when you start the daemonlogger init script.
+#
+# In tap mode, which interface to output packets to. This can not
+# be the same as IFACE above.
+TAP_OFACE="eth1"
+############################
+
+DL_OPTS="-d -i $IFACE -S $SNAP -f $BPF -u $DL_USER -g $DL_GROUP"
diff --git a/net-analyzer/daemonlogger/files/daemonlogger.rc.1 b/net-analyzer/daemonlogger/files/daemonlogger.rc.1
new file mode 100644
index 000000000..338323f6e
--- /dev/null
+++ b/net-analyzer/daemonlogger/files/daemonlogger.rc.1
@@ -0,0 +1,54 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+depend() {
+ after net.${IFACE}
+
+ if [[ ${DL_MODE} = "tap" ]] ; then
+ after net.${TAP_OFACE}
+ fi
+}
+
+start() {
+
+ if [ ! -d /var/run/daemonlogger ]; then
+ mkdir -p /var/run/daemonlogger
+ chown ${DL_USER}:${DL_GROUP} /var/run/daemonlogger
+ fi
+
+ if [[ ${DL_MODE} = "log" ]]; then
+ LOG_OPTS="-l ${LOG_DIR} -M ${LOG_PCT} -r"
+
+ if [[ -n $LOG_SIZE ]]; then
+ LOG_OPTS="${LOG_OPTS} -s ${LOG_SIZE}"
+ fi
+
+ if [[ -n $LOG_TIME ]]; then
+ LOG_OPTS="${LOG_OPTS} -t ${LOG_TIME}"
+ fi
+
+ ebegin "Starting daemonlogger in LOG mode"
+ start-stop-daemon --start --quiet --exec /usr/bin/daemonlogger \
+ --pidfile /var/run/daemonlogger/daemonlogger.pid \
+ -- ${LOG_OPTS} ${DL_OPTS} -P /var/run/daemonlogger -p daemonlogger.pid >/dev/null 2>&1
+ eend $?
+
+ elif [[ ${DL_MODE} = "tap" ]]; then
+ ebegin "Starting daemonlogger in TAP mode"
+ start-stop-daemon --start --quiet --exec /usr/bin/daemonlogger \
+ --pidfile /var/run/daemonlogger/daemonlogger.pid \
+ -- -o ${TAP_OFACE} ${DL_OPTS} -P /var/run/daemonlogger -p daemonlogger.pid >/dev/null 2>&1
+ eend $?
+ else
+ eerror 'DL_MODE not set to "log" or "tap" in /etc/conf.d/daemonlogger!'
+ fi
+}
+
+stop() {
+ ebegin "Stopping daemonlogger"
+ start-stop-daemon --stop --quiet --pidfile /var/run/daemonlogger/daemonlogger.pid
+ eend $?
+}
+