ports/66275: New port: net/cnupm The BPF Traffic Collector (IPv4/IPv6)
Dennis S. Davidoff
null at 1system.ru
Sun May 9 16:02:24 UTC 2004
Forgive me my quickness. :-)
--- cnupm.arc begins here ---
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# cnupm
# cnupm/Makefile
# cnupm/distinfo
# cnupm/pkg-descr
# cnupm/pkg-message
# cnupm/pkg-plist
# cnupm/files
# cnupm/files/cnupm.sh
# cnupm/files/patch-libcnupm::cnupm_restrict.c
#
echo c - cnupm
mkdir -p cnupm > /dev/null 2>&1
echo x - cnupm/Makefile
sed 's/^X//' >cnupm/Makefile << 'END-of-cnupm/Makefile'
X# New ports collection makefile for: cnupm
X# Date created: 29 October 2003
X# Whom: Dennis S.Davidoff <null at 1system.ru>
X#
X# $FreeBSD$
X#
X
XPORTNAME= cnupm
XPORTVERSION= 3.5
XCATEGORIES= net ipv6
XMASTER_SITES= http://pdp-11.org.ru/~form/cnupm/files/
X
XMAINTAINER= null at 1system.ru
XCOMMENT= The BPF Traffic Collector (IPv4/IPv6)
X
XMAN8= cnupm.8 cnupmstat.8
XMANCOMPRESSED= yes
X
XCNUPM_OWN?= cnupm
XCNUPM_GRP?= cnupm
XCNUPM_UID?= 666
XCNUPM_GID?= 666
X
XPW= /usr/sbin/pw
X
XPLIST_SUB+= CNUPM_OWN="${CNUPM_OWN}" CNUPM_GRP="${CNUPM_GRP}" \
X CNUPM_UID="${CNUPM_UID}" CNUPM_GID="${CNUPM_GID}"
X
Xpost-install:
X ${PW} groupshow ${CNUPM_GRP} 2>/dev/null || ${PW} group add \
X -n ${CNUPM_GRP} -g ${CNUPM_GID}
X ${PW} user show ${CNUPM_OWN} 2>/dev/null || ${PW} user add \
X -n ${CNUPM_OWN} -c 'Cnupm traffic collector' \
X -u ${CNUPM_UID} -g ${CNUPM_GID} -s /sbin/nologin
X ${INSTALL} -o ${CNUPM_OWN} -g ${CNUPM_GRP} -m 750 -d
${PREFIX}/var/cnupm
X ${PW} user mod -n ${CNUPM_OWN} -d ${PREFIX}/var/cnupm
X ${INSTALL} -m 755 ${FILESDIR}/cnupm.sh ${PREFIX}/etc/rc.d
X.if !defined(NOPORTDOCS)
X @${MKDIR} ${DOCSDIR}
X @${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
X.endif
X
X @${ECHO_CMD}
'************************************************************'
X @${ECHO_CMD} ''
X @${ECHO_CMD} 'Add the following lines to /etc/rc.conf to enable
cnupm:'
X @${ECHO_CMD} ''
X @${ECHO_CMD} 'cnupm_enable="YES"'
X @${ECHO_CMD} 'cnupm_ifaces="rl0" # Change this with your
interface!'
X @${ECHO_CMD} '#cnupm_flags="" # Set this one to override
default flags'
X @${ECHO_CMD} ''
X @${ECHO_CMD} 'See cnupm(8) for flags'
X @${ECHO_CMD} ''
X @${ECHO_CMD}
'************************************************************'
X
X.include <bsd.port.mk>
END-of-cnupm/Makefile
echo x - cnupm/distinfo
sed 's/^X//' >cnupm/distinfo << 'END-of-cnupm/distinfo'
XMD5 (cnupm-3.5.tar.gz) = c9b1f2670e7bd7aaeda6fa26d0434f4f
XSIZE (cnupm-3.5.tar.gz) = 31984
END-of-cnupm/distinfo
echo x - cnupm/pkg-descr
sed 's/^X//' >cnupm/pkg-descr << 'END-of-cnupm/pkg-descr'
XThe cnupm is an IP/IPv6 traffic collector daemon; it listens on a
network
Xinterface for IP/IPv6 packets that match the boolean expression (see
Xtcpdump(8) for more information) and collects the following statistics:
X
X o address family (INET/INET6)
X o IP/IPv6 protocol number
X o source IP/IPv6 address
X o source TCP/UDP port
X o destination IP/IPv6 address
X o destination TCP/UDP port
X o total number of bytes trasferred
X
XWWW: http://pdp-11.org.ru/~form/cnupm
END-of-cnupm/pkg-descr
echo x - cnupm/pkg-message
sed 's/^X//' >cnupm/pkg-message << 'END-of-cnupm/pkg-message'
X************************************************************
X
XAdd the following lines to /etc/rc.conf to enable cnupm:
X
Xcnupm_enable="YES"
Xcnupm_ifaces="rl0" # Change this with your interface!
X#cnupm_flags="" # Set this one to override default flags
X
XSee cnupm(8) for flags
X
X************************************************************
END-of-cnupm/pkg-message
echo x - cnupm/pkg-plist
sed 's/^X//' >cnupm/pkg-plist << 'END-of-cnupm/pkg-plist'
Xetc/rc.d/cnupm.sh
Xsbin/cnupm
Xsbin/cnupmstat
X%%PORTDOCS%%share/doc/cnupm/README
X%%PORTDOCS%%@dirrm share/doc/cnupm
X at exec pw groupshow %%CNUPM_GRP%% 2>/dev/null || pw group add -n cnupm
-g %%CNUPM_GID%%
X at exec pw user show %%CNUPM_OWN%% 2>/dev/null || pw user add -n
%%CNUPM_OWN%% -c 'Cnupm traffic collector' -u %%CNUPM_UID%% -g
%%%CNUPM_GID%% -s /sbin/nologin
X at exec install -o cnupm -g cnupm -m 750 -d %D/var/cnupm
X at exec pw user mod -n cnupm -d %D/var/cnupm
X at unexec rmdir %D/var/cnupm 2>/dev/null || true
END-of-cnupm/pkg-plist
echo c - cnupm/files
mkdir -p cnupm/files > /dev/null 2>&1
echo x - cnupm/files/cnupm.sh
sed 's/^X//' >cnupm/files/cnupm.sh << 'END-of-cnupm/files/cnupm.sh'
X#!/bin/sh
X#
X# $FreeBSD$
X#
X
X#
X# Add the following lines to /etc/rc.conf to enable rsyncd:
X#
X# cnupm_enable="YES"
X# cnupm_ifaces="rl0" # Change this with your interface!
X# cnupm_flags="" # Set this one to override default flags
X#
X# See cnupm(8) for flags
X#
X
X. /usr/local/etc/rc.subr
X
Xname=cnupm
Xrcvar=`set_rcvar`
Xcommand=/usr/local/sbin/cnupm
Xcnupm_flags="-ep -f inet -u cnupm"
X
Xload_rc_config ${name}
X
Xcnupm_enable=${cnupm_enable:-"NO"}
X
Xcase ${cnupm_enable} in
X[Yy][Ee][Ss])
X if [ -z ${cnupm_iface} ]; then
X err 1 "cnupm_iface is not set - edit /etc/rc.conf"
X fi
Xesac
X
Xcnupm_flags="-i ${cnupm_iface} ${cnupm_flags:-""}"
Xpidfile=~${name}/${name}-${cnupm_iface}.pid
X
Xrun_rc_command "$1"
END-of-cnupm/files/cnupm.sh
echo x - cnupm/files/patch-libcnupm::cnupm_restrict.c
sed 's/^X//' >cnupm/files/patch-libcnupm::cnupm_restrict.c <<
'END-of-cnupm/files/patch-libcnupm::cnupm_restrict.c'
X--- libcnupm/cnupm_restrict.c.orig Tue Apr 27 14:30:48 2004
X+++ libcnupm/cnupm_restrict.c Tue Apr 27 14:31:08 2004
X@@ -55,7 +55,7 @@
X #endif /* HAVE_INITGROUPS */
X #endif /* HAVE_LOGIN_CAP */
X return (-1);
X- if (chroot(pw->pw_dir) < 0 || chdir("/") < 0 || setuid(pw->pw_uid) <
0)
X+ if (chroot(pw->pw_dir) < 0 || setuid(pw->pw_uid) < 0 || chdir("/") <
0)
X return (-1);
X return (0);
X }
END-of-cnupm/files/patch-libcnupm::cnupm_restrict.c
exit
--- cnupm.arc ends here ---
More information about the freebsd-ports-bugs
mailing list