From 86d3df17ff0ce28d7d62dde1e34f0783724fe5af096f1b5f57269aad2b830110 Mon Sep 17 00:00:00 2001 From: Thomas Blume Date: Mon, 9 Mar 2020 10:56:01 +0000 Subject: [PATCH] Accepting request 782842 from home:kukuk:container - rpc-user.conf: use sysusers method to create rpc user - Minimize dependencies for container usage OBS-URL: https://build.opensuse.org/request/show/782842 OBS-URL: https://build.opensuse.org/package/show/network/rpcbind?expand=0&rev=88 --- rpc-user.conf | 2 ++ rpcbind.changes | 6 ++++++ rpcbind.spec | 22 ++++++++++++---------- 3 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 rpc-user.conf diff --git a/rpc-user.conf b/rpc-user.conf new file mode 100644 index 0000000..2211870 --- /dev/null +++ b/rpc-user.conf @@ -0,0 +1,2 @@ +# Type Name ID GECOS [HOME] +u rpc - "User for rpcbind" /var/lib/empty diff --git a/rpcbind.changes b/rpcbind.changes index 5894ae5..6180817 100644 --- a/rpcbind.changes +++ b/rpcbind.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Mar 9 08:54:14 UTC 2020 - Thorsten Kukuk + +- rpc-user.conf: use sysusers method to create rpc user +- Minimize dependencies for container usage + ------------------------------------------------------------------- Wed Jun 12 08:11:40 UTC 2019 - Thomas Blume diff --git a/rpcbind.spec b/rpcbind.spec index 3211d71..e4b2909 100644 --- a/rpcbind.spec +++ b/rpcbind.spec @@ -1,7 +1,7 @@ # # spec file for package rpcbind # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -31,23 +31,24 @@ URL: http://rpcbind.sourceforge.net Source: https://downloads.sourceforge.net/sourceforge/%{name}/%{name}-%{version}.tar.bz2 Source2: sysconfig.rpcbind Source4: pmap_set.c +Source5: rpc-user.conf Patch1: 0001-systemd-unit-files.patch Patch2: 0001-change-lockingdir-to-run.patch Patch31: 0031-rpcbind-manpage.patch BuildRequires: libtirpc-devel >= 1.0.1 BuildRequires: libtool BuildRequires: pkgconfig -BuildRequires: systemd-rpm-macros +BuildRequires: sysuser-shadow +BuildRequires: sysuser-tools BuildRequires: tcpd-devel BuildRequires: pkgconfig(libsystemd) Requires(post): %fillup_prereq -Requires(pre): shadow Provides: portmap -%{?systemd_requires} +%{?systemd_ordering} %if 0%{?suse_version} >= 1330 BuildRequires: libnsl-devel -Requires(pre): group(nobody) %endif +%sysusers_requires %description Rpcbind is a replacement for portmap. Whereas portmap supports only UDP @@ -79,12 +80,16 @@ export LDFLAGS="-pie -Wl,-z,relro,-z,now" make %{?_smp_mflags} gcc -I/usr/include/tirpc -pie -fpie -fwhole-program -Wl,-z,relro,-z,now %{optflags} pmap_set.c -o pmap_set -ltirpc +%sysusers_generate_pre %{SOURCE5} rpc %install %make_install # fillup template mkdir -p %{buildroot}%{_fillupdir} install -m 644 %{SOURCE2} %{buildroot}%{_fillupdir}/ +# sysusers.d config +mkdir -p %{buildroot}%{_sysusersdir} +install -m 644 %{SOURCE5} %{buildroot}%{_sysusersdir}/ # install -m 755 pmap_set %{buildroot}/sbin/pmap_set2 # create symlink for rcrpcbind @@ -92,13 +97,9 @@ mkdir -p %{buildroot}/%{_sbindir} ln -s service %{buildroot}/%{_sbindir}/rc%{name} ln -s /bin/rpcinfo %{buildroot}/sbin/rpcinfo -%pre +%pre -f rpc.pre %service_add_pre %{name}.service %{name}.socket -# Add "rpc" user -getent passwd rpc >/dev/null || %{_sbindir}/useradd -r -g nobody -d %{_localstatedir}/lib/empty -s /sbin/nologin -c "user for rpcbind" rpc -exit 0 - %preun %service_del_preun %{name}.service %{name}.socket @@ -119,6 +120,7 @@ exit 0 %{_sbindir}/rc%{name} %{_mandir}/*/* %{_fillupdir}/sysconfig.%{name} +%{_sysusersdir}/rpc-user.conf %{_unitdir}/%{name}.service %{_unitdir}/%{name}.socket