Open jlebon opened 5 years ago
Just to add another datapoint here (and reignite this discussion):
I'm using CoreOS with the tang server package overlaid atop it. This package has the following scriptlet:
%pre
%sysusers_create_compat %{SOURCE1}
exit 0
%post
%systemd_post %{name}d.socket
# Let's make sure any existing keys are readable only
# by the owner/group.
if [ -d /var/db/tang ]; then
for k in /var/db/tang/*.jwk; do
test -e "${k}" || continue
chmod 0440 -- "${k}"
done
for k in /var/db/tang/.*.jwk; do
test -e "${k}" || continue
chmod 0440 -- "${k}"
done
chown tang:tang -R /var/db/tang
fi
If I'm reading this correctly, this should be ensuring that if the syusers-created UID/GID changes, it chown()
s them to the updated user, but that isn't happening. The resulting effect is that upgrades have a tendency to change the UID/GID and make the keys unreadable, thereby preventing my systems relying on network-bound disk encryption from decrypting their drives.
TL;DR: More issues from nss-altfiles which should be fixed by switching to systemd-sysusers (#1679). Just wanted to spell them out here for visibility and something to link to, as well as to make sure they do get correctly fixed by systemd-sysusers.
So, there are actually two issues today with layering packages that create uids/gids:
/var
already owns files from the previous uid.We don't really have a choice; we need to make sure that groups/users we create don't collide with pre-existing local system users/groups. One issue though is that if there's a system group in
/etc/group
(which is a hack we recommend to work aroundusermod -a -G
not working), then the%pre
getent
will see it and won't actually create an entry in/usr/lib/group
. This has an odd hysteresis effect: the first run of layering a package like libvirt, there will be alibvirt
entry in/usr/lib/group
, but after the user adds the libvirt group to/etc/group
as well, subsequent layered commits won't actually havelibvirt
in/usr/lib/group
.This issue is exacerbated if the package has files owned by this group. If that's the case, then layering will simply fail since the core only reads in
/usr/lib/group
for system groups. This is the case forwireshark-cli
: https://pagure.io/teamsilverblue/issue/74.The following patch works:
though it's really another hack on top of the pile of hacks. I also haven't fully thought through how it'd affect migration to sysusers.