]> git.ipfire.org Git - thirdparty/systemd.git/commit
sysusers: emit audit events for user and group creation (#35957)
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 15 Jan 2025 09:36:07 +0000 (10:36 +0100)
committerGitHub <noreply@github.com>
Wed, 15 Jan 2025 09:36:07 +0000 (10:36 +0100)
commit69c9629da760bcffe84b04b3ad537d9429a255ea
tree200c1af081b6a0f5d8c5ebc6a7db2aa6cf19aca7
parent132a164d974e01558f44de3901f436feec3cc652
parent0dba7b5c6b20f4649e0d2a8e0b729494f2192538
sysusers: emit audit events for user and group creation (#35957)

Background: Fedora/RHEL are switching to sysusers.d metadata for
creation of users and groups for system users defined by packages
(https://fedoraproject.org/wiki/Changes/RPMSuportForSystemdSysusers).
Packages carry sysusers files. During package installation, rpm calls an
program to execute on this config. This program may either be
/usr/lib/rpm/sysusers.sh which calls useradd/groupadd, or
/usr/bin/systemd-sysusers. To match the functionality provided by
useradd/groupadd from the shadow-utils project, systemd-sysusers must
emit audit events so that it provides a drop-in replacement.

systemd-sysuers will emit audit events AUDIT_ADD_USER/AUDIT_ADD_GROUP
when adding users and groups. The operation "names" are copied from
shadow-utils, so the format of the events that is generated on success
should be identical. On failure, things are more complicated. We write
the whole file at once, once, so we first generate "success" messages
for each entry, then we try to write the files, and if things fail, we
generate failure messages to all entries that we failed to write.
src/core/manager.c
src/sysusers/sysusers.c