Bug 718051

Summary: SELinux is preventing /usr/bin/python from 'write' accesses on the directory /var/tmp.
Product: [Fedora] Fedora Reporter: Eric Blake <eblake>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 14CC: dominick.grift, dwalsh, eric_laura_d, fry.futurateam, mgrepl, rodrigoatique
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:69c1646420ea4e4acc52ab1edda3757072fcf2bd0f5313467b55cbafb2195209
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-10-08 20:12:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Eric Blake 2011-06-30 19:43:32 UTC
SELinux is preventing /usr/bin/python from 'write' accesses on the directory /var/tmp.

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

If you believe that python should be allowed write access on the tmp 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:
# grep xm /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:virsh_t:s0
Target Context                system_u:object_r:tmp_t:s0
Target Objects                /var/tmp [ dir ]
Source                        xm
Source Path                   /usr/bin/python
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           python-2.7-8.fc14.1
Target RPM Packages           filesystem-2.4.35-1.fc14
Policy RPM                    selinux-policy-3.9.7-40.fc14
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 2.6.35.13-92.fc14.x86_64 #1 SMP Sat
                              May 21 17:26:25 UTC 2011 x86_64 x86_64
Alert Count                   10
First Seen                    Fri 10 Jun 2011 10:49:37 PM MDT
Last Seen                     Thu 30 Jun 2011 01:39:56 PM MDT
Local ID                      1d30ce38-f88b-4a68-8355-3876a2f38bb0

Raw Audit Messages
type=AVC msg=audit(1309462796.754:14): avc:  denied  { write } for  pid=2203 comm="xm" name="tmp" dev=dm-1 ino=1558 scontext=system_u:system_r:virsh_t:s0 tcontext=system_u:object_r:tmp_t:s0 tclass=dir


type=SYSCALL msg=audit(1309462796.754:14): arch=x86_64 syscall=open success=no exit=EACCES a0=1e2ae60 a1=200c2 a2=180 a3=1 items=0 ppid=2199 pid=2203 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=xm exe=/usr/bin/python subj=system_u:system_r:virsh_t:s0 key=(null)

Hash: xm,virsh_t,tmp_t,dir,write

audit2allow

#============= virsh_t ==============
#!!!! The source type 'virsh_t' can write to a 'dir' of the following types:
# ssh_home_t, xend_var_lib_t, virt_etc_t, virt_etc_rw_t, virt_image_type, xenfs_t, nfs_t

allow virsh_t tmp_t:dir write;

audit2allow -R

#============= virsh_t ==============
#!!!! The source type 'virsh_t' can write to a 'dir' of the following types:
# ssh_home_t, xend_var_lib_t, virt_etc_t, virt_etc_rw_t, virt_image_type, xenfs_t, nfs_t

allow virsh_t tmp_t:dir write;

Comment 1 Miroslav Grepl 2011-07-01 08:30:25 UTC
Eric,
what were you doing when this happened?

Comment 2 Eric Blake 2011-07-01 14:49:56 UTC
If I recall correctly, I was rebooting the system; so this may be a case of unexpected context being propagated from the libvirt-guests init script.