arpwatch/arpwatch.spec

Thu, 04 Oct 2012 20:30:05 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 04 Oct 2012 20:30:05 +0200
changeset 715
c10fb90893b9
parent 571
175768f4868b
permissions
-rw-r--r--

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.

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

mercurial