Bug 1045560

Summary: SELinux is preventing /usr/bin/python2.7 from 'create' accesses on the file strings.pyc.
Product: [Fedora] Fedora Reporter: Michele <marinelli.michele>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED CANTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: crabguyinc, dominick.grift, dwalsh, lvrabec, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:17d85f0974c21f98affb8e7ae86103ebfc31e9b4f6d398baa5402725c3b80b9b
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-06 11:09:09 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 Michele 2013-12-20 18:01:14 UTC
Description of problem:
SELinux is preventing /usr/bin/python2.7 from 'create' accesses on the file strings.pyc.

*****  Plugin catchall_labels (83.8 confidence) suggests   *******************

If you want to allow python2.7 to have create access on the strings.pyc file
Then e' necessario modificare l'etichetta su strings.pyc
Do
# semanage fcontext -a -t TIPO_FILE 'strings.pyc'
dove TIPO_FILE è uno dei seguenti: cupsd_interface_t, cupsd_lock_t, cupsd_log_t, cupsd_rw_etc_t, cupsd_tmp_t, cupsd_var_lib_t, cupsd_var_run_t, krb5_host_rcache_t, print_spool_t. 
Quindi eseguire: 
restorecon -v 'strings.pyc'


*****  Plugin catchall (17.1 confidence) suggests   **************************

If si crede che python2.7 dovrebbe avere possibilità di accesso create sui strings.pyc file in modo predefinito.
Then si dovrebbe riportare il problema come bug.
E' possibile generare un modulo di politica locale per consentire questo accesso.
Do
consentire questo accesso per il momento eseguendo:
# grep python /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:cupsd_t:s0-s0:c0.c1023
Target Context                system_u:object_r:usr_t:s0
Target Objects                strings.pyc [ file ]
Source                        python
Source Path                   /usr/bin/python2.7
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           python-2.7.5-9.fc20.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-106.fc20.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.11.10-301.fc20.x86_64 #1 SMP Thu
                              Dec 5 14:01:17 UTC 2013 x86_64 x86_64
Alert Count                   46
First Seen                    2013-12-20 18:42:48 CET
Last Seen                     2013-12-20 18:42:49 CET
Local ID                      cf9bd37c-1caa-41c3-9f6b-f56cf53f1e41

Raw Audit Messages
type=AVC msg=audit(1387561369.896:904): avc:  denied  { create } for  pid=18787 comm="python" name="strings.pyc" scontext=system_u:system_r:cupsd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:usr_t:s0 tclass=file


type=SYSCALL msg=audit(1387561369.896:904): arch=x86_64 syscall=open success=no exit=EACCES a0=14418b0 a1=2c1 a2=81a4 a3=10 items=0 ppid=18786 pid=18787 auid=4294967295 uid=0 gid=7 euid=0 suid=0 fsuid=0 egid=7 sgid=7 fsgid=7 ses=4294967295 tty=(none) comm=python exe=/usr/bin/python2.7 subj=system_u:system_r:cupsd_t:s0-s0:c0.c1023 key=(null)

Hash: python,cupsd_t,usr_t,file,create

Additional info:
reporter:       libreport-2.1.9
hashmarkername: setroubleshoot
kernel:         3.11.10-301.fc20.x86_64
type:           libreport

Potential duplicate: bug 982203

Comment 1 Stevan J Landon 2013-12-27 16:21:11 UTC
Description of problem:
I was installing drivers for and using a HP Deskjet 1056. I tried to print and got an error message.

Additional info:
reporter:       libreport-2.1.10
hashmarkername: setroubleshoot
kernel:         3.12.5-302.fc20.x86_64
type:           libreport

Comment 2 Daniel Walsh 2014-01-03 19:23:49 UTC
This is python trying to compile the strings.py file into a strings.pyc,  Could you just run python on this file, probably under /usr/lib/ or /usr/lib64, then the error will no longer happen.