Skip to content

flatcar-tmpfiles: Copy over the shadow group and use it for shadow files#39

Merged
krnowak merged 2 commits intoflatcar-masterfrom
krnowak/shadow
Dec 10, 2025
Merged

flatcar-tmpfiles: Copy over the shadow group and use it for shadow files#39
krnowak merged 2 commits intoflatcar-masterfrom
krnowak/shadow

Conversation

@krnowak
Copy link
Copy Markdown
Member

@krnowak krnowak commented Nov 28, 2025

Some binaries acting on those files are now owned by the shadow group
with a sticky bit instead of having CAP_DAC_SEARCH (or
CAP_DAC_OVERRIDE) caps. For them to work, shadow and gshadow files
also need to be owned by the group shadow.

Will be tested together with the weekly updates.

Copy link
Copy Markdown

@chewi chewi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these ever used caps? They were previously SUID root. There is an old Gentoo bug open about using caps, so I'm a little surprised that floppym went with SGID recently instead, but I suppose non-caps support was needed too.

Some binaries acting on those files are now owned by the shadow group
with a sticky bit instead of having CAP_DAC_SEARCH (or
CAP_DAC_OVERRIDE) caps. For them to work, shadow and gshadow files
also need to be owned by the group shadow.

Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
@krnowak krnowak force-pushed the krnowak/shadow branch 2 times, most recently from 0cadb3e to b6bcb70 Compare December 8, 2025 17:40
@krnowak
Copy link
Copy Markdown
Member Author

krnowak commented Dec 10, 2025

I think these were SUID root for a long time, because of our modifications. Then they started using caps because I moved some package to portage-stable and then, recently, they became SGID shadow.

Also, I updated the PR for so flatcar-tmpfiles stops printing some warnings into journalctl. It initially confused me as being an issue.

@krnowak krnowak requested a review from chewi December 10, 2025 06:00
@krnowak
Copy link
Copy Markdown
Member Author

krnowak commented Dec 10, 2025

Also changed chgrp to chown - there is no chgrp in initrd and this change was faster to make than modifying bootengine to include chgrp.

In the logs there are warnings like:

cut: /sysroot/etc/passwd: No such file or directory
cut: /sysroot/etc/group: No such file or directory
cut: /sysroot/etc/shadow: No such file or directory
cut: /sysroot/etc/gshadow: No such file or directory

They are confusing - we are fine with those files being absent, but we
shouldn't be fine with printing such warnings. It misled me into
thinking of being an issue.

Also put the common part into a function, hopefully it's a bit easier
to read.

Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
@krnowak krnowak merged commit bb76459 into flatcar-master Dec 10, 2025
1 check passed
@krnowak krnowak deleted the krnowak/shadow branch December 10, 2025 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants