Bug 672980

Summary: SELinux is preventing /usr/bin/python from 'open' accesses on the chr_file 022.
Product: [Fedora] Fedora Reporter: andy york <soylentman>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED CANTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 14CC: dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:0afa61d232a2af6178492f0fd16a207fda36daa6f5fca3aaf43d3b961aef8355
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-03-11 14:48:02 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 andy york 2011-01-26 21:15:26 UTC
SELinux is preventing /usr/bin/python from 'open' accesses on the chr_file 022.

*****  Plugin device (91.4 confidence) suggests  *****************************

If you want to allow python to have open access on the 022 chr_file
Then you need to change the label on 022 to a type of a similar device.
Do
# semanage fcontext -a -t SIMILAR_TYPE '022'
# restorecon -v '022'

*****  Plugin catchall (9.59 confidence) suggests  ***************************

If you believe that python should be allowed open access on the 022 chr_file 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 hpfax /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:hplip_t:s0-s0:c0.c1023
Target Context                system_u:object_r:device_t:s0
Target Objects                022 [ chr_file ]
Source                        hpfax
Source Path                   /usr/bin/python
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           python-2.7-8.fc14.1
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.7-25.fc14
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 2.6.35.10-74.fc14.x86_64 #1
                              SMP Thu Dec 23 16:04:50 UTC 2010 x86_64 x86_64
Alert Count                   1
First Seen                    Wed 26 Jan 2011 01:29:15 PM EST
Last Seen                     Wed 26 Jan 2011 01:29:15 PM EST
Local ID                      86cf98d8-6e70-4e0d-b230-c1723f3ab8f1

Raw Audit Messages
type=AVC msg=audit(1296066555.823:38325): avc:  denied  { open } for  pid=23722 comm="hpfax" name="022" dev=devtmpfs ino=67868 scontext=system_u:system_r:hplip_t:s0-s0:c0.c1023 tcontext=system_u:object_r:device_t:s0 tclass=chr_file

hpfax,hplip_t,device_t,chr_file,open
type=SYSCALL msg=audit(1296066555.823:38325): arch=x86_64 syscall=open success=no exit=EACCES a0=7fffb7c024d0 a1=0 a2=d a3=ff items=0 ppid=23717 pid=23722 auid=4294967295 uid=0 gid=7 euid=0 suid=0 fsuid=0 egid=7 sgid=7 fsgid=7 tty=(none) ses=4294967295 comm=hpfax exe=/usr/bin/python subj=system_u:system_r:hplip_t:s0-s0:c0.c1023 key=(null)
hpfax,hplip_t,device_t,chr_file,open

#============= hplip_t ==============
allow hplip_t device_t:chr_file open;

Comment 1 Daniel Walsh 2011-01-26 21:32:00 UTC
the 022 device under /dev is mislabled

find /dev -name 022

Then run restorecon on the device.

Not sure how the device got created or why it is mislabeled.