feat: add userns creation toggle checks to audit-secureblue (#676)#868
Merged
RoyalOughtness merged 2 commits intosecureblue:livefrom Feb 26, 2025
Merged
feat: add userns creation toggle checks to audit-secureblue (#676)#868RoyalOughtness merged 2 commits intosecureblue:livefrom
RoyalOughtness merged 2 commits intosecureblue:livefrom
Conversation
RoyalOughtness
approved these changes
Feb 23, 2025
EsseLowNitro
approved these changes
Feb 25, 2025
RoyalOughtness
pushed a commit
to RoyalOughtness/secureblue-dev
that referenced
this pull request
Aug 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds two items to
ujust audit-securebluethat check whether user namespace creation is disallowed for the uncontained domain and container domain, respectively. This would close issue #676. The checks are accompanied by suggestions to turn back on the user namespace protections if disabled using the appropriateujusttoggles.I chose to mark unconfined userns creation being enabled as a "FAILURE" and container userns creation as a "WARNING"; I'm not sure if the latter should also be "FAILURE".
Implementation note: Since checking the state of these toggles directly using
semodule -lisn't allowed for unprivileged users, we instead have to test their state by observing whether userns creation fails. For the uncontained domain, we test this usingunshare -U true. For the container domain, we create a temporary copy of theunsharebinary in the user's home directory, usechconto give it thecontainer_runtime_exec_tattribute, and rununshare -U trueusing this modified binary. (I'm a bit surprised SELinux allows this workaround—is this intended behavior? I'd also be interested to know if there's a simpler way to do this.)Legal notice: I affirm that I have authored 100% of the content I contribute, I have the necessary rights to the content, and the content may be provided under the project license.