-
Notifications
You must be signed in to change notification settings - Fork 254
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
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. |
|
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. |
|
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. |
|
This PR is ready for review and testing. The COPR repository has also been updated with the latest changes. @praiskup and @pmatilai do you mind testing? I've updated all binaries to prevent SELinux file context processing during file closure when System tests have been removed as this PR already includes significant changes and container compatibility issues prevent proper execution. |
hallyn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with this.
I do wonder whether we would be better off using some ambient state (maybe just a simple global) to keep track of the process_selinux bool. Have it automatically set to true at the start of each (relevant) program, and have the chroot and prefix options, when parsed, set it to false.
It would keep a lot of the function signatures simpler, but I'm not sure the end result is better, so feel free to merge this.
I prefer passing it locally. While a static looks simpler, it might complicate things later. I'm working on removing some statics elsewhere, and I think it would be good to not add more. |
|
@ikerexxe You need to rebase a few conflicts. |
I also prefer to pass it locally and add yet another global variable that will complicate things in the future.
I'll do it during the week. By the way, @pmatilai @praiskup I'm waiting for you to test this. |
Do not process SELinux file context during file closure when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context when running fail_exit() when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context during file closure when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context when running fail_exit() when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context during file closure when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context when running fail_exit() when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context during file closure when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context when running fail_exit() when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context during file closure when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context when running fail_exit() when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context during file closure when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context when running fail_exit() when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context during file closure when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context when running fail_exit() when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context during file closure when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context when running fail_exit() when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context during file closure when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context when running fail_exit() when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context during file closure when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context when running fail_exit() when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context during file closure when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context when running fail_exit() when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Do not process SELinux file context during file closure when chroot or prefix options are selected. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
5bf4dc0 to
923aeac
Compare
It doesn't really matter because the code has changed quite a bit between shadow 4.18 and master, so I would have to port a few commits to the COPR build before I could apply this branch cleanly.
For my part, these tests would be sufficient. Thank you for checking. |
|
@ikerexxe so we're good to merge? |
|
@hallyn yes, I think this is good as it is. Please keep in mind Alejandro's comment:
|
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