Bug 1940183

Summary: SELinux is preventing spice-vdagentd from 'watch' accesses on the directory /run/systemd/sessions.
Product: [Fedora] Fedora Reporter: Stanislav Kontar <skontar>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 34CC: dwalsh, grepl.miroslav, lvrabec, mmalik, omosnace, plautrba, vmojzis, zpytela
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:f43fb42a8d41ed08bf1a27a935b39ce3496afa26acc4ced28115a66377b0da74;VARIANT_ID=workstation;
Fixed In Version: selinux-policy-3.14.7-28.fc34 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-03-29 00:17:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stanislav Kontar 2021-03-17 18:38:06 UTC
Description of problem:
Clean install of Fedora 34 latest compose or Fedora Rawhide. SELinux prevents spice-vdagent from working, so for example guest resolution is not automatically changed to match the virtual screen size.
SELinux is preventing spice-vdagentd from 'watch' accesses on the directory /run/systemd/sessions.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that spice-vdagentd should be allowed watch access on the sessions directory by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'spice-vdagentd' --raw | audit2allow -M my-spicevdagentd
# semodule -X 300 -i my-spicevdagentd.pp

Additional Information:
Source Context                system_u:system_r:vdagent_t:s0
Target Context                system_u:object_r:systemd_logind_sessions_t:s0
Target Objects                /run/systemd/sessions [ dir ]
Source                        spice-vdagentd
Source Path                   spice-vdagentd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-3.14.8-6.fc35.noarch
Local Policy RPM              selinux-policy-targeted-3.14.8-6.fc35.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 5.12.0-0.rc3.170.fc35.x86_64 #1
                              SMP Mon Mar 15 16:25:09 UTC 2021 x86_64 x86_64
Alert Count                   2
First Seen                    2021-03-17 19:25:37 CET
Last Seen                     2021-03-17 19:28:03 CET
Local ID                      9931a884-3cd5-4193-84c5-82612bd2d13a

Raw Audit Messages
type=AVC msg=audit(1616005683.987:589): avc:  denied  { watch } for  pid=2369 comm="spice-vdagentd" path="/run/systemd/sessions" dev="tmpfs" ino=66 scontext=system_u:system_r:vdagent_t:s0 tcontext=system_u:object_r:systemd_logind_sessions_t:s0 tclass=dir permissive=1


Hash: spice-vdagentd,vdagent_t,systemd_logind_sessions_t,dir,watch

Version-Release number of selected component:
selinux-policy-targeted-3.14.8-6.fc35.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.14.0
hashmarkername: setroubleshoot
kernel:         5.12.0-0.rc3.170.fc35.x86_64
type:           libreport

Comment 1 Zdenek Pytela 2021-03-17 18:53:13 UTC
I've submitted a Fedora PR to address the issue:
https://github.com/fedora-selinux/selinux-policy/pull/647

Comment 2 Fedora Update System 2021-03-24 18:03:07 UTC
FEDORA-2021-68c09eb43f has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-68c09eb43f

Comment 3 Fedora Update System 2021-03-25 01:24:33 UTC
FEDORA-2021-68c09eb43f has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-68c09eb43f`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-68c09eb43f

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 4 Fedora Update System 2021-03-27 02:01:16 UTC
FEDORA-2021-15b81d905c has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-15b81d905c`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-15b81d905c

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2021-03-29 00:17:08 UTC
FEDORA-2021-15b81d905c has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.