diff options
author | Vjaceslavs Klimovs <vklimovs@gmail.com> | 2020-08-13 21:32:18 -0700 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2021-03-15 21:03:37 +0000 |
commit | 6dace4048ed813d3811cdb8d325fd4519c117753 (patch) | |
tree | c38615ea3f0c05d9a25c189684a1bfa572f47544 /net-analyzer | |
parent | net-analyzer/hydra: drop obsolete USE=ncp (diff) | |
download | gentoo-6dace4048ed813d3811cdb8d325fd4519c117753.tar.gz gentoo-6dace4048ed813d3811cdb8d325fd4519c117753.tar.bz2 gentoo-6dace4048ed813d3811cdb8d325fd4519c117753.zip |
net-analyzer/nfdump: add use flags and init scripts for nfcapd
Closes: https://bugs.gentoo.org/712590
Signed-off-by: Vjaceslavs Klimovs <vklimovs@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'net-analyzer')
-rw-r--r-- | net-analyzer/nfdump/files/nfcapd.confd | 11 | ||||
-rw-r--r-- | net-analyzer/nfdump/files/nfcapd.initd | 60 | ||||
-rw-r--r-- | net-analyzer/nfdump/metadata.xml | 8 | ||||
-rw-r--r-- | net-analyzer/nfdump/nfdump-1.6.21-r1.ebuild | 78 |
4 files changed, 156 insertions, 1 deletions
diff --git a/net-analyzer/nfdump/files/nfcapd.confd b/net-analyzer/nfdump/files/nfcapd.confd new file mode 100644 index 000000000000..28ea35fd0741 --- /dev/null +++ b/net-analyzer/nfdump/files/nfcapd.confd @@ -0,0 +1,11 @@ +#shellcheck shell=sh +#shellcheck disable=SC2034 + +#port number to listen on +#PORT="2055" + +#maximum size of collected files +#MAX_SIZE="1G" + +#enable sending of all received packets to specified address +#REPEAT_TO="192.168.1.1/60062" diff --git a/net-analyzer/nfdump/files/nfcapd.initd b/net-analyzer/nfdump/files/nfcapd.initd new file mode 100644 index 000000000000..98d388cb710f --- /dev/null +++ b/net-analyzer/nfdump/files/nfcapd.initd @@ -0,0 +1,60 @@ +#!/sbin/openrc-run +#shellcheck shell=sh + +IDENT="${RC_SVCNAME#*.}" +PIDFILE="/run/nfcapd/${IDENT}.pid" +USER="nfcapd" +GROUP="nfcapd" + +ssd_start(){ + if [ -n "${MAX_SIZE}" ]; then + set -- "$@" -e + fi + if [ -n "${PORT}" ]; then + set -- "$@" -p "${PORT}" + fi + if [ -n "${REPEAT_TO}" ]; then + set -- "$@" -R "${REPEAT_TO}" + fi + start-stop-daemon "$@" +} + +checkconfig() { + if [ "${IDENT}" = "${RC_SVCNAME}" ]; then + eerror "You have to create an init script for each ident:" + eerror " cd /etc/init.d/; ln -s nfcapd nfcapd.ident" + return 1 + fi +} + +depend() { + need net +} + +start() { + checkconfig || return 1 + + checkpath -d -m 0750 -o nfcapd:nfcapd /run/nfcapd + checkpath -d -m 0750 -o nfcapd:nfcapd /var/tmp/nfcapd/"${IDENT}" + + if [ -n "${MAX_SIZE}" ]; then + nfexpire -u /var/tmp/nfcapd/"${IDENT}" -s "${MAX_SIZE}" \ + > /dev/null 2>&1 + chown -R ${USER}:${GROUP} /var/tmp/nfcapd/"${IDENT}" + fi + + ebegin "Starting ${RC_SVCNAME}" + ssd_start --start --quiet --exec /usr/bin/nfcapd \ + --pidfile "${PIDFILE}" -- -D -P "${PIDFILE}" -u ${USER} \ + -g ${GROUP} -I "${IDENT}" -l /var/tmp/nfcapd/"${IDENT}" + eend $? +} + +stop() { + checkconfig || return 1 + + ebegin "Stopping ${RC_SVCNAME}" + start-stop-daemon --stop --exec /usr/bin/nfcapd \ + --pidfile "${PIDFILE}" + eend $? +} diff --git a/net-analyzer/nfdump/metadata.xml b/net-analyzer/nfdump/metadata.xml index f785b8973856..f9f3c305c35a 100644 --- a/net-analyzer/nfdump/metadata.xml +++ b/net-analyzer/nfdump/metadata.xml @@ -6,12 +6,18 @@ <name>Gentoo network monitoring and analysis project</name> </maintainer> <use> - <flag name="readpcap">Build nfcapd collector to read from pcap file instead ofnetwork data</flag> <flag name="ftconv">Build the flow-tools to nfdump converter</flag> + <flag name="jnat">Build nfudmp to support JunOS NAT event logging</flag> + <flag name="nfpcapd">Build nfpcapd collector to create netflow data from precollected pcap traffic</flag> <flag name="nfprofile">Build nfprofile used by NfSen</flag> <flag name="nftrack">Build nfprofile used by PortTracker</flag> + <flag name="nsel">Build nfudmp to support NSEL/NEL event data</flag> + <flag name="readpcap">Build nfcapd collector to read from pcap file instead ofnetwork data</flag> <flag name="sflow">Build sflow collector sfcpad</flag> </use> + <longdescription>nfdump is a toolset to collect and process netflow and sflow + data, sent from netflow/sflow compatible devices. The toolset supports + netflow v1, v5/v7,v9,IPFIX and SFLOW.</longdescription> <upstream> <remote-id type="sourceforge">nfdump</remote-id> <remote-id type="github">phaag/nfdump</remote-id> diff --git a/net-analyzer/nfdump/nfdump-1.6.21-r1.ebuild b/net-analyzer/nfdump/nfdump-1.6.21-r1.ebuild new file mode 100644 index 000000000000..975d26b9c446 --- /dev/null +++ b/net-analyzer/nfdump/nfdump-1.6.21-r1.ebuild @@ -0,0 +1,78 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +inherit autotools + +DESCRIPTION="A set of tools to collect and process netflow data" +HOMEPAGE="https://github.com/phaag/nfdump" +SRC_URI="https://github.com/phaag/nfdump/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="BSD" +SLOT="0/1.6.15" +KEYWORDS="~amd64 ~x86" +IUSE="debug doc jnat ftconv nfpcapd nfprofile nftrack nsel readpcap sflow + static-libs" +REQUIRED_USE="?? ( jnat nsel )" + +COMMON_DEPEND=" + app-arch/bzip2 + sys-libs/zlib + ftconv? ( net-analyzer/flow-tools ) + nfpcapd? ( net-libs/libpcap ) + nfprofile? ( net-analyzer/rrdtool ) + nftrack? ( net-analyzer/rrdtool ) + readpcap? ( net-libs/libpcap ) +" +DEPEND=" + ${COMMON_DEPEND} + sys-devel/flex + virtual/yacc + doc? ( app-doc/doxygen media-gfx/graphviz ) +" +RDEPEND=" + ${COMMON_DEPEND} +" +PATCHES=( + "${FILESDIR}"/${PN}-1.6.19-compiler.patch + "${FILESDIR}"/${PN}-1.6.19-libft.patch +) +DOCS=( AUTHORS ChangeLog README.md ) + +src_prepare() { + default + + eautoreconf + + if use doc; then + doxygen -u doc/Doxyfile.in || die + fi +} + +src_configure() { + # --without-ftconf is not handled well #322201 + econf \ + $(use ftconv && echo "--enable-ftconv --with-ftpath=/usr") \ + $(use nfprofile && echo --enable-nfprofile) \ + $(use nftrack && echo --enable-nftrack) \ + $(use_enable debug devel) \ + $(use_enable jnat) \ + $(use_enable nfpcapd) \ + $(use_enable nsel) \ + $(use_enable readpcap) \ + $(use_enable sflow) \ + $(use_enable static-libs static) +} + +src_install() { + default + + find "${ED}" -name '*.la' -delete || die + + newinitd "${FILESDIR}"/nfcapd.initd nfcapd + newconfd "${FILESDIR}"/nfcapd.confd nfcapd + + if use doc; then + dodoc -r doc/html + fi +} |