Thu, 04 Oct 2012 20:30:05 +0200
Correct out of date build configuration, porting to Solaris 11 network
link infrastructure and new libpcap logic. This additionally allows for
device drivers in subdirectories of /dev. Correct packaged nmap
personalities and signatures to work out of the box. Finally, hack
arpd logic to properly close sockets and quit on TERM by repeating
signaling in the run command script. Sadly, all this fails to correct
the run time behaviour of honeyd which fails to bind to the IP layer.
michael@64 | 1 | ## |
michael@64 | 2 | ## arpwatch.spec -- OpenPKG RPM Specification |
michael@571 | 3 | ## Copyright (c) 2012 Michael Schloh von Bennewitz <michael@schloh.com> |
michael@64 | 4 | ## |
michael@64 | 5 | ## Permission to use, copy, modify, and distribute this software for |
michael@64 | 6 | ## any purpose with or without fee is hereby granted, provided that |
michael@64 | 7 | ## the above copyright notice and this permission notice appear in all |
michael@64 | 8 | ## copies. |
michael@64 | 9 | ## |
michael@64 | 10 | ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@64 | 11 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@64 | 12 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@64 | 13 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@64 | 14 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@64 | 15 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@64 | 16 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@64 | 17 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@64 | 18 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@64 | 19 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@64 | 20 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@64 | 21 | ## SUCH DAMAGE. |
michael@64 | 22 | ## |
michael@64 | 23 | |
michael@64 | 24 | # package information |
michael@64 | 25 | Name: arpwatch |
michael@64 | 26 | Summary: Ethernet Address Monitor Program |
michael@64 | 27 | URL: http://ee.lbl.gov/ |
michael@64 | 28 | Vendor: Craig Leres |
michael@64 | 29 | Packager: Michael Schloh von Bennewitz |
michael@387 | 30 | Distribution: Europalab Networks Production |
michael@64 | 31 | Class: EVAL |
michael@64 | 32 | Group: Network |
michael@64 | 33 | License: GPL |
michael@64 | 34 | Version: 2.1a15 |
michael@571 | 35 | Release: 20120800 |
michael@64 | 36 | |
michael@64 | 37 | # package options |
michael@64 | 38 | %option with_fsl yes |
michael@64 | 39 | |
michael@64 | 40 | # list of sources |
michael@571 | 41 | Source0: ftp://ftp.ee.lbl.gov/arpwatch-%{version}.tar.gz |
michael@64 | 42 | Source1: rc.arpwatch |
michael@64 | 43 | Source2: fsl.arpwatch |
michael@64 | 44 | Patch0: arpwatch.patch |
michael@64 | 45 | |
michael@64 | 46 | # build information |
michael@571 | 47 | BuildPreReq: OpenPKG, openpkg >= 20100101, libpcap, make |
michael@571 | 48 | PreReq: OpenPKG, openpkg >= 20100101, libpcap |
michael@571 | 49 | PreReq: MTA |
michael@64 | 50 | %if "%{with_fsl}" == "yes" |
michael@64 | 51 | BuildPreReq: fsl >= 1.2.0 |
michael@64 | 52 | PreReq: fsl >= 1.2.0 |
michael@64 | 53 | %endif |
michael@64 | 54 | |
michael@64 | 55 | %description |
michael@64 | 56 | The arpwatch daemon monitors ethernet or fddi activity |
michael@64 | 57 | and maintains a database of ethernet/ip address pairings. |
michael@64 | 58 | It reports certain changes via email as well. |
michael@64 | 59 | |
michael@64 | 60 | %track |
michael@64 | 61 | prog arpwatch = { |
michael@64 | 62 | version = %{version} |
michael@64 | 63 | url = ftp://ftp.ee.lbl.gov/ |
michael@571 | 64 | regex = arpwatch-(__VER__)\.tar\.gz |
michael@64 | 65 | } |
michael@64 | 66 | |
michael@64 | 67 | %prep |
michael@64 | 68 | %setup -q |
michael@64 | 69 | %patch -p0 |
michael@64 | 70 | |
michael@64 | 71 | # supply more detailed file path information |
michael@64 | 72 | %{l_shtool} subst %{l_value -s l_prefix} \ |
michael@64 | 73 | arpwatch.8 \ |
michael@64 | 74 | arpsnmp.8 |
michael@64 | 75 | |
michael@64 | 76 | %build |
michael@64 | 77 | # query for platform specific libraries |
michael@64 | 78 | loclibs="" |
michael@64 | 79 | case "%{l_platform -t}" in |
michael@64 | 80 | *-sunos* ) loclibs="-lsocket -lnsl" ;; |
michael@64 | 81 | esac |
michael@64 | 82 | |
michael@64 | 83 | # run the autoconf(1) generated configuration logic |
michael@64 | 84 | CC="%{l_cc}" \ |
michael@64 | 85 | CFLAGS="%{l_cflags -O}" \ |
michael@64 | 86 | CPPFLAGS="%{l_cppflags}" \ |
michael@64 | 87 | LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ |
michael@64 | 88 | LIBS="%{l_fsl_libs} $loclibs" \ |
michael@571 | 89 | V_SENDMAIL=%{l_prefix}/sbin/sendmail \ |
michael@64 | 90 | ./configure \ |
michael@64 | 91 | --prefix=%{l_prefix} \ |
michael@64 | 92 | --localstatedir=%{l_prefix}/var/arpwatch/run |
michael@64 | 93 | |
michael@64 | 94 | # run the native build logic using parallel make |
michael@64 | 95 | %{l_make} %{l_mflags -O} |
michael@64 | 96 | |
michael@64 | 97 | %install |
michael@64 | 98 | # create installation hierarchy |
michael@64 | 99 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@64 | 100 | $RPM_BUILD_ROOT%{l_prefix}/sbin \ |
michael@64 | 101 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ |
michael@64 | 102 | $RPM_BUILD_ROOT%{l_prefix}/man/man8 \ |
michael@64 | 103 | $RPM_BUILD_ROOT%{l_prefix}/var/arpwatch/log \ |
michael@64 | 104 | $RPM_BUILD_ROOT%{l_prefix}/var/arpwatch/run |
michael@64 | 105 | |
michael@64 | 106 | # run the native installation logic |
michael@64 | 107 | %{l_make} %{l_mflags} install install-man install-data DESTDIR=$RPM_BUILD_ROOT |
michael@64 | 108 | |
michael@64 | 109 | # install runcommand script |
michael@64 | 110 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@64 | 111 | %{SOURCE rc.arpwatch} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
michael@64 | 112 | |
michael@64 | 113 | # install OSSP fsl configuration |
michael@64 | 114 | %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl |
michael@64 | 115 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@64 | 116 | %{SOURCE fsl.arpwatch} \ |
michael@64 | 117 | $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ |
michael@64 | 118 | |
michael@64 | 119 | # determine installation files |
michael@64 | 120 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
michael@64 | 121 | %{l_files_std} \ |
michael@64 | 122 | '%not %dir %{l_prefix}/etc/fsl' \ |
michael@64 | 123 | '%config %{l_prefix}/etc/fsl/fsl.arpwatch' |
michael@64 | 124 | |
michael@64 | 125 | %files -f files |
michael@64 | 126 | |
michael@64 | 127 | %clean |
michael@64 | 128 | |
michael@64 | 129 | %pre |
michael@64 | 130 | # before upgrading package, record runtime status and stop service |
michael@64 | 131 | [ $1 -eq 2 ] || exit 0 |
michael@64 | 132 | eval `%{l_rc} arpwatch status 2>/dev/null | tee %{l_tmpfile}` |
michael@64 | 133 | %{l_rc} arpwatch stop 2>/dev/null |
michael@64 | 134 | exit 0 |
michael@64 | 135 | |
michael@64 | 136 | %post |
michael@64 | 137 | if [ $1 -eq 1 ]; then |
michael@690 | 138 | # after installing package, install codes and initial arp database |
michael@64 | 139 | %{l_shtool} install -c -o %{l_musr} -g %{l_mgrp} -m 644 \ |
michael@571 | 140 | %{_builddir}/arpwatch-%{version}/ethercodes.dat \ |
michael@64 | 141 | $RPM_INSTALL_PREFIX/var/arpwatch/run/ |
michael@690 | 142 | %{l_shtool} install -c -o %{l_musr} -g %{l_mgrp} -m 644 \ |
michael@690 | 143 | /dev/null $RPM_INSTALL_PREFIX/var/arpwatch/run/arp.dat |
michael@64 | 144 | |
michael@64 | 145 | # after installing package, announce security provision lo0 |
michael@64 | 146 | ( echo "Before starting the arpwatch daemon, set the config variables" |
michael@64 | 147 | echo "\"arpwatch_iface\" and \"arpwatch_ipnet\" in $RPM_INSTALL_PREFIX/etc/rc.conf to" |
michael@64 | 148 | echo "describe the network interface and block(s) to be monitored." |
michael@64 | 149 | ) | %{l_rpmtool} msg -b -t notice |
michael@64 | 150 | fi |
michael@64 | 151 | if [ $1 -eq 2 ]; then |
michael@64 | 152 | # after upgrading package, restore runtime status |
michael@64 | 153 | eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} >/dev/null 2>&1 || true |
michael@64 | 154 | [ ".$arpwatch_active" = .yes ] && %{l_rc} arpwatch start |
michael@64 | 155 | fi |
michael@64 | 156 | exit 0 |
michael@64 | 157 | |
michael@64 | 158 | %preun |
michael@64 | 159 | # before removing package, stop service and remove log files |
michael@64 | 160 | [ $1 -eq 0 ] || exit 0 |
michael@64 | 161 | %{l_rc} arpwatch stop 2>/dev/null |
michael@64 | 162 | rm -f $RPM_INSTALL_PREFIX/var/arpwatch/log/* >/dev/null 2>&1 || true |
michael@64 | 163 | rm -f $RPM_INSTALL_PREFIX/var/arpwatch/run/* >/dev/null 2>&1 || true |
michael@64 | 164 | exit 0 |
michael@64 | 165 |