Skip to content
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 user_u on KDE: logout, shutdown, reboot buttons not working in start menu #1829

Open
PhysicsIsAwesome opened this issue Aug 9, 2023 · 10 comments

Comments

@PhysicsIsAwesome
Copy link

PhysicsIsAwesome commented Aug 9, 2023

Hi,

I have a strange bug with Fedora KDE (v38) when using user_u (and staff_u). The logout, shutdown, reboot buttons in start menu do not work. It works in permissive mode, but not in enforcing. I couldn't fix it with audit2allow even in audit mode.

Ausearch:

sudo ausearch -i -m avc,user_avc,selinux_err,user_selinux_err

type=AVC msg=audit(09.08.2023 21:11:25.806:1145) : avc:  denied  { write } for  pid=14756 comm=ssh-agent name=/ dev="tmpfs" ino=1 scontext=user_u:user_r:user_ssh_agent_t:s0-s0:c100.c199 tcontext=user_u:object_r:user_tmp_t:s0 tclass=dir permissive=1 

type=AVC msg=audit(09.08.2023 21:11:25.806:1146) : avc:  denied  { remove_name } for  pid=14756 comm=ssh-agent name=ssh-agent.socket dev="tmpfs" ino=127 scontext=user_u:user_r:user_ssh_agent_t:s0-s0:c100.c199 tcontext=user_u:object_r:user_tmp_t:s0 tclass=dir permissive=1 

type=AVC msg=audit(09.08.2023 21:11:25.806:1147) : avc:  denied  { unlink } for  pid=14756 comm=ssh-agent name=ssh-agent.socket dev="tmpfs" ino=127 scontext=user_u:user_r:user_ssh_agent_t:s0-s0:c100.c199 tcontext=user_u:object_r:user_tmp_t:s0 tclass=sock_file permissive=1 

audit2allow -R didn't fix it, so I did the same with semodule -DB:

sudo ausearch -i -m avc,user_avc,selinux_err,user_selinux_err

type=AVC msg=audit(09.08.2023 21:28:02.246:1410) : avc:  denied  { noatsecure } for  pid=18688 comm=polkitd scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 

type=AVC msg=audit(09.08.2023 21:28:02.247:1411) : avc:  denied  { rlimitinh } for  pid=18688 comm=pkla-check-auth scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 

type=AVC msg=audit(09.08.2023 21:28:02.247:1412) : avc:  denied  { siginh } for  pid=18688 comm=pkla-check-auth scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 

type=AVC msg=audit(09.08.2023 21:28:02.279:1413) : avc:  denied  { search } for  pid=17212 comm=wireplumber name=alsa dev="dm-0" ino=186803 scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=system_u:object_r:alsa_var_lib_t:s0 tclass=dir permissive=1 

type=AVC msg=audit(09.08.2023 21:28:06.505:1414) : avc:  denied  { noatsecure } for  pid=18960 comm=QThread scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=user_u:user_r:chkpwd_t:s0-s0:c100.c199 tclass=process permissive=1 

type=AVC msg=audit(09.08.2023 21:28:06.510:1415) : avc:  denied  { rlimitinh } for  pid=18960 comm=unix_chkpwd scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=user_u:user_r:chkpwd_t:s0-s0:c100.c199 tclass=process permissive=1 

type=AVC msg=audit(09.08.2023 21:28:06.510:1416) : avc:  denied  { siginh } for  pid=18960 comm=unix_chkpwd scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=user_u:user_r:chkpwd_t:s0-s0:c100.c199 tclass=process permissive=1 

type=AVC msg=audit(09.08.2023 21:28:06.680:1418) : avc:  denied  { noatsecure } for  pid=18965 comm=polkitd scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 

type=AVC msg=audit(09.08.2023 21:28:06.681:1419) : avc:  denied  { rlimitinh } for  pid=18965 comm=pkla-check-auth scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 

type=AVC msg=audit(09.08.2023 21:28:06.681:1420) : avc:  denied  { siginh } for  pid=18965 comm=pkla-check-auth scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 

type=AVC msg=audit(09.08.2023 21:28:14.280:1421) : avc:  denied  { getattr } for  pid=13060 comm=IndexedDB #26 name=/ dev="dm-0" ino=256 scontext=unconfined_u:unconfined_r:mozilla_t:s0-s0:c0.c1023 tcontext=system_u:object_r:fs_t:s0 tclass=filesystem permissive=1 

type=AVC msg=audit(09.08.2023 21:28:16.227:1422) : avc:  denied  { getattr } for  pid=17393 comm=GlobalQueue[04] path=/var/cache/app-info dev="dm-0" ino=72234 scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=system_u:object_r:fwupd_cache_t:s0 tclass=dir permissive=1 

type=AVC msg=audit(09.08.2023 21:28:16.227:1423) : avc:  denied  { search } for  pid=17393 comm=GlobalQueue[04] name=app-info dev="dm-0" ino=72234 scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=system_u:object_r:fwupd_cache_t:s0 tclass=dir permissive=1 

type=AVC msg=audit(09.08.2023 21:28:16.228:1424) : avc:  denied  { read } for  pid=17393 comm=GlobalQueue[04] name=xmls dev="dm-0" ino=72237 scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=system_u:object_r:fwupd_cache_t:s0 tclass=dir permissive=1 

type=AVC msg=audit(09.08.2023 21:28:16.228:1425) : avc:  denied  { open } for  pid=17393 comm=GlobalQueue[04] path=/var/cache/app-info/xmls dev="dm-0" ino=72237 scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=system_u:object_r:fwupd_cache_t:s0 tclass=dir permissive=1 

type=AVC msg=audit(09.08.2023 21:28:16.229:1426) : avc:  denied  { getattr } for  pid=17393 comm=GlobalQueue[04] path=/var/cache/app-info/xmls/copr:copr.fedorainfracloud.org:phracek:PyCharm.xml dev="dm-0" ino=433758 scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=system_u:object_r:fwupd_cache_t:s0 tclass=file permissive=1 

type=AVC msg=audit(09.08.2023 21:28:17.770:1427) : avc:  denied  { read } for  pid=17393 comm=GlobalQueue[04] name=copr:copr.fedorainfracloud.org:phracek:PyCharm.xml dev="dm-0" ino=433758 scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=system_u:object_r:fwupd_cache_t:s0 tclass=file permissive=1 

type=AVC msg=audit(09.08.2023 21:28:17.770:1428) : avc:  denied  { open } for  pid=17393 comm=GlobalQueue[04] path=/var/cache/app-info/xmls/copr:copr.fedorainfracloud.org:phracek:PyCharm.xml dev="dm-0" ino=433758 scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=system_u:object_r:fwupd_cache_t:s0 tclass=file permissive=1 

type=AVC msg=audit(09.08.2023 21:29:13.829:1433) : avc:  denied  { read } for  pid=19051 comm=ksmserver-logou name=icons dev="dm-0" ino=83131 scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=system_u:object_r:accountsd_var_lib_t:s0 tclass=dir permissive=1 

type=AVC msg=audit(09.08.2023 21:29:15.729:1434) : avc:  denied  { noatsecure } for  pid=19090 comm=fuse mainloop scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=user_u:user_r:mount_t:s0-s0:c100.c199 tclass=process permissive=1 

type=AVC msg=audit(09.08.2023 21:29:15.730:1435) : avc:  denied  { rlimitinh } for  pid=19090 comm=fusermount3 scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=user_u:user_r:mount_t:s0-s0:c100.c199 tclass=process permissive=1 

type=AVC msg=audit(09.08.2023 21:29:15.737:1436) : avc:  denied  { siginh } for  pid=19090 comm=fusermount3 scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=user_u:user_r:mount_t:s0-s0:c100.c199 tclass=process permissive=1 

type=AVC msg=audit(09.08.2023 21:29:15.763:1437) : avc:  denied  { search } for  pid=16897 comm=systemd name=17048 dev="proc" ino=182887 scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=user_u:user_r:mount_t:s0-s0:c100.c199 tclass=dir permissive=1 

type=AVC msg=audit(09.08.2023 21:29:15.763:1438) : avc:  denied  { read } for  pid=16897 comm=systemd name=comm dev="proc" ino=197963 scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=user_u:user_r:mount_t:s0-s0:c100.c199 tclass=file permissive=1 

type=AVC msg=audit(09.08.2023 21:29:15.763:1439) : avc:  denied  { open } for  pid=16897 comm=systemd path=/proc/17048/comm dev="proc" ino=197963 scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=user_u:user_r:mount_t:s0-s0:c100.c199 tclass=file permissive=1 

type=AVC msg=audit(09.08.2023 21:29:15.763:1440) : avc:  denied  { getattr } for  pid=16897 comm=systemd path=/proc/17048/comm dev="proc" ino=197963 scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=user_u:user_r:mount_t:s0-s0:c100.c199 tclass=file permissive=1 

type=AVC msg=audit(09.08.2023 21:29:15.763:1441) : avc:  denied  { ioctl } for  pid=16897 comm=systemd path=/proc/17048/comm dev="proc" ino=197963 ioctlcmd=TCGETS scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=user_u:user_r:mount_t:s0-s0:c100.c199 tclass=file permissive=1 

type=AVC msg=audit(09.08.2023 21:29:15.767:1442) : avc:  denied  { noatsecure } for  pid=19095 comm=polkitd scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 

type=AVC msg=audit(09.08.2023 21:29:15.767:1443) : avc:  denied  { rlimitinh } for  pid=19095 comm=pkla-check-auth scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 

type=AVC msg=audit(09.08.2023 21:29:15.767:1444) : avc:  denied  { siginh } for  pid=19095 comm=pkla-check-auth scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 

type=USER_AVC msg=audit(09.08.2023 21:29:15.812:1447) : pid=1224 uid=dbus auid=unset ses=unset subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc:  denied  { send_msg } for  scontext=system_u:system_r:systemd_logind_t:s0 tcontext=unconfined_u:unconfined_r:mozilla_t:s0-s0:c0.c1023 tclass=dbus permissive=1 exe=/usr/bin/dbus-broker sauid=dbus hostname=? addr=? terminal=?' 

type=AVC msg=audit(09.08.2023 21:29:26.050:1450) : avc:  denied  { noatsecure } for  pid=19408 comm=polkitd scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 

type=AVC msg=audit(09.08.2023 21:29:26.051:1451) : avc:  denied  { rlimitinh } for  pid=19408 comm=pkla-check-auth scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 

type=AVC msg=audit(09.08.2023 21:29:26.051:1452) : avc:  denied  { siginh } for  pid=19408 comm=pkla-check-auth scontext=system_u:system_r:policykit_t:s0 tcontext=system_u:system_r:policykit_auth_t:s0 tclass=process permissive=1 

Did audit2allow -R again, applied policy, but it nevertheless didn't work in enforcing mode.

@PhysicsIsAwesome
Copy link
Author

The above logs were timed to only capture the time of the button click. I expanded the timeframe to also capture more, for example the login. One event which caught my eye was:

type=SELINUX_ERR msg=audit(09.08.2023 21:58:47.410:6254) : op=security_compute_sid invalid_context=user_u:user_r:init_t:s0-s0:c100.c199 scontext=user_u:user_r:user_t:s0-s0:c100.c199 tcontext=system_u:object_r:init_exec_t:s0 tclass=process 

Don't know if this has anything to do with the above problem.

@py0xc3
Copy link

py0xc3 commented Aug 22, 2023

I also experience the issue that these buttons do not work, and my journalctl does not log any denial-related entry when I click them.

Maybe the buttons are simply broken because of some denial(s) that happen(s) earlier: I could imagine that the actual issue occurs at the time of #1847

@py0xc3
Copy link

py0xc3 commented Sep 24, 2023

There is another indication that an impactful SELinux-denial occurs earlier, before the effects within KDE take place:

Within a confined user, I cannot add new bluetooth devices. I can use those that are already known, but when I try to add new bluetooth devices from within KDE, it fails. It looks like a bluetooth error, but the logs of root do not contain anything at all (no bluetooth issues, no denials), whereas the user logs log some KDE/Plasma-related issues (the following log contains both adding new bluetooth devices and then trying connecting to them; all within a confined account and all fails -> the adding of the device ends up in the device being shown in the "known devices"-list after the initial "add+connect" fail, but connecting to the then-seemingly-known device does fail as well if it was added during the account was confined):

Sep 23 15:49:43 fedora bluedevil-wizard[41460]: kf.bluezqt: PendingCall Error: "In Progress"
Sep 23 15:49:42 fedora bluedevil-wizard[41460]: kf.bluezqt: PendingCall Error: "Operation already in progress"
Sep 23 15:49:41 fedora bluedevil-wizard[41460]: kf.bluezqt: PendingCall Error: "In Progress"
Sep 23 15:49:36 fedora bluedevil-wizard[41460]: kf.bluezqt: PendingCall Error: "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."
Sep 23 15:49:07 fedora plasmashell[3102]: QString::arg: 2 argument(s) missing in org.kde.bluedevilwizard
Sep 23 15:49:00 fedora plasmashell[3102]: QString::arg: 2 argument(s) missing in org.kde.bluedevilwizard
Sep 23 15:48:34 fedora bluedevil-wizard[41422]: kf.bluezqt: PendingCall Error: "br-connection-canceled"
Sep 23 15:48:17 fedora plasmashell[3102]: QString::arg: 2 argument(s) missing in org.kde.bluedevilwizard
Sep 23 15:48:16 fedora plasmashell[3102]: kf.bluezqt: PendingCall Error: "br-connection-busy"
Sep 23 15:48:11 fedora plasmashell[3102]: kf.bluezqt: PendingCall Error: "br-connection-busy"
Sep 23 15:32:17 fedora bluedevil-wizard[37853]: kf.bluezqt: PendingCall Error: "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."
Sep 23 15:31:47 fedora plasmashell[3102]: kf.bluezqt: PendingCall Error: "br-connection-busy"
Sep 23 15:31:40 fedora plasmashell[3102]: kf.bluezqt: PendingCall Error: "br-connection-busy"
Sep 23 15:31:15 fedora bluedevil-wizard[37853]: kf.bluezqt: PendingCall Error: "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."
Sep 23 15:30:47 fedora bluedevil-wizard[37853]: kf.bluezqt: PendingCall Error: "Authentication Canceled"
Sep 23 15:30:40 fedora plasmashell[3102]: QString::arg: 2 argument(s) missing in org.kde.bluedevilwizard
Sep 23 15:30:12 fedora plasmashell[3102]: QString::arg: 2 argument(s) missing in org.kde.bluedevilwizard
Sep 23 15:29:17 fedora plasmashell[3102]: QString::arg: 2 argument(s) missing in org.kde.bluedevilwizard
Sep 23 15:26:16 fedora bluedevil-wizard[37747]: kf.bluezqt: PendingCall Error: "br-connection-canceled"
Sep 23 15:26:01 fedora plasmashell[3102]: QString::arg: 2 argument(s) missing in org.kde.bluedevilwizard

Once I remove the confinement, I can add new bluetooth devices properly, and once they had been added while the account was not confined, I can use them also when the account is confined again.

The broken shutdown, reboot, logout buttons create comparable errors in the user logs (and they also create no denials):

Sep 24 15:09:29 fedora plasmashell[2681]: org.kde.kf5.kwindowsystem.kwayland: Failed to recreate shadow for PlasmaQuick::Dialog_QML_300(0x560b6d1651d0, name="popupWindow")
Sep 24 15:09:29 fedora plasmashell[2681]: Could not find the Plasmoid for Plasma::FrameSvgItem(0x7fc014038dd0) QQmlContext(0x560b6d2880e0) QUrl("file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications>
Sep 24 15:09:29 fedora plasmashell[2681]: Could not find the Plasmoid for Plasma::FrameSvgItem(0x7fc014038dd0) QQmlContext(0x560b6d2880e0) QUrl("file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications>
Sep 24 15:09:25 fedora plasmashell[2681]: qt.qpa.wayland: Wayland does not support QWindow::requestActivate()

I guess it makes sense to first focus on the initial denials when logging in -> #1847 . I could imagine many of the later issues disappear when the initial Plasma-denials are solved/mitigated. They seem to break something of Plasma. Thus I don't open a new ticket for this.

@py0xc3
Copy link

py0xc3 commented Oct 17, 2023

I have to correct my previous comment: There are bluetooth devices that always work properly with confined user accounts and bluetooth devices that do not work at all with confined user accounts. If a device does not work when added while the account was confined, it will also not work in a confined account when it was added before the account was confined. Vice versa, if a device works in a confined user account properly, this device also can be added properly while the account is confined. So adding and using bluetooth devices does not make a difference with regards to confinement.

It seems to depend on the type of bluetooth devices: my bluetooth mouse can be added and used within a confined user account, but bluetooth headsets (audio) do not work in any way within a confined user account (it can be neither added nor used). I assume the issue rises in between the profiles of bluetooth-devices and audio-handling.


@zpytela without a focus on the bluetooth issue: can you already predict when the reported confined-user-issues are handled/solved? Can we support you with anything else?

@zpytela
Copy link
Contributor

zpytela commented Oct 17, 2023

@py0xc3 Before a solution in selinux-policy is proposed, we need to understand why the denial appears. What really helps is a reproducer, but if it requires e.g. some particular hardware, then audit denials gathered from full auditing mode or other debugging technique should be sufficient.

@py0xc3
Copy link

py0xc3 commented Oct 18, 2023 via email

@py0xc3
Copy link

py0xc3 commented Apr 12, 2024

After upgrading to F40 KDE, this issue has been solved, along with #1847 .

@zpytela did you do something in F40? It would be interesting to know if it was you or if Plasma 6 has changed something that made such an impact.

(I cannot close this one since I didn't open it)

@py0xc3
Copy link

py0xc3 commented Apr 15, 2024

Supplement: The bluetooth issue I elaborated above (which I then assumed to have the same cause as the button issue) is still occurring in F40 and thus seems to be an independent issue.

When closing this issue, the Bluetooth issue/elaboration might be moved out to become an independent issue.

@zpytela
Copy link
Contributor

zpytela commented Apr 15, 2024

@py0xc3 Frankly I cannot answer. I've used KDE with confined users for years, so I fix problems as I face them myself, I'd need to go one issue by another to respond properly though. I still don't use plasma 6. I can confirm fixes related to ssh-agent and systemd user instance. Timeouts can quite often be a result of wrong communication over dbus and this may require fixes in the service, in policy, or both.

Regarding the outstanding bluetooth issue: the related logs should be these from https://gitlab.com/py0xc31/tmp71/-/raw/main/delayed-KDE-login.log?

Aug 22 11:42:34 fedora.domain rtkit-daemon[2064]: Failed to make process 3501 SCHED_NORMAL: Permission denied
Aug 22 11:42:34 fedora.domain audit[3501]: AVC avc:  denied  { read } for  pid=3501 comm="wireplumber" name="video3" dev="devtmpfs" ino=1235 scontext=sysadm_u:sysadm_r:sysadm_t:s0 tcontext=system_u:object_r:v4l_device_t:s0 tclass=chr_file permissive=0
Aug 22 11:42:36 fedora.domain audit[2064]: AVC avc:  denied  { setsched } for  pid=2064 comm="rtkit-daemon" scontext=system_u:system_r:rtkit_daemon_t:s0 tcontext=sysadm_u:sysadm_r:sysadm_t:s0 tclass=process permissive=0

@py0xc3
Copy link

py0xc3 commented Apr 15, 2024

No, I don't think the rtkit issue is related to Bluetooth - these denials do not correlate, although I do not know if the rtkit issue causes the condition that then results in the Bluetooth issue. The rtkit issue occurs regularly (and early) but I cannot link any effects immediately to it (I put something dedicated on the rtkit in #1846 ). I still have the rtkit denials on F40, and since they occur regularly, they are contained in many of my logs without being linked to the very case for which I saved the logs.

I have integrated the Bluetooth-specific log extracts with some elaborations into my above posts. See my posts in this ticket of: Sep 24, 2023 , Oct 17, 2023 , Oct 18, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants