Using systemd-sysusers

This commit is contained in:
Michal Ruprich 2022-06-14 12:11:06 +02:00
parent 728ea04ea8
commit b7be0eed7f
2 changed files with 14 additions and 6 deletions

4
tcpdump-sysusers.conf Normal file
View File

@ -0,0 +1,4 @@
#Type Name ID GECOS Home directory Shell
g tcpdump 72
u tcpdump 72 "tcpdump" - /sbin/nologin
m tcpdump tcpdump

View File

@ -2,16 +2,18 @@ Summary: A network traffic monitoring tool
Name: tcpdump Name: tcpdump
Epoch: 14 Epoch: 14
Version: 4.99.1 Version: 4.99.1
Release: 5%{?dist} Release: 6%{?dist}
License: BSD with advertising License: BSD with advertising
URL: http://www.tcpdump.org URL: http://www.tcpdump.org
Requires(pre): shadow-utils Requires(pre): shadow-utils
BuildRequires: make BuildRequires: make
BuildRequires: automake openssl-devel libpcap-devel git-core gcc BuildRequires: automake openssl-devel libpcap-devel git-core gcc
BuildRequires: systemd-rpm-macros
Source0: http://www.tcpdump.org/release/tcpdump-%{version}.tar.gz Source0: http://www.tcpdump.org/release/tcpdump-%{version}.tar.gz
Source1: ftp://ftp.ee.lbl.gov/tcpslice-1.5.tar.gz Source1: ftp://ftp.ee.lbl.gov/tcpslice-1.5.tar.gz
Source2: http://www.tcpdump.org/release/tcpdump-%{version}.tar.gz.sig Source2: http://www.tcpdump.org/release/tcpdump-%{version}.tar.gz.sig
Source3: tcpdump-sysusers.conf
Patch0002: 0002-Use-getnameinfo-instead-of-gethostbyaddr.patch Patch0002: 0002-Use-getnameinfo-instead-of-gethostbyaddr.patch
Patch0003: 0003-Drop-root-priviledges-before-opening-first-savefile-.patch Patch0003: 0003-Drop-root-priviledges-before-opening-first-savefile-.patch
@ -60,16 +62,14 @@ popd
install -m755 tcpdump ${RPM_BUILD_ROOT}%{_sbindir} install -m755 tcpdump ${RPM_BUILD_ROOT}%{_sbindir}
install -m644 tcpdump.1 ${RPM_BUILD_ROOT}%{_mandir}/man8/tcpdump.8 install -m644 tcpdump.1 ${RPM_BUILD_ROOT}%{_mandir}/man8/tcpdump.8
install -p -D -m 0644 %{SOURCE3} ${RPM_BUILD_ROOT}%{_sysusersdir}/tcpdump.conf
# fix section numbers # fix section numbers
sed -i 's/\(\.TH[a-zA-Z ]*\)[1-9]\(.*\)/\18\2/' \ sed -i 's/\(\.TH[a-zA-Z ]*\)[1-9]\(.*\)/\18\2/' \
${RPM_BUILD_ROOT}%{_mandir}/man8/* ${RPM_BUILD_ROOT}%{_mandir}/man8/*
%pre %pre
/usr/bin/getent group tcpdump >/dev/null || /usr/sbin/groupadd \ %sysusers_create_compat %{SOURCE3}
-g 72 tcpdump 2> /dev/null
/usr/bin/getent passwd tcpdump >/dev/null || /usr/sbin/useradd \
-u 72 -g 72 -s /sbin/nologin -M -r \
-d / tcpdump 2> /dev/null
exit 0 exit 0
%files %files
@ -77,10 +77,14 @@ exit 0
%doc README.md CHANGES CREDITS %doc README.md CHANGES CREDITS
%{_sbindir}/tcpdump %{_sbindir}/tcpdump
%{_sbindir}/tcpslice %{_sbindir}/tcpslice
%{_sysusersdir}/tcpdump.conf
%{_mandir}/man8/tcpslice.8* %{_mandir}/man8/tcpslice.8*
%{_mandir}/man8/tcpdump.8* %{_mandir}/man8/tcpdump.8*
%changelog %changelog
* Tue Jun 14 2022 Michal Ruprich <mruprich@redhat.com> - 14:4.99.1-6
- Using systemd-sysusers
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 14:4.99.1-5 * Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 14:4.99.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild