diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /net-analyzer/flow-tools/files |
reinit the tree, so we can have metadata
Diffstat (limited to 'net-analyzer/flow-tools/files')
-rw-r--r-- | net-analyzer/flow-tools/files/flow-tools-0.68.5.1-run.patch | 22 | ||||
-rw-r--r-- | net-analyzer/flow-tools/files/flow-tools-0.68.5.1-syslog.patch | 47 | ||||
-rw-r--r-- | net-analyzer/flow-tools/files/flowcapture.confd | 51 | ||||
-rw-r--r-- | net-analyzer/flow-tools/files/flowcapture.initd | 30 | ||||
-rw-r--r-- | net-analyzer/flow-tools/files/linkme | 15 |
5 files changed, 165 insertions, 0 deletions
diff --git a/net-analyzer/flow-tools/files/flow-tools-0.68.5.1-run.patch b/net-analyzer/flow-tools/files/flow-tools-0.68.5.1-run.patch new file mode 100644 index 000000000000..e1b06eee7e00 --- /dev/null +++ b/net-analyzer/flow-tools/files/flow-tools-0.68.5.1-run.patch @@ -0,0 +1,22 @@ +--- a/src/flow-fanout.c ++++ b/src/flow-fanout.c +@@ -57,7 +57,7 @@ + #endif + + +-#define FANOUT_PIDFILE "/var/run/flow-fanout.pid" ++#define FANOUT_PIDFILE "/run/flow-fanout.pid" + + #define SELECT_TIMEOUT 5 /* 5 seconds */ + +--- a/src/flow-capture.c ++++ b/src/flow-capture.c +@@ -61,7 +61,7 @@ + + void fterr_exit_handler(int code); + +-#define CAPTURE_PIDFILE "/var/run/flow-capture.pid" ++#define CAPTURE_PIDFILE "/run/flow-capture.pid" + + #define SELECT_TIMEOUT 1 /* 1 second */ + diff --git a/net-analyzer/flow-tools/files/flow-tools-0.68.5.1-syslog.patch b/net-analyzer/flow-tools/files/flow-tools-0.68.5.1-syslog.patch new file mode 100644 index 000000000000..cb17471072bc --- /dev/null +++ b/net-analyzer/flow-tools/files/flow-tools-0.68.5.1-syslog.patch @@ -0,0 +1,47 @@ +--- a/lib/fterr.c ++++ b/lib/fterr.c +@@ -112,7 +112,7 @@ + fprintf(((fterr_file) ? fterr_file : stderr), "%s\n", buf2); + + if (fterr_flags & FTERR_SYSLOG) +- syslog(LOG_INFO, buf); ++ syslog(LOG_INFO, "%s", buf); + + } /* fterr_info */ + +@@ -134,7 +134,7 @@ + + if (fterr_flags & FTERR_SYSLOG) { + snprintf(buf2, 1024, "%s: %s", buf, strerror(errno)); +- syslog(LOG_INFO, buf2); ++ syslog(LOG_INFO, "%s", buf2); + } + + if (fterr_exit) +@@ -159,7 +159,7 @@ + } + + if (fterr_flags & FTERR_SYSLOG) +- syslog(LOG_INFO, buf); ++ syslog(LOG_INFO, "%s", buf); + + if (fterr_exit) + fterr_exit(code); +@@ -183,7 +183,7 @@ + } + + if (fterr_flags & FTERR_SYSLOG) +- syslog(LOG_INFO, buf); ++ syslog(LOG_INFO, "%s", buf); + + } /* fterr_warnx */ + +@@ -205,7 +205,7 @@ + + if (fterr_flags & FTERR_SYSLOG) { + snprintf(buf2, 1024, "%s: %s", buf, strerror(errno)); +- syslog(LOG_INFO, buf2); ++ syslog(LOG_INFO, "%s", buf2); + } + + } /* fterr_warn */ diff --git a/net-analyzer/flow-tools/files/flowcapture.confd b/net-analyzer/flow-tools/files/flowcapture.confd new file mode 100644 index 000000000000..e926d64a8eec --- /dev/null +++ b/net-analyzer/flow-tools/files/flowcapture.confd @@ -0,0 +1,51 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# Config file for /etc/init.d/flowcap + +# This is the default and should be left unless you know what you are doing +FLOW_VER=5 + +# local ip. if configured flow-capture will only ps flows sent to this ip. +LOCALIP=0 + +# You probably don't want to change this, but in case you do - nest level +NEST=0 + +# port to listen on +PORT=2055 + +# remote ip. If this is configured only flows from this exporter will be accepted +# by default we will accept any flows sent to us +REMOTEIP=0 + +# program used to rotate +ROTATE_PROG="/var/lib/flows/bin/linkme" + +# number of rotations per day +ROTATIONS=287 + +# Retain the maximum number of files so that the total storage is less than SIZE +# The letters b,K,M,G can be used as multipliers, ie 16 Megabytes is 16M. +SIZE=1G + +# interval in mins at which flowscan will print out stats in logs +#STAT_INT=5 +# NOTE: with versions of flow-tools >=0.67 there is a bug that will cause a loop if you specify the STAT_INT +# Only use that variable if you using an older flow-tools (and consequently a custom built ebuild as this config file is not in our older ebuilds) + +# dir we will be saving flows and working in +WORKDIR=/var/lib/flows/ft + +# user to run as +USER=flows + +# Pidfile base +# The daemon takes the pidfile argument and APPENDS .$PORT itself in writing. +# It may have multiple children by original design, but this is not recommended +# for Gentoo at this time. +PIDFILE_BASE=${PIDFILE_BASE:=/run/flows/flowcapture.pid} + +# This pulls in the options above +FLOW_OPTS="-p $PIDFILE_BASE -w $WORKDIR $LOCALIP/$REMOTEIP/$PORT -V $FLOW_VER -E $SIZE -n $ROTATIONS -N $NEST -R $ROTATE_PROG" +# Use below only if you have sorted out the STAT_INT problem +#FLOW_OPTS="-p /run/flows/flowcapture.pid.$PORT -w $WORKDIR $LOCALIP/$REMOTEIP/$PORT -S $STAT_INT -V $FLOW_VER -E $SIZE -n $ROTATIONS -N $NEST -R $ROTATE_PROG" diff --git a/net-analyzer/flow-tools/files/flowcapture.initd b/net-analyzer/flow-tools/files/flowcapture.initd new file mode 100644 index 000000000000..c6fc34728799 --- /dev/null +++ b/net-analyzer/flow-tools/files/flowcapture.initd @@ -0,0 +1,30 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +PORT=${PORT:=2055} +# The daemon takes the pidfile argument and APPENDS .$PORT itself in writing. +# It may have multiple children by original design, but this is not recommended +# for Gentoo at this time. +PIDFILE_BASE=${PIDFILE_BASE:=/run/flows/flowcapture.pid} +PIDFILE=${PIDFILE:=${PIDFILE_BASE}.${PORT}} + +depend() { + use net +} + +start() { + ebegin "Starting flow-capture" + checkpath -d -o flows /run/flows + start-stop-daemon --start --user ${USER} --exec /usr/bin/flow-capture \ + --pidfile ${PIDFILE} \ + -- ${FLOW_OPTS} >/dev/null 2>&1 + eend $? +} + +stop() { + ebegin "Stopping flow-capture" + start-stop-daemon --stop --quiet --exec /usr/bin/flow-capture \ + --pidfile ${PIDFILE} + eend $? +} diff --git a/net-analyzer/flow-tools/files/linkme b/net-analyzer/flow-tools/files/linkme new file mode 100644 index 000000000000..4f666d903d42 --- /dev/null +++ b/net-analyzer/flow-tools/files/linkme @@ -0,0 +1,15 @@ +#!/usr/bin/perl + +$base = "/var/lib/flows"; +if ($ARGV[0] =~ /.*[\/]*(ft-v05[^\/]*$)/) { +$fileName = $1; +} else { +print "Must specify file\n"; +exit 1; +} + +unless ( symlink("$base/ft/$fileName","$base/$fileName") ) { +print "Unable to create symbolic link: $base/$fileName\n"; +exit 1; +} + |