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