# HG changeset patch # User Michael Schloh von Bennewitz # Date 1231524165 -3600 # Node ID 6aeed4ef015a13e3bbf1663e961f4b734c4df902 # Parent a62e2cc5c7be1eed10d53c97afe65f39b283519f Import new package spec for introduction into repository. diff -r a62e2cc5c7be -r 6aeed4ef015a arpwatch/arpwatch.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/arpwatch/arpwatch.patch Fri Jan 09 19:02:45 2009 +0100 @@ -0,0 +1,212 @@ +Index: configure +--- configure.orig 2006-06-21 22:32:38.000000000 +0200 ++++ configure 2006-10-20 15:30:45.862899000 +0200 +@@ -5259,11 +5259,7 @@ + echo "$as_me:$LINENO: result: $ac_cv_lbl_have_" >&5 + echo "${ECHO_T}$ac_cv_lbl_have_" >&6 + if test $ac_cv_lbl_have_ = no ; then +- +-cat >>confdefs.h <<\_ACEOF +-#define +-_ACEOF +- ++ : + fi + + rm -f os-proto.h +Index: Makefile.in +--- Makefile.in.orig 2000-06-15 02:39:55.000000000 +0200 ++++ Makefile.in 2006-10-20 17:41:03.246914000 +0200 +@@ -31,7 +31,7 @@ + # Pathname of directory to install the man page + MANDEST = @mandir@ + # Pathname of directory to install database file +-ARPDIR = $(prefix)/arpwatch ++ARPDIR = @localstatedir@ + + # VPATH + srcdir = @srcdir@ +@@ -42,16 +42,17 @@ + # + + CC = @CC@ ++CFLAGS = @CFLAGS@ ++CPPFLAGS = @CPPFLAGS@ ++ + PROG = arpwatch + CCOPT = @V_CCOPT@ + INCLS = -I. @V_INCLS@ + DEFS = -DDEBUG @DEFS@ -DARPDIR=\"$(ARPDIR)\" -DPATH_SENDMAIL=\"$(SENDMAIL)\" + +-# Standard CFLAGS +-CFLAGS = $(CCOPT) $(DEFS) $(INCLS) +- + # Standard LIBS + LIBS = @LIBS@ ++LDFLAGS = @LDFLAGS@ + # Standard LIBS without libpcap.a + SLIBS = @LBL_LIBS@ + +@@ -63,7 +64,7 @@ + # problem if you don't own the file but can write to the directory. + .c.o: + @rm -f $@ +- $(CC) $(CFLAGS) -c $(srcdir)/$*.c ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/$*.c + + CSRC = db.c dns.c ec.c file.c intoa.c machdep.c util.c report.c setsignal.c + WSRC = arpwatch.c +@@ -95,11 +96,11 @@ + + arpwatch: $(WOBJ) @V_PCAPDEP@ + @rm -f $@ +- $(CC) $(CFLAGS) -o $@ $(WOBJ) $(LIBS) ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -o $@ $(WOBJ) $(LDFLAGS) $(LIBS) + + arpsnmp: $(SOBJ) + @rm -f $@ +- $(CC) $(CFLAGS) -o $@ $(SOBJ) $(SLIBS) ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -o $@ $(SOBJ) $(LDFLAGS) $(SLIBS) + + version.o: version.c + version.c: $(srcdir)/VERSION +@@ -107,18 +108,22 @@ + sed -e 's/.*/char version[] = "&";/' $(srcdir)/VERSION > $@ + + zap: zap.o intoa.o +- $(CC) $(CFLAGS) -o $@ zap.o intoa.o -lutil ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -o $@ zap.o intoa.o $(LDFLAGS) -lutil + + install: force +- $(INSTALL) -m 555 -o bin -g bin arpwatch $(DESTDIR)$(BINDEST) +- $(INSTALL) -m 555 -o bin -g bin arpsnmp $(DESTDIR)$(BINDEST) ++ $(INSTALL) -s -m 555 arpwatch $(DESTDIR)$(BINDEST) ++ $(INSTALL) -s -m 555 arpsnmp $(DESTDIR)$(BINDEST) + + install-man: force +- $(INSTALL) -m 444 -o bin -g bin $(srcdir)/arpwatch.8 \ ++ $(INSTALL) -m 644 $(srcdir)/arpwatch.8 \ + $(DESTDIR)$(MANDEST)/man8 +- $(INSTALL) -m 444 -o bin -g bin $(srcdir)/arpsnmp.8 \ ++ $(INSTALL) -m 644 $(srcdir)/arpsnmp.8 \ + $(DESTDIR)$(MANDEST)/man8 + ++install-data: force ++ $(INSTALL) -m 444 $(srcdir)/ethercodes.dat \ ++ $(DESTDIR)$(ARPDIR) ++ + lint: $(GENSRC) force + lint -hbxn $(SRC) | \ + grep -v 'struct/union .* never defined' | \ +Index: arpwatch.8 +--- arpwatch.8.orig 2006-10-20 16:13:53.268590000 +0200 ++++ arpwatch.8 2006-10-20 16:15:01.537612000 +0200 +@@ -152,9 +152,8 @@ + .na + .nh + .nf +-/usr/operator/arpwatch - default directory +-arp.dat - ethernet/ip address database +-ethercodes.dat - vendor ethernet block list ++@l_prefix@/var/arpwatch/arp.dat - ethernet/ip address database ++@l_prefix@/var/arpwatch/ethercodes.dat - vendor ethernet block list + .ad + .hy + .fi +Index: arpsnmp.8 +--- arpsnmp.8.orig 2006-10-20 16:14:50.412624000 +0200 ++++ arpsnmp.8 2006-10-20 16:14:59.301665000 +0200 +@@ -69,9 +69,8 @@ + .na + .nh + .nf +-/usr/operator/arpwatch - default directory +-arp.dat - ethernet/ip address database +-ethercodes.dat - vendor ethernet block list ++@l_prefix@/var/arpwatch/arp.dat - ethernet/ip address database ++@l_prefix@/var/arpwatch/ethercodes.dat - vendor ethernet block list + .ad + .hy + .fi +Index: arpwatch.h +--- arpwatch.h.orig 2000-10-01 01:40:55.000000000 +0200 ++++ arpwatch.h 2006-10-21 07:41:55.629111000 +0200 +@@ -8,6 +8,20 @@ + #define BCOPY(a, b, n) memmove((char *)b, (char *)a, n) + #define MEMSET(s, c, n) memset((char *)s, c, n) + ++/* Repair unportable usage of u_int*_t declarations */ ++#ifndef u_int64_t ++#define u_int64_t unsigned long long ++#endif ++#ifndef u_int32_t ++#define u_int32_t unsigned int ++#endif ++#ifndef u_int16_t ++#define u_int16_t unsigned short ++#endif ++#ifndef u_int6_t ++#define u_int8_t unsigned char ++#endif ++ + char *intoa(u_int32_t); + + #ifndef HAVE_BCOPY +Index: arpwatch.c +--- arpwatch.c.orig 2004-01-22 23:18:20.000000000 +0100 ++++ arpwatch.c 2006-10-20 19:28:25.417689000 +0200 +@@ -234,8 +234,11 @@ + if (pid < 0) { + syslog(LOG_ERR, "main fork(): %m"); + exit(1); +- } else if (pid != 0) ++ } else if (pid != 0) { ++ printf("%d\n", pid); ++ fflush(stdout); + exit(0); ++ } + (void)close(fileno(stdin)); + (void)close(fileno(stdout)); + (void)close(fileno(stderr)); +@@ -321,7 +324,6 @@ + + (void)setsignal(SIGINT, die); + (void)setsignal(SIGTERM, die); +- (void)setsignal(SIGHUP, die); + if (rfilename == NULL) { + (void)setsignal(SIGQUIT, checkpoint); + (void)setsignal(SIGALRM, checkpoint); +Index: dns.c +--- dns.c.orig 2006-10-20 19:06:40.704886000 +0200 ++++ dns.c 2006-10-20 19:20:09.611322000 +0200 +@@ -137,7 +137,7 @@ + return (0); + } + +-/* Return the cannonical name of the host */ ++/* Return the canonical name of the host (NULL if not found) */ + char * + gethname(u_int32_t a) + { +@@ -150,18 +150,18 @@ + hp = gethostbyaddr((char *)&a, sizeof(a), AF_INET); + _res.options = options; + if (hp == NULL) +- return (intoa(a)); ++ return NULL; + return (hp->h_name); + } + +-/* Return the simple name of the host */ ++/* Return the simple name of the host (NULL if not found) */ + char * + getsname(register u_int32_t a) + { + register char *s, *cp; + + s = gethname(a); +- if (!isdigit((int)*s)) { ++ if (s != NULL) { + cp = strchr(s, '.'); + if (cp != NULL) + *cp = '\0'; diff -r a62e2cc5c7be -r 6aeed4ef015a arpwatch/arpwatch.spec --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/arpwatch/arpwatch.spec Fri Jan 09 19:02:45 2009 +0100 @@ -0,0 +1,176 @@ +## +## arpwatch.spec -- OpenPKG RPM Specification +## Copyright (c) 2009 Michael Schloh von Bennewitz +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## + + +# package information +Name: arpwatch +Summary: Ethernet Address Monitor Program +URL: http://ee.lbl.gov/ +Vendor: Craig Leres +Packager: Michael Schloh von Bennewitz +Distribution: MSvB Recherche Production +Class: EVAL +Group: Network +License: GPL +Version: 2.1a15 +Release: 20090106 + +# package options +%option with_fsl yes + +# list of sources +Source0: ftp://ftp.ee.lbl.gov/arpwatch.tar.gz +Source1: rc.arpwatch +Source2: fsl.arpwatch +Patch0: arpwatch.patch + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20040130, libpcap +PreReq: OpenPKG, openpkg >= 20040130, libpcap +%if "%{with_fsl}" == "yes" +BuildPreReq: fsl >= 1.2.0 +PreReq: fsl >= 1.2.0 +%endif +AutoReq: no +AutoReqProv: no + +%description + The arpwatch daemon monitors ethernet or fddi activity + and maintains a database of ethernet/ip address pairings. + It reports certain changes via email as well. + +%track + prog arpwatch = { + disabled + comment = "msvb: tracking is disabled as sources are unversioned" + version = %{version} + url = ftp://ftp.ee.lbl.gov/ + regex = arpwatch-\.tar\.gz + } + +%prep + %setup -q + + # before patching, correct unconsistent file modes + chmod u+w * + + %patch -p0 + + # supply more detailed file path information + %{l_shtool} subst %{l_value -s l_prefix} \ + arpwatch.8 \ + arpsnmp.8 + +%build + # query for platform specific libraries + loclibs="" + case "%{l_platform -t}" in + *-sunos* ) loclibs="-lsocket -lnsl" ;; + esac + + # run the autoconf(1) generated configuration logic + CC="%{l_cc}" \ + CFLAGS="%{l_cflags -O}" \ + CPPFLAGS="%{l_cppflags}" \ + LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ + LIBS="%{l_fsl_libs} $loclibs" \ + ./configure \ + --prefix=%{l_prefix} \ + --localstatedir=%{l_prefix}/var/arpwatch/run + + # run the native build logic using parallel make + %{l_make} %{l_mflags -O} + +%install + # remove previously existing installations + rm -rf $RPM_BUILD_ROOT + + # create installation hierarchy + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/sbin \ + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ + $RPM_BUILD_ROOT%{l_prefix}/man/man8 \ + $RPM_BUILD_ROOT%{l_prefix}/var/arpwatch/log \ + $RPM_BUILD_ROOT%{l_prefix}/var/arpwatch/run + + # run the native installation logic + %{l_make} %{l_mflags} install install-man install-data DESTDIR=$RPM_BUILD_ROOT + + # install runcommand script + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE rc.arpwatch} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + + # install OSSP fsl configuration + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + %{SOURCE fsl.arpwatch} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ + + # determine installation files + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ + %{l_files_std} \ + '%not %dir %{l_prefix}/etc/fsl' \ + '%config %{l_prefix}/etc/fsl/fsl.arpwatch' + +%files -f files + +%clean + rm -rf $RPM_BUILD_ROOT + +%pre + # before upgrading package, record runtime status and stop service + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} arpwatch status 2>/dev/null | tee %{l_tmpfile}` + %{l_rc} arpwatch stop 2>/dev/null + exit 0 + +%post + if [ $1 -eq 1 ]; then + # after installing package, generate initial arp database + %{l_shtool} install -c -o %{l_musr} -g %{l_mgrp} -m 644 \ + %{_builddir}/arpwatch-%{version}/arp.dat \ + $RPM_INSTALL_PREFIX/var/arpwatch/run/ + + # after installing package, announce security provision lo0 + ( echo "Before starting the arpwatch daemon, set the config variables" + echo "\"arpwatch_iface\" and \"arpwatch_ipnet\" in $RPM_INSTALL_PREFIX/etc/rc.conf to" + echo "describe the network interface and block(s) to be monitored." + ) | %{l_rpmtool} msg -b -t notice + fi + if [ $1 -eq 2 ]; then + # after upgrading package, restore runtime status + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} >/dev/null 2>&1 || true + [ ".$arpwatch_active" = .yes ] && %{l_rc} arpwatch start + fi + exit 0 + +%preun + # before removing package, stop service and remove log files + [ $1 -eq 0 ] || exit 0 + %{l_rc} arpwatch stop 2>/dev/null + rm -f $RPM_INSTALL_PREFIX/var/arpwatch/log/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/arpwatch/run/* >/dev/null 2>&1 || true + exit 0 + diff -r a62e2cc5c7be -r 6aeed4ef015a arpwatch/fsl.arpwatch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/arpwatch/fsl.arpwatch Fri Jan 09 19:02:45 2009 +0100 @@ -0,0 +1,28 @@ +## +## fsl.arpwatch -- OSSP fsl configuration +## + +ident (arpwatch)/.+ q{ + prefix( + prefix="%b %d %H:%M:%S %N <%L> $1[%P]: " + ) + -> { + debug: file( + path="@l_prefix@/var/arpwatch/log/arpwatch.log", + perm=0644 + ) + } +}; + +ident (arpsnmp)/.+ q{ + prefix( + prefix="%b %d %H:%M:%S %N <%L> $1[%P]: " + ) + -> { + debug: file( + path="@l_prefix@/var/arpwatch/log/arpsnmp.log", + perm=0644 + ) + } +}; + diff -r a62e2cc5c7be -r 6aeed4ef015a arpwatch/rc.arpwatch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/arpwatch/rc.arpwatch Fri Jan 09 19:02:45 2009 +0100 @@ -0,0 +1,66 @@ +#!@l_prefix@/bin/openpkg rc +## +## rc.arpwatch -- runcommands +## + +%config + arpwatch_enable="$openpkg_rc_def" + arpwatch_log_prolog="true" + arpwatch_log_epilog="true" + arpwatch_log_numfiles="10" + arpwatch_log_minsize="1M" + arpwatch_log_complevel="9" + arpwatch_iface="-i lo0" + arpwatch_ipnet="-n 127.0.0.0/8" + +%common + arpwatch_pidfile="@l_prefix@/var/arpwatch/run/arpwatch.pid" + arpwatch_signal () { + [ -f $arpwatch_pidfile ] && kill -$1 `cat $arpwatch_pidfile` + } + +%status -u @l_susr@ -o + arpwatch_usable="no" + arpwatch_active="no" + rcService arpwatch enable yes && \ + arpwatch_usable="yes" + rcService arpwatch enable yes && \ + arpwatch_signal 0 && arpwatch_active="yes" + echo "arpwatch_enable=\"$arpwatch_enable\"" + echo "arpwatch_usable=\"$arpwatch_usable\"" + echo "arpwatch_active=\"$arpwatch_active\"" + +%start -u @l_susr@ + rcService arpwatch enable yes || exit 0 + rcService arpwatch active yes && exit 0 + @l_prefix@/sbin/arpwatch \ + $arpwatch_iface \ + $arpwatch_ipnet \ + >$arpwatch_pidfile 2>&1 + +%stop -u @l_susr@ + rcService arpwatch enable yes || exit 0 + rcService arpwatch active no && exit 0 + arpwatch_signal TERM + +%restart -u @l_susr@ + rcService arpwatch enable yes || exit 0 + rcService arpwatch active no && exit 0 + rc arpwatch stop + sleep 2 + rc arpwatch start + +%reload -u @l_susr@ + rcService arpwatch enable yes || exit 0 + rcService arpwatch active no && exit 0 + arpwatch_signal HUP + +%daily -u @l_susr@ + rcService arpwatch enable yes || exit 0 + shtool rotate -f \ + -n ${arpwatch_log_numfiles} -s ${arpwatch_log_minsize} -d \ + -z ${arpwatch_log_complevel} -o @l_susr@ -g @l_mgrp@ -m 644 \ + -P "${arpwatch_log_prolog}" \ + -E "${arpwatch_log_epilog}; rc arpwatch restart" \ + @l_prefix@/var/arpwatch/log/arpwatch.log \ + @l_prefix@/var/arpwatch/log/arpsnmp.log