-
Notifications
You must be signed in to change notification settings - Fork 246
src/useradd.c: chroot or prefix SELinux file context #1258
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
base: master
Are you sure you want to change the base?
Conversation
This is blocked by next-actions/pytest-mh#101 |
@praiskup and @pmatilai I have created a COPR repository to help test these changes. Do you mind testing them? By the way, if you need the build in some other distribution let me know. |
pytest-mh v1.0.24 provided new SELinux functionality and this is needed for the tests that are under development. Update this dependency to satisfy the new test requirements. Signed-off-by: Iker Pedrosa <[email protected]>
Add SELinux utility to BaseLinuxRole. Signed-off-by: Iker Pedrosa <[email protected]>
SELinux context labels aren't supported in chroot and prefix options, thus check that they aren't changed when adding a user. Tests: shadow-maint#940 Signed-off-by: Iker Pedrosa <[email protected]>
Expand commonio_close() interface to add a control flag for SELinux file context processing. Signed-off-by: Iker Pedrosa <[email protected]>
Expand pw_close() interface to add a control flag for SELinux file context processing. Signed-off-by: Iker Pedrosa <[email protected]>
Expand spw_close() interface to add a control flag for SELinux file context processing. Signed-off-by: Iker Pedrosa <[email protected]>
Expand gr_close() interface to add a control flag for SELinux file context processing. Signed-off-by: Iker Pedrosa <[email protected]>
Expand sgr_close() interface to add a control flag for SELinux file context processing. Signed-off-by: Iker Pedrosa <[email protected]>
Expand sub_uid_close() interface to add a control flag for SELinux file context processing. Signed-off-by: Iker Pedrosa <[email protected]>
Expand sub_gid_close() interface to add a control flag for SELinux file context processing. Signed-off-by: Iker Pedrosa <[email protected]>
Expand commonio_unlock() interface to add a control flag for SELinux file context processing. Signed-off-by: Iker Pedrosa <[email protected]>
Expand pw_unlock() interface to add a control flag for SELinux file context processing. Signed-off-by: Iker Pedrosa <[email protected]>
Expand spw_unlock() interface to add a control flag for SELinux file context processing. Signed-off-by: Iker Pedrosa <[email protected]>
Expand gr_unlock() interface to add a control flag for SELinux file context processing. Signed-off-by: Iker Pedrosa <[email protected]>
Expand sgr_unlock() interface to add a control flag for SELinux file context processing. Signed-off-by: Iker Pedrosa <[email protected]>
All unlock functions require the SELinux control flag, thus add it as an argument. Signed-off-by: Iker Pedrosa <[email protected]>
Expand sub_uid_unlock() interface to add a control flag for SELinux file context processing. Signed-off-by: Iker Pedrosa <[email protected]>
Expand sub_gid_unlock() interface to add a control flag for SELinux file context processing. Signed-off-by: Iker Pedrosa <[email protected]>
Hmm, I'm afraid I don't see any behavior change from this on the rpm case (this on Fedora 41'ish):
That's how it fails with the stock F41 shadow-utils-4.15.1-12.fc41.x86_64 too. |
Do not process SELinux file context during file closure when chroot or prefix options are selected. Closes: shadow-maint#940 Signed-off-by: Iker Pedrosa <[email protected]>
Do not process SELinux file context when creating home and mail folders when chroot or prefix options are selected. Closes: shadow-maint#940 Signed-off-by: Iker Pedrosa <[email protected]>
Expand cleanup_unlock_group() and cleanup_unlock_gshadow() interfaces to add a control flag for SELinux file context processing. Signed-off-by: Iker Pedrosa <[email protected]>
Do not process SELinux file context during file closure when chroot or prefix options are selected. Closes: shadow-maint#940 Signed-off-by: Iker Pedrosa <[email protected]>
I wasn't aware that the specific problem you were facing included groupadd, so I only updated the APIs and useradd as I wanted to confirm this was the way forward before updating other tools. With this new information I have changed the groupadd code to avoid relabeling any file. I have tested this code with the command you provided and it seems to be working. I had to disable SELinux though, as I was hitting an AVC denial when trying to open the chroot group file. I have updated the build COPR repository to include these changes. Test it when you can, and if you run into any problems share the exact steps you used so I can reproduce it. |
Tested with the proposed chagnes, and I can create users/groups with the
|
That's expected behaviour as I only proposed the fix for useradd and groupadd binaries, everything else isn't fixed yet. @alejandro-colomar @hallyn would you mind reviewing the general concept of this PR? You can skip the testing and just review how I propose to handle the propagation of the |
Yep, I'll review. |
Doh, I've missed the update round here. I'll try to retest soon, thanks for looking into this! |
The changes seem relatively simple. I ignore SELinux, so I can't review the idea, but the code seems reasonable. |
It would be interesting to merge this PR as a proper merge commit instead of a rebase, to keep it organized as a single block of changes, BTW. |
Do not process SELinux file context during file closure when chroot or
prefix options are selected.
As I'm changing a lot of files I decided to split the changes in a set of
patches to make them easier to understand.
Tests: #940
Closes: #940