Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use sysusers to create system user accounts #7318

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ dist-hook: $(VERSION_BAKEIN_TARGET)
echo "$(TARBALL)" > $(top_builddir)/.tarball_name
echo "$(VERSION)" > $(top_builddir)/.version

_rpms-prep: dist-gzip rpmroot rpmdistdir freeipa.spec
_rpms-prep: dist-gzip rpmroot rpmdistdir freeipa.spec freeipa.sysusers
cp $(top_builddir)/$$(cat $(top_builddir)/.tarball_name) $(RPMBUILD)/SOURCES/
cp $(top_builddir)/freeipa.sysusers $(RPMBUILD)/SOURCES/
rm -f $(top_builddir)/.tarball_name

rpms: $(VERSION_UPDATE_TARGET)
Expand Down
18 changes: 9 additions & 9 deletions freeipa.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ Source1: https://releases.pagure.org/freeipa/freeipa-%{version}%{?rc_vers
# gpg --armor --export-options export-minimal --export $fpr >gpgkey-$fpr.asc
Source2: gpgkey-0E63D716D76AC080A4A33513F40800B6298EB963.asc
%endif
Source3: freeipa.sysusers

# RHEL spec file only: START: Change branding to IPA and Identity Management
# Moved branding logos and background to redhat-logos-ipa-80.4:
Expand Down Expand Up @@ -292,6 +293,7 @@ BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-argcomplete
BuildRequires: systemd >= %{systemd_version}
BuildRequires: systemd-rpm-macros
# systemd-tmpfiles which is executed from make install requires apache user
BuildRequires: httpd
BuildRequires: nspr-devel
Expand Down Expand Up @@ -592,6 +594,7 @@ Requires: systemd-units >= %{systemd_version}
%if 0%{?rhel} >= 8 && ! 0%{?eln}
Requires: system-logos-ipa >= 80.4
%endif
%{?sysusers_requires_compat}

Provides: %{alt_name}-server-common = %{version}
Conflicts: %{alt_name}-server-common
Expand Down Expand Up @@ -1051,6 +1054,9 @@ make %{?_smp_mflags} check VERBOSE=yes LIBDIR=%{_libdir}

%make_install

# install sysusers configuration for systemd
install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/%{package_name}.conf

# don't package ipasphinx for now
rm -rf %{buildroot}%{python3_sitelib}/ipasphinx*

Expand Down Expand Up @@ -1202,15 +1208,7 @@ fi


%pre server-common
# create users and groups
# create kdcproxy group and user
getent group kdcproxy >/dev/null || groupadd -f -r kdcproxy
getent passwd kdcproxy >/dev/null || useradd -r -g kdcproxy -s /sbin/nologin -d / -c "IPA KDC Proxy User" kdcproxy
# create ipaapi group and user
getent group ipaapi >/dev/null || groupadd -f -r ipaapi
getent passwd ipaapi >/dev/null || useradd -r -g ipaapi -s /sbin/nologin -d / -c "IPA Framework User" ipaapi
# add apache to ipaaapi group
id -Gn apache | grep '\bipaapi\b' >/dev/null || usermod apache -a -G ipaapi
%sysusers_create_compat %{SOURCE3}


%post server-dns
Expand Down Expand Up @@ -1597,6 +1595,8 @@ fi
%attr(0644,root,root) %{_usr}/share/ipa/schema.d/README
%attr(0644,root,root) %{_usr}/share/ipa/gssapi.login
%{_usr}/share/ipa/ipakrb5.aug
%{_sysusersdir}/%{package_name}.conf


%files server-dns
%doc README.md Contributors.txt
Expand Down
7 changes: 7 additions & 0 deletions freeipa.sysusers
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# system user accounts for IPA
# - kdcproxy user and group
# - ipaapi user and group
# - add Apache HTTPd user to ipaapi group
u kdcproxy - "IPA KDC Proxy User" - -
u ipaapi - "IPA Framework User" - -
m apache ipaapi