Import cnupm-3.5.

cnupm is an IPv4/IPv6 traffic collector daemon; it listens on a network
interface for IPv4/IPv6 packets that match the boolean expression (see
tcpdump(8) for more information) and collects the following statistics:

     o   address family (INET/INET6)
     o   IPv4/IPv6 protocol number
     o   source IPv4/IPv6 address
     o   source TCP/UDP port
     o   destination IPv4/IPv6 address
     o   destination TCP/UDP port
     o   total number of bytes transferred

Based on the port from the cnupm author
Oleg Safiullin <form@pdp-11.org.ru>.

Help and ok pval@ naddy@.
This commit is contained in:
grange 2004-05-13 06:52:36 +00:00
parent f7ae4fc70a
commit 1236d6ba87
8 changed files with 168 additions and 0 deletions

34
net/cnupm/Makefile Normal file
View File

@ -0,0 +1,34 @@
# $OpenBSD: Makefile,v 1.1.1.1 2004/05/13 06:52:36 grange Exp $
COMMENT= "IPv4/IPv6 traffic collector"
DISTNAME= cnupm-3.5
CATEGORIES= net
HOMEPAGE= http://pdp-11.org.ru/~form/cnupm
MAINTAINER= Alexander Yurchenko <grange@openbsd.org>
# BSD
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
MASTER_SITES= ${HOMEPAGE}/files/
MAKE_ENV= BINDIR=${TRUEPREFIX}/sbin MANDIR=${TRUEPREFIX}/man/cat
CFLAGS+= -DCNUPM_USER=\"_cnupm\"
FLAVORS= static
FLAVOR?=
.if ${FLAVOR:Mstatic}
LDSTATIC= -static
MAKE_ENV+= LDSTATIC=${LDSTATIC}
.endif
.if !make(fake) && !make(install) && !make(package)
DESTDIRNAME= /
.endif
.include <bsd.port.mk>

3
net/cnupm/distinfo Normal file
View File

@ -0,0 +1,3 @@
MD5 (cnupm-3.5.tar.gz) = c9b1f2670e7bd7aaeda6fa26d0434f4f
RMD160 (cnupm-3.5.tar.gz) = af98de14c7221b61ccee6e24092de4899420c9ef
SHA1 (cnupm-3.5.tar.gz) = 8245c5ce39862751df3dc6728a73d6ade19dd7ed

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-include_cnupm_h,v 1.1.1.1 2004/05/13 06:52:36 grange Exp $
--- include/cnupm.h.orig 2004-04-22 10:40:20.000000000 +0700
+++ include/cnupm.h 2004-04-26 20:31:39.000000000 +0700
@@ -34,7 +34,9 @@
#define CNUPM_VERSION_MAJOR 3
#define CNUPM_VERSION_MINOR 5
+#ifndef CNUPM_USER
#define CNUPM_USER "cnupm"
+#endif
#define CNUPM_PIDFILE "cnupm-%s.pid"
#define CNUPM_DUMPFILE "cnupm-%s.dump"

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-libcnupm_cnupm_restrict_c,v 1.1.1.1 2004/05/13 06:52:36 grange Exp $
--- libcnupm/cnupm_restrict.c.orig 2004-04-22 10:17:58.000000000 +0700
+++ libcnupm/cnupm_restrict.c 2004-04-26 20:28:27.000000000 +0700
@@ -55,7 +55,7 @@ cnupm_restrict(struct passwd *pw)
#endif /* HAVE_INITGROUPS */
#endif /* HAVE_LOGIN_CAP */
return (-1);
- if (chroot(pw->pw_dir) < 0 || chdir("/") < 0 || setuid(pw->pw_uid) < 0)
+ if (chroot(pw->pw_dir) < 0 || setuid(pw->pw_uid) < 0 || chdir("/") < 0)
return (-1);
return (0);
}

29
net/cnupm/pkg/DEINSTALL Normal file
View File

@ -0,0 +1,29 @@
#!/bin/sh
# $OpenBSD: DEINSTALL,v 1.1.1.1 2004/05/13 06:52:36 grange Exp $
#
# cnupm de-installation
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
CNUPM_USER=_cnupm
CNUPM_GROUP=_cnupm
CNUPM_DIR=/var/cnupm
if [ "$PKG_DELETE_EXTRA" != Yes ]; then
echo
echo "+---------------"
echo "| To completely deinstall the $1 package you need to perform"
echo "| this step as root:"
echo "|"
echo "| userdel ${CNUPM_USER}"
echo "| groupdel ${CNUPM_GROUP}"
echo "| rm -rf ${CNUPM_DIR}"
echo "|"
echo "| Do not do this if you plan on re-installing $1"
echo "| at some future time."
echo "+---------------"
echo
fi
exit 0

11
net/cnupm/pkg/DESCR Normal file
View File

@ -0,0 +1,11 @@
cnupm is an IPv4/IPv6 traffic collector daemon; it listens on a network
interface for IPv4/IPv6 packets that match the boolean expression (see
tcpdump(8) for more information) and collects the following statistics:
o address family (INET/INET6)
o IPv4/IPv6 protocol number
o source IPv4/IPv6 address
o source TCP/UDP port
o destination IPv4/IPv6 address
o destination TCP/UDP port
o total number of bytes transferred

58
net/cnupm/pkg/INSTALL Normal file
View File

@ -0,0 +1,58 @@
#!/bin/sh
# $OpenBSD: INSTALL,v 1.1.1.1 2004/05/13 06:52:36 grange Exp $
#
# Pre/post-installation setup of cnupm
# exit on errors, use a sane path and install prefix
#
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
CNUPM_USER=_cnupm
CNUPM_GROUP=_cnupm
CNUPM_ID=531
CNUPM_DIR=/var/cnupm
do_usergroup_install()
{
# Create cnupm user and group
if groupinfo -e ${CNUPM_GROUP}; then
echo "===> Using '${CNUPM_GROUP}' group for $1"
else
echo "===> Creating ${CNUPM_GROUP} group for $1"
groupadd -g ${CNUPM_ID} ${CNUPM_GROUP}
fi
if userinfo -e ${CNUPM_USER}; then
echo "===> Using '${CNUPM_USER}' user for $1"
else
echo "===> Creating '${CNUPM_USER}' user for $1"
useradd -u ${CNUPM_ID} -g ${CNUPM_GROUP} -d ${CNUPM_DIR} -m \
-c "cnupm traffic collector" \
-s /sbin/nologin ${CNUPM_USER}
fi
}
# verify proper execution
#
if [ $# -ne 2 ]; then
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
fi
# Verify/process the command
#
case $2 in
PRE-INSTALL)
do_usergroup_install $1
;;
POST-INSTALL)
install -o ${CNUPM_USER} -g ${CNUPM_GROUP} -m 750 -d \
${CNUPM_DIR}
;;
*)
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
;;
esac
exit 0

8
net/cnupm/pkg/PLIST Normal file
View File

@ -0,0 +1,8 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2004/05/13 06:52:36 grange Exp $
man/cat8/cnupm.0
man/cat8/cnupmstat.0
sbin/cnupm
sbin/cnupmstat
@extraunexec userdel _cnupm
@extraunexec groupdel _cnupm
@extraunexec rm -rf /var/cnupm