Bug 1000813

Summary: SELinux is preventing /usr/bin/qemu-system-x86_64 from 'read' accesses on the file mounts.cfg.
Product: [Fedora] Fedora Reporter: Michael S. <misc>
Component: libvirt-sandboxAssignee: Daniel Berrangé <berrange>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: berrange, crobinso, dominick.grift, dwalsh, luto, lvrabec, mgrepl, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:6a07217ccec9766fd47a8c5a7df0a9592b005cd9310e1e9dc419284ff6f3fd08
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-17 16:54:50 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 Michael S. 2013-08-25 15:26:05 UTC
Description of problem:
I tried to run virt-sandbox -c qemu:///session /bin/sh  
while having a confinged user in staff_u 
SELinux is preventing /usr/bin/qemu-system-x86_64 from 'read' accesses on the file mounts.cfg.

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

If vous pensez que qemu-system-x86_64 devrait être autorisé à accéder read sur mounts.cfg file par défaut.
Then vous devriez rapporter ceci en tant qu'anomalie.
Vous pouvez générer un module de stratégie local pour autoriser cet accès.
Do
autoriser cet accès pour le moment en exécutant :
# grep pool /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                staff_u:staff_r:svirt_t:s0:c336,c783
Target Context                staff_u:object_r:virt_home_t:s0
Target Objects                mounts.cfg [ file ]
Source                        pool
Source Path                   /usr/bin/qemu-system-x86_64
Port                          <Inconnu>
Host                          (removed)
Source RPM Packages           qemu-system-x86-1.4.2-7.fc19.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-71.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 3.10.6-200.fc19.x86_64 #1 SMP Mon
                              Aug 12 14:49:42 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-08-25 17:23:49 CEST
Last Seen                     2013-08-25 17:23:49 CEST
Local ID                      4b1fdf76-b292-4d14-beb8-2592e56df53e

Raw Audit Messages
type=AVC msg=audit(1377444229.583:7183): avc:  denied  { read } for  pid=18288 comm="pool" name="mounts.cfg" dev="dm-3" ino=3948003 scontext=staff_u:staff_r:svirt_t:s0:c336,c783 tcontext=staff_u:object_r:virt_home_t:s0 tclass=file


type=SYSCALL msg=audit(1377444229.583:7183): arch=x86_64 syscall=open success=yes exit=EILSEQ a0=7f850c12ae30 a1=0 a2=7f850c12ae6d a3=c items=0 ppid=1 pid=18288 auid=500 uid=500 gid=500 euid=500 suid=500 fsuid=500 egid=500 sgid=500 fsgid=500 ses=1 tty=(none) comm=pool exe=/usr/bin/qemu-system-x86_64 subj=staff_u:staff_r:svirt_t:s0:c336,c783 key=(null)

Hash: pool,svirt_t,virt_home_t,file,read

Additional info:
reporter:       libreport-2.1.6
hashmarkername: setroubleshoot
kernel:         3.10.6-200.fc19.x86_64
type:           libreport

Comment 1 Daniel Walsh 2013-08-26 19:43:44 UTC
libvirt-sandbox should not be launching these processes as svirt_t, unless they are truly virtual machines.

Comment 2 Daniel Walsh 2013-08-28 15:28:07 UTC
Maybe we should launch all libvirt-sandbox processes as svirt_lxc_net_t, since they are going to need more access then svirt_t. Or I add a new type svirt_qemu_net_t, with close to the same policy.

Comment 3 Daniel Berrangé 2013-08-28 15:30:13 UTC
Yes, we need a svirt_qemu_net_t which extends svirt_t with the broader file read permissions from svirt_lxc_net_t.

Comment 4 Daniel Walsh 2013-08-28 15:50:39 UTC
477fa6894e2ed67512a4041a58fe6b858acd6573 adds svirt_qemu_net_t which is pretty much equivalent to svirt_lxc_net_t, one thing I have not changed is svirt_lxc_file_t to something like svirt_sandbox_file_t.  

It would make sense to change this, since we could then share the file type between the policies.

Do you agree with this change?

Comment 5 Daniel Berrangé 2013-08-28 15:59:46 UTC
Having a common file type makes sense, but would renaming it cause upgrade problems ? It is possible to rename it, and keep a svirt_lxc_file_t type as an alias for svirt_sandbox_file_t for compatibility ?

Comment 6 Daniel Walsh 2013-08-28 19:55:56 UTC
Yes.

svirt_sandbox_file_t it is.
Should be in selinux-policy-3.12.1-74.fc20

Comment 7 Daniel Berrangé 2013-10-01 15:29:56 UTC
*** Bug 980542 has been marked as a duplicate of this bug. ***

Comment 8 Andy Lutomirski 2014-06-10 22:45:17 UTC
Is this fixed?  I still have exactly this problem.

Comment 9 Fedora End Of Life 2015-01-09 19:35:21 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 10 Fedora End Of Life 2015-02-17 16:54:50 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.