133 lines
4.3 KiB
RPMSpec
133 lines
4.3 KiB
RPMSpec
%global _vararpwatch %{_localstatedir}/lib/arpwatch
|
|
%global _hardened_build 1
|
|
|
|
Name: arpwatch
|
|
Epoch: 14
|
|
Version: 2.1a15
|
|
Release: 44
|
|
Summary: Network monitoring tools for tracking IP addresses on a network
|
|
License: BSD with advertising
|
|
URL: http://ee.lbl.gov/
|
|
Source0: ftp://ftp.ee.lbl.gov/arpwatch-%{version}.tar.gz
|
|
Source1: arpwatch.service
|
|
Source2: ethercodes-20110707.dat.bz2
|
|
BuildRequires: libpcap-devel perl-interpreter systemd sendmail
|
|
Requires(pre): shadow-utils
|
|
Requires(post): systemd
|
|
Requires(preun): systemd
|
|
Requires(postun): systemd
|
|
Requires: sendmail
|
|
# The following patches come from upstream
|
|
Patch0001: arpwatch-2.1a4-fhs.patch
|
|
Patch0002: arpwatch-2.1a10-man.patch
|
|
Patch0003: arpwatch-drop.patch
|
|
Patch0004: arpwatch-drop-man.patch
|
|
Patch0005: arpwatch-addr.patch
|
|
Patch0006: arpwatch-dir-man.patch
|
|
Patch0007: arpwatch-scripts.patch
|
|
# The following patches come from fedoraproject
|
|
Patch0008: arpwatch-2.1a15-nolocalpcap.patch
|
|
Patch0009: arpwatch-2.1a15-bogon.patch
|
|
Patch0010: arpwatch-2.1a15-extraman.patch
|
|
Patch0011: arpwatch-exitcode.patch
|
|
Patch0012: arpwatch-2.1a15-dropgroup.patch
|
|
Patch0013: arpwatch-2.1a15-devlookup.patch
|
|
Patch0014: arpwatch-2.1a15-lookupiselect.patch
|
|
Patch0015: arpwatch-201301-ethcodes.patch
|
|
Patch0016: arpwatch-pie.patch
|
|
Patch0017: arpwatch-aarch64.patch
|
|
Patch0018: arpwatch-promisc.patch
|
|
|
|
%description
|
|
The arpwatch package contains arpwatch and arpsnmp. Arpwatch and
|
|
arpsnmp are both network monitoring tools that monitor ethernet or
|
|
FDDI network traffic and maintain a database of ethernet/ip address
|
|
pairings.
|
|
|
|
%package help
|
|
Summary: arpwatch help and arpsnmp help
|
|
|
|
%description help
|
|
The arpwatch-help package provides the help manual function separately.
|
|
|
|
%prep
|
|
%autosetup -n %{name}-%{version} -p1
|
|
|
|
%build
|
|
%configure
|
|
%make_build ARPDIR=%{_vararpwatch}
|
|
|
|
%install
|
|
install -d $RPM_BUILD_ROOT%{_mandir}/man8
|
|
install -d $RPM_BUILD_ROOT%{_sbindir}
|
|
install -d $RPM_BUILD_ROOT%{_vararpwatch}
|
|
install -d $RPM_BUILD_ROOT%{_unitdir}
|
|
touch $RPM_BUILD_ROOT%{_vararpwatch}/arp.dat-
|
|
%make_install install-man
|
|
|
|
# prepare awk scripts
|
|
perl -pi -e "s/\'/\'\\\'\'/g" *.awk
|
|
|
|
# and embed them
|
|
for i in arp2ethers massagevendor massagevendor-old; do
|
|
cp -f $i $RPM_BUILD_ROOT%{_sbindir}
|
|
for j in *.awk; do
|
|
sed "s/-f\ *\(\<$j\>\)/\'\1\n\' /g" \
|
|
< $RPM_BUILD_ROOT%{_sbindir}/$i \
|
|
| sed "s/$j\$//;tx;b;:x;r$j" \
|
|
> $RPM_BUILD_ROOT%{_sbindir}/$i.x
|
|
mv -f $RPM_BUILD_ROOT%{_sbindir}/$i{.x,}
|
|
done
|
|
chmod 755 $RPM_BUILD_ROOT%{_sbindir}/$i
|
|
done
|
|
|
|
install -p -m644 *.dat $RPM_BUILD_ROOT%{_vararpwatch}
|
|
install -p -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/arpwatch.service
|
|
install -p -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_vararpwatch}/ethercodes.dat.bz2
|
|
bzip2 -df $RPM_BUILD_ROOT%{_vararpwatch}/ethercodes.dat.bz2
|
|
|
|
%pre
|
|
if ! getent group arpwatch &> /dev/null; then
|
|
getent group pcap 2> /dev/null | grep -q 77 &&
|
|
/usr/sbin/groupmod -n arpwatch pcap 2> /dev/null ||
|
|
/usr/sbin/groupadd -g 77 arpwatch 2> /dev/null
|
|
fi
|
|
if ! getent passwd arpwatch &> /dev/null; then
|
|
getent passwd pcap 2> /dev/null | grep -q 77 &&
|
|
/usr/sbin/usermod -l arpwatch -g 77 \
|
|
-d %{_vararpwatch} pcap 2> /dev/null ||
|
|
/usr/sbin/useradd -u 77 -g 77 -s /sbin/nologin \
|
|
-M -r -d %{_vararpwatch} arpwatch 2> /dev/null
|
|
fi
|
|
:
|
|
|
|
%preun
|
|
%systemd_preun arpwatch.service
|
|
|
|
%post
|
|
%systemd_post arpwatch.service
|
|
|
|
%postun
|
|
%systemd_postun_with_restart arpwatch.service
|
|
|
|
%files
|
|
%exclude %{_sbindir}/massagevendor-old
|
|
%doc README CHANGES arpfetch
|
|
%{_sbindir}/arpwatch
|
|
%{_sbindir}/arpsnmp
|
|
%{_sbindir}/arp2ethers
|
|
%{_sbindir}/massagevendor
|
|
%{_unitdir}/arpwatch.service
|
|
%attr(1775,-,arpwatch) %dir %{_vararpwatch}
|
|
%attr(0644,arpwatch,arpwatch) %verify(not md5 size mtime) %config(noreplace) %{_vararpwatch}/arp.dat
|
|
%attr(0644,arpwatch,arpwatch) %verify(not md5 size mtime) %config(noreplace) %{_vararpwatch}/arp.dat-
|
|
%attr(0600,arpwatch,arpwatch) %verify(not md5 size mtime) %ghost %{_vararpwatch}/arp.dat.new
|
|
%attr(0644,-,arpwatch) %verify(not md5 size mtime) %config(noreplace) %{_vararpwatch}/ethercodes.dat
|
|
|
|
%files help
|
|
%{_mandir}/man8/*.8*
|
|
|
|
%changelog
|
|
* Fri Sep 06 2019 Alex Chao <zhaolei746@huawei.com> - 14:2.1a15-44
|
|
- Package init
|