From 7379460409dea88d43e5c90b6f3ddaaa480a92461b0fed4c06ee2f52984cd645 Mon Sep 17 00:00:00 2001 From: Herbert Graeber Date: Mon, 1 Mar 2021 12:44:16 +0000 Subject: [PATCH] Accepting request 875976 from home:hgraeber:branches:network - Use sysuser-tools for creation of the wsdd user and group - Do not hijack the /run/sysconfig folder anymore - Add missing '/' OBS-URL: https://build.opensuse.org/request/show/875976 OBS-URL: https://build.opensuse.org/package/show/network/wsdd?expand=0&rev=12 --- sysconfig.wsdd | 5 +++-- wsdd-init.sh | 6 +++--- wsdd-user.conf | 2 ++ wsdd.changes | 11 +++++++++++ wsdd.service.in | 4 ++-- wsdd.spec | 17 ++++++++++------- 6 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 wsdd-user.conf diff --git a/sysconfig.wsdd b/sysconfig.wsdd index 494c328..ea79bf9 100644 --- a/sysconfig.wsdd +++ b/sysconfig.wsdd @@ -1,5 +1,5 @@ -## Path: Network/WSD -## Description: WSD Configuration +## Path: Network/WSDD +## Description: WSDD Configuration ## Type: string ## Default: "" ## ServiceRestart:·wsdd @@ -30,4 +30,5 @@ WSDD_INTERFACES="" ## Type: string ## Default: "" ## ServiceRestart:·wsdd +# Additional wsdd options WSDD_ARGS="" diff --git a/wsdd-init.sh b/wsdd-init.sh index a5c553f..75a8c9b 100644 --- a/wsdd-init.sh +++ b/wsdd-init.sh @@ -1,5 +1,7 @@ #!/bin/sh +umask 0644 + WSDD_CONFIG=/etc/sysconfig/wsdd if test -r "${WSDD_CONFIG}"; then . "${WSDD_CONFIG}" @@ -23,7 +25,5 @@ if [ "${WSDD_INTERFACES}" != "" ]; then done fi -install -o wsdd -g wsdd -p 0700 -d /run/sysconfig - echo "WSDD_ARGS=${WSDD_HOSTNAME} ${WSDD_DOMAIN} ${WSDD_INTERFACE_ARGS} \ - ${WSDD_ARGS}" >/run/sysconfig/wsdd + ${WSDD_ARGS}" >/run/wsdd/env-vars diff --git a/wsdd-user.conf b/wsdd-user.conf new file mode 100644 index 0000000..c49c231 --- /dev/null +++ b/wsdd-user.conf @@ -0,0 +1,2 @@ +# Type Name ID GECOS [HOME] +u wsdd - "User for wsdd" /run/wsdd diff --git a/wsdd.changes b/wsdd.changes index b812c60..e1229db 100644 --- a/wsdd.changes +++ b/wsdd.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Mon Mar 1 11:04:37 UTC 2021 - Herbert Graeber + +- Use sysuser-tools for creation of the wsdd user and group +- Do not hijack the /run/sysconfig folder anymore + +------------------------------------------------------------------- +Sun Feb 28 17:26:00 UTC 2021 - Herbert Graeber + +- Add missing '/' + ------------------------------------------------------------------- Sun Feb 28 16:11:58 UTC 2021 - Herbert Graeber diff --git a/wsdd.service.in b/wsdd.service.in index 48353f6..63dd4a7 100644 --- a/wsdd.service.in +++ b/wsdd.service.in @@ -9,9 +9,9 @@ AmbientCapabilities=CAP_SYS_CHROOT PermissionsStartOnly=true Environment= WSDD_ARGS=-p ExecStartPre=@LIBEXECDIR@/wsdd-init.sh -EnvironmentFile=-/run/sysconfig/wsdd +EnvironmentFile=-/run/wsdd/env-vars ExecStart=/usr/sbin/wsdd --shortlog -c /run/wsdd $WSDD_ARGS -ExecStartPost=/usr/bin/rm /run/sysconfig/wsdd +ExecStartPost=/usr/bin/rm /run/wsdd/env-vars User=wsdd Group=wsdd diff --git a/wsdd.spec b/wsdd.spec index d7c539f..fdd053c 100644 --- a/wsdd.spec +++ b/wsdd.spec @@ -28,7 +28,9 @@ Source2: %{name}.service.in Source3: %{name}.xml Source4: sysconfig.%{name} Source5: %{name}.conf +Source6: %{name}-user.conf Patch1: %{name}-shebang.patch +BuildRequires: sysuser-tools BuildRequires: firewall-macros BuildRequires: python3 Requires(post): %fillup_prereq @@ -49,6 +51,7 @@ for devices running Samba, like NAS or file sharing servers on your local networ %patch1 -p1 %build +%sysusers_generate_pre %{SOURCE6} %{name} %install install -m 755 -D src/wsdd.py %{buildroot}%{_sbindir}/%{name} @@ -64,16 +67,16 @@ mkdir -p %{buildroot}%{_prefix}/lib/tmpfiles.d/ install -m 644 %{SOURCE5} %{buildroot}%{_tmpfilesdir} mkdir -p %{buildroot}/run/wsdd mkdir -p %{buildroot}%{_localstatedir}/lib/wsdd +mkdir -p %{buildroot}%{_sysusersdir} +install -m 0644 %{SOURCE6} %{buildroot}%{_sysusersdir}/ -%pre -getent group wsdd >/dev/null || %{_sbindir}/groupadd -r wsdd -getent passwd wsdd >/dev/null || %{_sbindir}/useradd -r -g wsdd -c "User for wsdd" -s /sbin/nologin -d /run/wsdd wsdd +%pre -f %{name}.pre %service_add_pre wsdd.service %post %fillup_only %service_add_post wsdd.service -%tmpfiles_create %{_tmpfilesdir}wsdd.conf +%tmpfiles_create %{_tmpfilesdir}/wsdd.conf %firewalld_reload %preun @@ -97,8 +100,8 @@ getent passwd wsdd >/dev/null || %{_sbindir}/useradd -r -g wsdd -c "User for wsd %dir %{_prefix}/lib/firewalld/services %{_prefix}/lib/firewalld/services/wsdd.xml %{_fillupdir}/sysconfig.%{name} -%dir %attr(0755,wsdd,wsdd) %ghost /run/sysconfig -%attr(0644,wsdd,wsdd) %ghost /run/sysconfig/wsdd -%dir %attr(0755,wsdd,wsdd) %ghost /run/wsdd +%{_sysusersdir}/%{name}-user.conf +%dir %attr(0755,wsdd,wsdd) %ghost /run/%{name} +%attr(0644,wsdd,wsdd) %ghost /run/%{name}/env-vars %changelog