Move group creation logic to sysusers.d fragment

This commit is contained in:
Andreas Schneider 2022-10-05 11:37:23 +02:00
parent d54cbd1fbf
commit 93ae555a84
3 changed files with 24 additions and 1 deletions

View File

@ -0,0 +1,2 @@
#Type Name ID
g printadmin -

View File

@ -0,0 +1,2 @@
#Type Name ID
g usershares -

View File

@ -135,7 +135,7 @@
%define samba_requires_eq() %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not") %define samba_requires_eq() %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
%global samba_version 4.17.0 %global samba_version 4.17.0
%global baserelease 1 %global baserelease 2
# This should be rc1 or %%nil # This should be rc1 or %%nil
%global pre_release %nil %global pre_release %nil
@ -225,6 +225,8 @@ Source12: smb.conf.example
Source13: pam_winbind.conf Source13: pam_winbind.conf
Source14: samba.pamd Source14: samba.pamd
Source15: usershares.conf.vendor Source15: usershares.conf.vendor
Source16: samba-systemd-sysusers.conf
Source17: samba-usershares-systemd-sysusers.conf
Source201: README.downgrade Source201: README.downgrade
Source202: samba.abignore Source202: samba.abignore
@ -1348,6 +1350,10 @@ echo "d /run/samba 755 root root" > %{buildroot}%{_tmpfilesdir}/samba.conf
echo "d /run/ctdb 755 root root" > %{buildroot}%{_tmpfilesdir}/ctdb.conf echo "d /run/ctdb 755 root root" > %{buildroot}%{_tmpfilesdir}/ctdb.conf
%endif %endif
install -d -m 0755 %{buildroot}%{_sysusersdir}
install -m 0644 %{SOURCE16} %{buildroot}%{_sysusersdir}/samba.conf
install -m 0644 %{SOURCE17} %{buildroot}%{_sysusersdir}/samba-usershares.conf
install -d -m 0755 %{buildroot}%{_sysconfdir}/sysconfig install -d -m 0755 %{buildroot}%{_sysconfdir}/sysconfig
install -m 0644 packaging/systemd/samba.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/samba install -m 0644 packaging/systemd/samba.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/samba
%if %{with clustering} %if %{with clustering}
@ -1508,7 +1514,11 @@ export WINBINDD_DONT_LOG_STDOUT=1
%systemd_postun_with_restart nmb.service %systemd_postun_with_restart nmb.service
%pre common %pre common
%if 0%{?fedora} || 0%{?rhel} > 8
%sysusers_create_compat %{SOURCE16}
%else
getent group printadmin >/dev/null || groupadd -r printadmin || : getent group printadmin >/dev/null || groupadd -r printadmin || :
%endif
%post common %post common
%{?ldconfig} %{?ldconfig}
@ -1617,7 +1627,11 @@ fi
%ldconfig_scriptlets test %ldconfig_scriptlets test
%pre usershares %pre usershares
%if 0%{?fedora} || 0%{?rhel} > 8
%sysusers_create_compat %{SOURCE17}
%else
getent group usershares >/dev/null || groupadd -r usershares || : getent group usershares >/dev/null || groupadd -r usershares || :
%endif
%pre winbind %pre winbind
/usr/sbin/groupadd -g 88 wbpriv >/dev/null 2>&1 || : /usr/sbin/groupadd -g 88 wbpriv >/dev/null 2>&1 || :
@ -2011,6 +2025,7 @@ fi
### COMMON ### COMMON
%files common %files common
%{_tmpfilesdir}/samba.conf %{_tmpfilesdir}/samba.conf
%{_sysusersdir}/samba.conf
%dir %{_sysconfdir}/logrotate.d/ %dir %{_sysconfdir}/logrotate.d/
%config(noreplace) %{_sysconfdir}/logrotate.d/samba %config(noreplace) %{_sysconfdir}/logrotate.d/samba
%attr(0700,root,root) %dir /var/log/samba %attr(0700,root,root) %dir /var/log/samba
@ -3323,6 +3338,7 @@ fi
%files usershares %files usershares
%config(noreplace) %{_sysconfdir}/samba/usershares.conf %config(noreplace) %{_sysconfdir}/samba/usershares.conf
%attr(1770,root,usershares) %dir /var/lib/samba/usershares %attr(1770,root,usershares) %dir /var/lib/samba/usershares
%{_sysusersdir}/samba-usershares.conf
### WINBIND ### WINBIND
%files winbind %files winbind
@ -4289,6 +4305,9 @@ fi
%endif %endif
%changelog %changelog
* Wed Oct 05 2022 Andreas Schneider <asn@redhat.com> - 4.17.0-2
- Move group creation logic to sysusers.d fragment
* Tue Sep 13 2022 Andreas Schneider <asn@redhat.com> - 4.17.0-1 * Tue Sep 13 2022 Andreas Schneider <asn@redhat.com> - 4.17.0-1
- resolves: rhbz#2118818 - Update to version 4.17.0 - resolves: rhbz#2118818 - Update to version 4.17.0
- resolves: rhbz#2121138 - Fix CVE-2022-32743 - resolves: rhbz#2121138 - Fix CVE-2022-32743