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
SELinux alerts #4128
Comments
|
Hi there! For the time being, one can overcome the flood of messages after downgrading flatpak itself (and dependencies) to version 1.8.2-2, placing an exclusion at "dnf.conf" (exact matching flatpak*-1.10.1-1.fc33.x86_64). Newly you updated flapak* to 1.10.2-1, but this issue is still present. Again, I excluded this flatpak new version from updating... Now, please evaluate and give your statement on the root of this issue, so that it can be solved here, or anywhere else. |
|
See also Fedora bug https://bugzilla.redhat.com/show_bug.cgi?id=1916652 |
|
A quick solution would be to change |
If someone who understands SELinux wants to contribute that change, please open a pull request. In AppArmor, another LSM that is used in some distros that don't normally use SELinux, the
I'm not sure whether it's really correct for .desktop files exported by Flatpak to be treated as completely equivalent to .desktop files in This change would have to be driven by someone who understands the implications of SELinux policies and can justify why
That's not a solution: it would break the ability to install a Flatpak app system-wide and have it show up in users' menus, both on SELinux systems and on non-SELinux systems. |
|
cc @amigadave @kalev - it would probably make sense for SELinux changes to come from Fedora contributors, since that's the highest-profile distro using SELinux by default. |
|
Hm, I don't know at all how the SELinux integration works here and how to fix it. @amigadave understands it better, I suspect. |
|
You almost definitely don't want to be labeling files under /var as usr_t. IMO this could really be a bug in the policies for GNOME Shell... |
|
This is not exclusive to gnome fyi, on KDE I'm getting the same alerts. |
|
It could make sense for the exports to be their own So anyone who wants a quick local workaround, do |
|
If we don't go the route of using
|
|
Can someone please provide an update on this bug? Thank you! |
|
Zdenek Pytela, the selinux-policy maintainer in Fedora, wrote in this comment:
|
|
I am still ready to work on a long-term solution, surely there are a few of them. For now, I'd rather go with Matthew's suggestion (see above):
to make it working in F34 GA. |
|
I see now Simon's comment about XDG_DATA_DIRS. So another possible solution is using attributes: xdm and some other services already have access to objects in the gnome_home_type atttribute, but /var/lib/ is not a home directory. Will think about it. |
|
Err, but wouldn't that just break all of the desktop integration? gnome-shell needs to be able to find the desktop files to be able to show the flatpak apps. I think it's a complete no-go, unless I'm missing something here. @zpytela, I replied to you in https://bugzilla.redhat.com/show_bug.cgi?id=1916652#c66 earlier today but we can bring the discussion over here if you want. Could you reply to my questions there please? |
|
@zpytela Thanks for the reply! Let's continue the discussion here. I spent some time bisecting flatpak today to find out what change actually caused the selinux alerts and it is this one: In particular, it's the addition of /usr/lib/systemd/system-environment-generators/60-flatpak-system-only that causes the alerts. If I understand it right what's going on, the system generator changes the environment for the gdm (login) session that uses gnome-shell for its UI, so it's now looking through the desktop files in /var/lib/flatpak. According to the commit message, the system environment change was done for gnome-initial-session to be able to handle parental controls. I believe gnome-initial-session also launches from the same login session and is spawned by gdm. On Fedora side, this means that we now have a quick fix: Just drop the flatpak system env generator as we don't use parental controls in F33 and F34. We only need the user env generator. Or maybe this now gives you ideas how we could easily fix this on the selinux policy side, @zpytela? |
|
Sooo, to move the discussion forward, how about labeling /var/lib/flatpak/exports/ in a specific way (flatpak_exports_var_lib_t?) and then allow xdm_t access to it? Or label all of /var/lib/flatpak in a specific way (flatpak_var_lib_t) and allow xdm_t access to it? I guess letting xdm_t read all of /var/lib would be too big of a hole? Or should I move forward with the workaround above if you want to think more about this? |
|
@kalev this is a possible way; problem is that it is not only xdm, but also other processes/services. I know we need to move forward, hopefully today I'll come up with my suggestion. |
|
Ah, I see! Now I finally understand what's the hard part here :) |
|
@kalev, if I understand the problem now correctly, this can be used as a quick workaround for xdm: If the parental control feature is not planned to use in Fedora, it would be nice to disable it then in rpm specfile. I will now continue testing to figure out if we can address this in selinux-policy by allowing or dontauditing the permissions. Stay tuned. |
|
OK, let me do that then. We are planning on enabling parental controls support for F35, but it's not enabled in F33 and F34, so I think we should be able to safely disable the system env generator there. That should take some pressure off of getting a selinux-policy fix out :) |
This is the point at the moment, thank you for understanding. See more details in https://bugzilla.redhat.com/show_bug.cgi?id=1947214#c8 |
|
Thanks, @zpytela! I went ahead and did the builds and the system env generator should be gone in flatpak-1.10.2-3.fc35, flatpak-1.10.2-3.fc34, flatpak-1.10.2-3.fc33 builds. |
Linux distribution and version
Fedora 33 (Workstation Edition)
Flatpak version
Installed Packages
Name : flatpak
Version : 1.10.1
Release : 1.fc33
Architecture : x86_64
Size : 7.4 M
Source : flatpak-1.10.1-1.fc33.src.rpm
Description of the problem
Since using flatpak I get SELinux alerts.
Steps to reproduce
Install flatpaks and alerts appear.
The text was updated successfully, but these errors were encountered: