Resolves: RHEL-6575 - [RFE] httpd use systemd-sysusers

This commit is contained in:
Luboš Uhliarik 2024-05-20 12:46:19 +02:00
parent f62333944e
commit 966d01a60e
2 changed files with 16 additions and 10 deletions

View File

@ -13,7 +13,7 @@
Summary: Apache HTTP Server
Name: httpd
Version: 2.4.59
Release: 3%{?dist}
Release: 4%{?dist}
URL: https://httpd.apache.org/
Source0: https://www.apache.org/dist/httpd/httpd-%{version}.tar.bz2
Source1: https://www.apache.org/dist/httpd/httpd-%{version}.tar.bz2.asc
@ -62,6 +62,7 @@ Source45: config.layout
Source46: apachectl.sh
Source47: apachectl.xml
Source48: apache-poweredby.png
Source49: httpd.sysusers
# build/scripts patches
Patch2: httpd-2.4.43-apxs.patch
@ -111,13 +112,12 @@ BuildRequires: perl-interpreter, perl-generators, systemd-devel
BuildRequires: zlib-devel, libselinux-devel, lua-devel, brotli-devel
BuildRequires: apr-devel >= 1.5.0, apr-util-devel >= 1.5.0, pcre-devel >= 5.0
BuildRequires: gnupg2
BuildRequires: systemd-rpm-macros
Requires: system-logos-httpd
Provides: webserver
Requires: httpd-core = 0:%{version}-%{release}
Recommends: mod_http2, mod_lua
Requires(preun): systemd-units
Requires(postun): systemd-units
Requires(post): systemd-units
%{?systemd_requires}
%description
The Apache HTTP Server is a powerful, efficient, and extensible
@ -167,7 +167,7 @@ also be found at https://httpd.apache.org/docs/2.4/.
%package filesystem
Summary: The basic directory layout for the Apache HTTP Server
BuildArch: noarch
Requires(pre): /usr/sbin/useradd
%{?sysusers_requires_compat}
%description filesystem
The httpd-filesystem package contains the basic directory layout
@ -587,6 +587,9 @@ touch -r $RPM_BUILD_ROOT%{_bindir}/apxs \
$RPM_BUILD_ROOT%{_libdir}/httpd/build/vendor-apxs
chmod 755 $RPM_BUILD_ROOT%{_libdir}/httpd/build/vendor-apxs
# Fix content dir in sysusers file and install it
install -p -D -m 0644 %{SOURCE49} %{buildroot}%{_sysusersdir}/httpd.conf
# Remove unpackaged files
rm -vf \
$RPM_BUILD_ROOT%{_libdir}/*.exp \
@ -602,11 +605,8 @@ rm -vf \
rm -rf $RPM_BUILD_ROOT/etc/httpd/conf/{original,extra}
%pre filesystem
getent group apache >/dev/null || groupadd -g 48 -r apache
getent passwd apache >/dev/null || \
useradd -r -u 48 -g apache -s /sbin/nologin \
-d %{contentdir} -c "Apache" apache
exit 0
%sysusers_create_compat %{SOURCE49}
%post
%systemd_post httpd.service htcacheclean.service httpd.socket
@ -770,6 +770,7 @@ exit $rv
%dir %{contentdir}/icons
%attr(755,root,root) %dir %{_unitdir}/httpd.service.d
%attr(755,root,root) %dir %{_unitdir}/httpd.socket.d
%{_sysusersdir}/httpd.conf
%files tools
%{_bindir}/*
@ -822,6 +823,9 @@ exit $rv
%{_rpmconfigdir}/macros.d/macros.httpd
%changelog
* Mon May 20 2024 Luboš Uhliarik <luhliari@redhat.com> - 2.4.59-4
- Resolves: RHEL-6575 - [RFE] httpd use systemd-sysusers
* Wed May 08 2024 Luboš Uhliarik <luhliari@redhat.com> - 2.4.59-3
- Related: RHEL-14668 - RFE: httpd rebase to 2.4.59

2
httpd.sysusers Normal file
View File

@ -0,0 +1,2 @@
g apache 48
u apache 48 "Apache" /usr/share/httpd /sbin/nologin