diff options
Diffstat (limited to 'main/fprobe-ulog')
-rw-r--r-- | main/fprobe-ulog/APKBUILD | 51 | ||||
-rw-r--r-- | main/fprobe-ulog/fprobe-1.1-pidfile-sanity.patch | 48 | ||||
-rw-r--r-- | main/fprobe-ulog/fprobe-ulog.confd | 68 | ||||
-rwxr-xr-x | main/fprobe-ulog/fprobe-ulog.initd | 39 |
4 files changed, 206 insertions, 0 deletions
diff --git a/main/fprobe-ulog/APKBUILD b/main/fprobe-ulog/APKBUILD new file mode 100644 index 000000000..76c665c87 --- /dev/null +++ b/main/fprobe-ulog/APKBUILD @@ -0,0 +1,51 @@ +# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org> +pkgname=fprobe-ulog +pkgver=1.1 +pkgrel=1 +pkgdesc="netfilter-based tool that collect network traffic" +url="http://fprobe.sourceforge.net/" +arch="all" +license="GPL" +depends= +makedepends="" +install="" +subpackages="$pkgname-doc" +source="http://downloads.sourceforge.net/project/fprobe/$pkgname/$pkgver/$pkgname-1.1.tar.bz2 + fprobe-ulog.confd + fprobe-ulog.initd + fprobe-1.1-pidfile-sanity.patch + " + +_builddir="$srcdir"/$pkgname-$pkgver + +prepare() { + cd $_builddir + for i in ../*.patch + do + msg "Applying $i" + patch -p1 < ../$i || exit 1 + done +} + +build() { + cd "$_builddir" + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info + make || return 1 +} + +package() { + cd "$_builddir" + make DESTDIR="$pkgdir" install + + install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname + install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname + +} + +md5sums="cdb2e4edc47e8a3d5479eeabfb979ebc fprobe-ulog-1.1.tar.bz2 +a92104da52c99532d1d01007b78940fc fprobe-ulog.confd +744975c055421223940a278517b34d47 fprobe-ulog.initd +f1316ad835c1a2b6565b4dc448b022df fprobe-1.1-pidfile-sanity.patch" diff --git a/main/fprobe-ulog/fprobe-1.1-pidfile-sanity.patch b/main/fprobe-ulog/fprobe-1.1-pidfile-sanity.patch new file mode 100644 index 000000000..5f7b79bd8 --- /dev/null +++ b/main/fprobe-ulog/fprobe-1.1-pidfile-sanity.patch @@ -0,0 +1,48 @@ +If we are using the chroot() option or the setuid options, we must create the +pidfile before doing the chroot OR the setreuid. It's actually best for +start-stop-daemon if we create the pidfile from the master side of the fork() +before it exits, since most of the startup checks happen after the chroot() +unfortunetly. + +Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> + +diff -Nuar fprobe-1.1.orig/src/fprobe.c fprobe-1.1/src/fprobe.c +--- fprobe-1.1.orig/src/fprobe-ulog.c 2005-01-30 08:43:35.000000000 +0000 ++++ fprobe-1.1/src/fprobe-ulog.c 2008-03-16 20:51:24.000000000 +0000 +@@ -1379,7 +1379,8 @@ + + my_log_open(ident, verbosity, log_dest); + if (!(log_dest & 2)) { +- switch (fork()) { ++ pid_t childpid = fork(); ++ switch (childpid) { + case -1: + fprintf(stderr, "fork(): %s", strerror(errno)); + exit(1); +@@ -1392,6 +1393,12 @@ + break; + + default: ++ if (!(pidfile = fopen(pidfilepath, "w"))) ++ my_log(LOG_ERR, "Can't create pid file. fopen(): %s", strerror(errno)); ++ else { ++ fprintf(pidfile, "%ld\n", (long) childpid); ++ fclose(pidfile); ++ } + exit(0); + } + } else { +@@ -1548,13 +1555,6 @@ + } + } + +- if (!(pidfile = fopen(pidfilepath, "w"))) +- my_log(LOG_ERR, "Can't create pid file. fopen(): %s", strerror(errno)); +- else { +- fprintf(pidfile, "%ld\n", (long) pid); +- fclose(pidfile); +- } +- + my_log(LOG_INFO, "pid: %d", pid); + my_log(LOG_INFO, "interface: %s, datalink: %s (%d)", + dev, dlt[link_type_idx].descr, link_type); diff --git a/main/fprobe-ulog/fprobe-ulog.confd b/main/fprobe-ulog/fprobe-ulog.confd new file mode 100644 index 000000000..758d97f46 --- /dev/null +++ b/main/fprobe-ulog/fprobe-ulog.confd @@ -0,0 +1,68 @@ +# Config file for /etc/init.d/fprobe +DAEMON=/usr/sbin/fprobe-ulog + +# Do we want the interface in promiscous mode [yes/no] +#PROMISC=no + +# If configured, only capture packets matching this tcpdump expression +#FILTER="" + +# Flow state timers +#TIMER_EXPIRED=5 +#TIMER_FRAGMENTED=30 +#TIMER_IDLE=60 +#TIMER_ACTIVE=300 + +# This is the default and should be left unless you know what you are doing +#FLOW_VER=5 + +# local ip. if configured fprobe will use this as the source IP for sending ALL flow data +# If you want to specify a specific source address per collecter, customize it below +#LOCALIP= + +# SNMP iface id +SNMP_IFACE="${IFACE//eth}" + +# Maximum number of concurrent flows to track +# using a specified amount of memory +#MEMBULK=10000 +#MEMLIMIT= + +# Pending queue +#PENDING=100 + +# Kernel capture buffer size (kB) +#KERNBUF=1024 + +# Realtime priority [0=disabled, 1..99] +#RTPRIO=0 + +# Delay N nanoseconds after each B bytes +#DELAY="0:0" + +# How much of the start of each packet to grab +#SNAPLEN=256 + +# chroot() to this location after startup +CHROOT="/var/empty" + +# User to run as. must have perms to the pidfile directory /var/run/fprobe/ +USER=nobody + +# logging level for syslog (0=EMERG, ..., 6=INFO, 7=DEBUG) +#LOGLEVEL=6 + +# If you want to run multiple instances of fprobe, +# You MUST set this variable to a unique INTEGER for each one! +PIDFILE_ID='' + +# remote ip. this is where we send flows +REMOTEIP=127.0.0.1 +# port to listen on +PORT=2055 +# Collector type, see the manpage for valid types +TYPE='' + +# If you want multiple collectors, just specify each one here +COLLECTORS="${REMOTEIP}:${PORT}/${LOCALIP}/${TYPE}" + diff --git a/main/fprobe-ulog/fprobe-ulog.initd b/main/fprobe-ulog/fprobe-ulog.initd new file mode 100755 index 000000000..d8f5c9acf --- /dev/null +++ b/main/fprobe-ulog/fprobe-ulog.initd @@ -0,0 +1,39 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need net + after firewall +} + +PIDFILE_EXTRA="" +[ -n "$PIDFILE_ID" ] && PIDFILE_EXTRA="[$PIDFILE_ID]" +PIDFILE="/var/run/fprobe-ulog$PIDFILE_EXTRA.pid" + +start() { + ebegin "Starting fprobe-ulog" + local OPTS="" + set -- + [ -n "${FILTER}" ] && set -- -f "${FILTER}" + for optname in s:TIMER_EXPIRED g:TIME_FRAGMENTED d:TIMER_IDLE \ + e:TIMER_ACTIVE n:FLOW_VER a:LOCALIP X:SNMP_IFACE b:MEMBULK \ + m:MEMLIMIT q:PENDING B:KERNBUF r:RTPRIO t:DELAY \ + c:CHROOT u:USER v:LOGLEVEL ; do + opt="${optname/:*}" optvar="${optname/*:}" + eval optvalue="\$$optvar" + [ -n "$optvalue" ] && OPTS="${OPTS} -${opt} ${optvalue}" + done + OPTS="${OPTS} -l 1:${PIDFILE_ID} ${COLLECTORS}" + start-stop-daemon --start --exec $DAEMON \ + --pidfile ${PIDFILE} \ + -- "$@" ${OPTS} + eend $? +} + +stop() { + ebegin "Stopping fprobe-ulog" + start-stop-daemon --stop --quiet --exec $DAEMON \ + --pidfile ${PIDFILE} + eend $? +} |