6ced790
%define _vararpwatch %{_localstatedir}/lib/arpwatch
6ced790
6ced790
Name: arpwatch
6ced790
Epoch: 14
6ced790
Version: 2.1a15
62554f7
Release: 7%{?dist}
6ced790
Summary: Network monitoring tools for tracking IP addresses on a network
6ced790
Group: Applications/System
d9debb6
License: BSD with advertising
6ced790
URL: http://ee.lbl.gov/
6ced790
Requires(pre): shadow-utils 
6ced790
Requires(post): /sbin/chkconfig
6ced790
Requires(preun): /sbin/chkconfig /sbin/service
6ced790
Requires(postun): /sbin/service
6ced790
Requires: /usr/sbin/sendmail
6ced790
BuildRequires: /usr/sbin/sendmail libpcap-devel
6ced790
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
6ced790
6ced790
Source0: ftp://ftp.ee.lbl.gov/arpwatch-%{version}.tar.gz
6ced790
Source1: arpwatch.init
6ced790
Source2: arpwatch.sysconfig
d9debb6
Source3: ethercodes-20070809.dat
6ced790
Patch1: arpwatch-2.1a4-fhs.patch
6ced790
Patch2: arpwatch-2.1a10-man.patch
6ced790
Patch3: arpwatch-drop.patch
6ced790
Patch4: arpwatch-drop-man.patch
6ced790
Patch5: arpwatch-addr.patch
6ced790
Patch6: arpwatch-dir-man.patch
6ced790
Patch7: arpwatch-scripts.patch
6ced790
Patch8: arpwatch-2.1a15-nolocalpcap.patch
d9debb6
Patch9: arpwatch-2.1a15-bogon.patch
6ced790
6ced790
%description
6ced790
The arpwatch package contains arpwatch and arpsnmp.  Arpwatch and
6ced790
arpsnmp are both network monitoring tools.  Both utilities monitor
6ced790
Ethernet or FDDI network traffic and build databases of Ethernet/IP
6ced790
address pairs, and can report certain changes via email.
6ced790
6ced790
Install the arpwatch package if you need networking monitoring devices
6ced790
which will automatically keep track of the IP addresses on your
6ced790
network.
6ced790
6ced790
%prep
6ced790
%setup -q
6ced790
6ced790
%patch1 -p1 -b .fhs
6ced790
%patch2 -p1 -b .arpsnmpman
6ced790
%patch3 -p1 -b .droproot
6ced790
%patch4 -p0 -b .droprootman
6ced790
%patch5 -p1 -b .mailuser
6ced790
%patch6 -p1 -b .dirman
6ced790
%patch7 -p1 -b .scripts
6ced790
%patch8 -p1 -b .nolocalpcap
d9debb6
%patch9 -p1 -b .bogon
6ced790
6ced790
%build
6ced790
%configure
6ced790
make ARPDIR=%{_vararpwatch}
6ced790
6ced790
%install
6ced790
rm -rf $RPM_BUILD_ROOT
6ced790
6ced790
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8
6ced790
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
6ced790
mkdir -p $RPM_BUILD_ROOT%{_vararpwatch}
6ced790
mkdir -p $RPM_BUILD_ROOT%{_initrddir}
6ced790
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
6ced790
6ced790
make DESTDIR=$RPM_BUILD_ROOT install install-man
6ced790
6ced790
# prepare awk scripts
6ced790
perl -pi -e "s/\'/\'\\\'\'/g" *.awk
6ced790
6ced790
# and embed them
6ced790
for i in arp2ethers massagevendor massagevendor-old; do
6ced790
	cp -f $i $RPM_BUILD_ROOT%{_sbindir}
6ced790
	for j in *.awk; do
6ced790
		sed "s/-f\ *\(\<$j\>\)/\'\1\n\' /g" \
6ced790
			< $RPM_BUILD_ROOT%{_sbindir}/$i \
6ced790
			| sed "s/$j\$//;tx;b;:x;r$j" \
6ced790
			> $RPM_BUILD_ROOT%{_sbindir}/$i.x
6ced790
		mv -f $RPM_BUILD_ROOT%{_sbindir}/$i{.x,}
6ced790
	done
6ced790
	chmod 755 $RPM_BUILD_ROOT%{_sbindir}/$i
6ced790
done
6ced790
a80d80c
install -p -m644 *.dat $RPM_BUILD_ROOT%{_vararpwatch}
a80d80c
install -p -m755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/arpwatch
a80d80c
install -p -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/arpwatch
a80d80c
install -p -m644 %{SOURCE3} $RPM_BUILD_ROOT%{_vararpwatch}/ethercodes.dat
6ced790
6ced790
%clean
6ced790
rm -rf $RPM_BUILD_ROOT
6ced790
6ced790
%post
6ced790
/sbin/chkconfig --add arpwatch
6ced790
6ced790
%pre
f1b7b51
if ! getent group arpwatch &> /dev/null; then
f1b7b51
	getent group pcap 2> /dev/null | grep -q 77 &&
f1b7b51
		/usr/sbin/groupmod -n arpwatch pcap 2> /dev/null ||
f1b7b51
		/usr/sbin/groupadd -g 77 arpwatch 2> /dev/null
f1b7b51
fi
f1b7b51
if ! getent passwd arpwatch &> /dev/null; then
f1b7b51
	getent passwd pcap 2> /dev/null | grep -q 77 &&
f1b7b51
		/usr/sbin/usermod -l arpwatch -g 77 \
f1b7b51
			-d %{_vararpwatch} pcap 2> /dev/null ||
f1b7b51
		/usr/sbin/useradd -u 77 -g 77 -s /sbin/nologin \
f1b7b51
			-M -r -d %{_vararpwatch} arpwatch 2> /dev/null
f1b7b51
fi
6ced790
:
6ced790
6ced790
%postun
6ced790
if [ "$1" -ge 1 ]; then
6ced790
	/sbin/service arpwatch condrestart &> /dev/null
6ced790
fi
6ced790
:
6ced790
6ced790
%preun
6ced790
if [ "$1" -eq 0 ]; then
6ced790
	/sbin/service arpwatch stop &> /dev/null
6ced790
	/sbin/chkconfig --del arpwatch
6ced790
fi
6ced790
:
6ced790
6ced790
%files
6ced790
%defattr(-,root,root)
6ced790
%doc README CHANGES arpfetch
6ced790
%{_sbindir}/arpwatch
6ced790
%{_sbindir}/arpsnmp
6ced790
%{_sbindir}/arp2ethers
6ced790
%{_sbindir}/massagevendor
6ced790
%{_sbindir}/massagevendor-old
6ced790
%{_mandir}/man8/arpwatch.8*
6ced790
%{_mandir}/man8/arpsnmp.8*
6ced790
%{_initrddir}/arpwatch
6ced790
%config(noreplace) %{_sysconfdir}/sysconfig/arpwatch
f1b7b51
%defattr(-,arpwatch,arpwatch)
6ced790
%dir %{_vararpwatch}
6ced790
%verify(not md5 size mtime) %config(noreplace) %{_vararpwatch}/arp.dat
6ced790
%verify(not md5 size mtime) %config %{_vararpwatch}/ethercodes.dat
6ced790
6ced790
%changelog
62554f7
* Wed Aug 22 2007 Miroslav Lichvar <mlichvar@redhat.com> 14:2.1a15-7
62554f7
- rebuild
62554f7
d9debb6
* Thu Aug 09 2007 Miroslav Lichvar <mlichvar@redhat.com> 14:2.1a15-6
d9debb6
- improve init script (#246869)
d9debb6
- allow -n 0/32 to disable reporting bogons from 0.0.0.0 (#244606)
d9debb6
- update license tag
d9debb6
- update ethercodes.dat
d9debb6
a80d80c
* Wed Jun 13 2007 Miroslav Lichvar <mlichvar@redhat.com> 14:2.1a15-5
a80d80c
- update ethercodes.dat
a80d80c
b1329e8
* Thu May 24 2007 Miroslav Lichvar <mlichvar@redhat.com> 14:2.1a15-4
b1329e8
- fix return codes in init script (#237781)
b1329e8
f1b7b51
* Mon Jan 15 2007 Miroslav Lichvar <mlichvar@redhat.com> 14:2.1a15-3
f1b7b51
- rename pcap user to arpwatch
f1b7b51
6ced790
* Tue Nov 28 2006 Miroslav Lichvar <mlichvar@redhat.com> 14:2.1a15-2
6ced790
- split from tcpdump package (#193657)
6ced790
- update to 2.1a15
6ced790
- clean up files in /var
6ced790
- force linking with system libpcap