Possible SE Linux label bug in bluefin-dx:stable? #4928
murphym18
started this conversation in
Discussions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Looks like SELinux is misconfigured on
bluefin-dx:stable. When I get the default SELinux security context for my home directory from the file contexts configuration, the labels are wrong. As a result, SELinux labeling tools determine that my home directory should have the typedefault_tinstead ofuser_home_dir_t. There are similar labeling errors for all the common sub-directories in~/(such as~/Documentsand~/Music).SELinux's file-context configuration appears to be missing the substitution needed to map
/var/hometo/home.Here are the steps to reproduce:
bluefin-dx:stable.matchpathcon ~/DocumentsHere's the expected output:
Actual output:
Background
for context,
matchpathconanswers the question: given the current SELinux file-context config, what should this file's label be?In this case,
user_home_tis the desired type for~/Documents. The type should not bedefault_t.Here's some background: SELinux includes policies that can protect your home directory from processes that should not have access to it. However, these policies only work as intended if your home directory is labeled Appropriately. In this case, your
~/Documentsshould be labeled withuser_home_t.When you first install bluefin, your home directory should already have the correct label. You can find out by running:
You should see that your home directory has the label:
But you might run into labeling issues going forward because the system thinks your home directory (and
~/Documents) ought to be labeled with the typedefault_t.You're more likely to run into issues when you mount your home directory (or a sub-directory) into a container. For example, if you create a Podman Quadlet that bind-mounts a directory such as
~/Documentsinto a container with the:zoption. In that case your~/Documentsdirectory gets relabeled in order to enable your container to access the contents. The problem shows up when your container exits. Sometimes that relabeling persists after the container exits. If that happens you might want to relabel your directory.Normally you should be able to restore your SELinux label(s) by running
restorecon. For example:This program is supposed to find the correct label and apply it. However, this program won't work on
bluefin-dx. Basically,restoreconcannot reliably restore the intended home-directory labels because SELinux's file-context configuration says that/var/home/user/Documentsshould bedefault_t.Please note, it's not just the
~/Documentsdirectory, it's the entire home directory and all its sub-directories. Here are some other examples:Some Other Thoughts
Note
This problem does not exist in
bluefin. I only observed the problem inbluefin-dxI think I was able to track the problem down to this file:
On Bluefin (non-dx) this file has a special fix. But on
bluefin-dxthis special fix isn't present.To figure out what's going on, I ran this command on
bluefin-dxandbluefin:selinux-policy-targeted-44.8-1.fc44.noarchselinux-policy-targeted-44.4-1.fc44.noarchThe working version in
bluefinincludes comments around the fix and it links to this:coreos/rpm-ostree#1754 (comment) (someone previously found this issue)
I tried to download the special version of this package in
bluefin:but I couldn't find it online:
https://rpmfind.net/linux/rpm2html/search.php?query=selinux-policy-targeted&submit=Search+...&system=&arch=
By the way, I attached a copy of Bluefin's
file_contexts.subs_dist(this is the working version).Here's a diff:
Bluefin on the left (working version), Bluefin-dx on the right (broken version)
file_contexts.subs_dist.txt
All reactions