Description of problem:
system-sysusers is creating system users with UIDs in regular user range. This allows those users to potentially bypass PAM restrictions and other limits based on UID range.
Version-Release number of selected component (if applicable):
Anytime systemd-sysuser is used to create users, for example during systemd upgrade (systemd-coredump user) or install of dnsmasq (dnsmasq user)
Steps to Reproduce:
1. Edit login.defs so that UID_MIN is != 1000, eg "UID_MIN 500" (as was the default in earlier Fedora releases)... you could also update SYS_UID_MAX if that's defined.
2. Create sysuser conf file /run/sysusers.d/test-sysusers.conf containing
u test-sysusers - "Test sysusers"
3. Run: systemd-sysusers /run/sysusers.d/test-sysusers.conf
Creating group test-sysusers with gid 998.
Creating user test-sysusers (Test sysusers) with uid 998 and gid 998.
System user created with UID < 500, as useradd -r does and almost all RPM packages that create system users.
From looking at the systemd source, it appears to be setting a build config option SYSTEM_UID_MAX from the build machines /etc/login.defs SYS_UID_MAX value (with default 999 if missing) -- so the max is being set at compile time.
Even this is incorrect, as SYS_UID_MAX defaults to UID_MIN-1, not 999...
src/sysusers/sysusers.c should be modified to use the logic documented in login.defs(5): SYS_UID_MAX, or UID_MIN-1, or 999, in that order... and probably also honoring SYS_UID_MIN etc...
Submitted upstream: https://github.com/systemd/systemd/issues/9769
Lennart closed the upstream bug referring to https://github.com/systemd/systemd/blob/f4ea7552c109942b49cc1a3c37e959716fb8c453/doc/UIDS-GIDS.md - it states that systemd systems have their SYS_UID_MAX fixed at compile time (distro chooses it), and are not user configurable.
This pretty much makes systemd-sysusers incompatible with Fedora since Fedora systems do have configurable SYS_UID_MAX, and has changed it over the years (100, later 500, now 1000) - and so there are many, many upgraded systems that cannot easily re-number all their existing users...
So it appears that there are two options here:
a) create a patch for Fedora that make systemd-sysusers reference login.defs knowing the patch will not be accepted upstream
b) fix all rpm.spec files that currently user sysusers to pre-create system users using useradd -r so that any installed sysusers.d/*.conf files will be a no-op.
Of course, there's always c) do nothing, and break security on older systems.
Personally, I'd suggest (b) since it's simple, and doesn't involve patching systemd, and is therefore easier to maintain... but does involve patching a number of spec files (and hence creating a number of new bugs :P)
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora 'version' of '28'.
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.
Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 28 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Fedora 28 changed to end-of-life (EOL) status on 2019-05-28. Fedora 28 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
Thank you for reporting this bug and we are sorry it could not be fixed.