Bug 738636

Summary: SELinux is preventing /usr/libexec/colord from 'getattr' accesses on the file /var/lib/colord/mapping.db.
Product: [Fedora] Fedora Reporter: m.nemo
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 15CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:8bdc449231251425e6f6a6653bf492a07fe0dc5e2676c171e3b32296cac14e10
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-09-15 13:45:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description m.nemo 2011-09-15 12:56:55 UTC
SELinux is preventing /usr/libexec/colord from 'getattr' accesses on the file /var/lib/colord/mapping.db.

*****  Plugin restorecon (94.8 confidence) suggests  *************************

If you want to fix the label. 
/var/lib/colord/mapping.db default label should be colord_var_lib_t.
Then you can run restorecon.
Do
# /sbin/restorecon -v /var/lib/colord/mapping.db

*****  Plugin catchall_labels (5.21 confidence) suggests  ********************

If you want to allow colord to have getattr access on the mapping.db file
Then you need to change the label on /var/lib/colord/mapping.db
Do
# semanage fcontext -a -t FILE_TYPE '/var/lib/colord/mapping.db'
where FILE_TYPE is one of the following: textrel_shlib_t, colord_tmp_t, rpm_script_tmp_t, system_dbusd_var_lib_t, policykit_auth_exec_t, colord_t, bin_t, cert_t, sosreport_tmp_t, usr_t, rpm_tmp_t, noxattrfs, locale_t, ld_so_cache_t, cupsd_rw_etc_t, etc_t, proc_t, sysfs_t, user_tmpfs_t, system_cronjob_var_lib_t, policykit_var_lib_t, cupsd_etc_t, sysctl_dev_t, abrt_var_run_t, colord_tmpfs_t, hplip_etc_t, dbusd_etc_t, userdomain, user_home_type, sysctl_crypto_t, data_home_t, policykit_reload_t, abrt_t, lib_t, net_conf_t, abrt_helper_exec_t, colord_exec_t, colord_var_lib_t, gconf_home_t, ld_so_t, udev_var_run_t. 
Then execute: 
restorecon -v '/var/lib/colord/mapping.db'


*****  Plugin catchall (1.44 confidence) suggests  ***************************

If you believe that colord should be allowed getattr access on the mapping.db 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 colord /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:colord_t:s0-s0:c0.c1023
Target Context                system_u:object_r:var_lib_t:s0
Target Objects                /var/lib/colord/mapping.db [ file ]
Source                        colord
Source Path                   /usr/libexec/colord
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           colord-0.1.7-1.fc15
Target RPM Packages           colord-0.1.7-1.fc15
Policy RPM                    selinux-policy-3.9.16-38.fc15
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 2.6.40.4-5.fc15.x86_64 #1 SMP Tue
                              Aug 30 14:38:32 UTC 2011 x86_64 x86_64
Alert Count                   5
First Seen                    Thu 15 Sep 2011 12:33:58 PM CEST
Last Seen                     Thu 15 Sep 2011 02:42:04 PM CEST
Local ID                      5d283747-4f6f-48fb-8c65-997b3da5233e

Raw Audit Messages
type=AVC msg=audit(1316090524.755:38): avc:  denied  { getattr } for  pid=1540 comm="colord" path="/var/lib/colord/mapping.db" dev=dm-0 ino=524415 scontext=system_u:system_r:colord_t:s0-s0:c0.c1023 tcontext=system_u:object_r:var_lib_t:s0 tclass=file


type=SYSCALL msg=audit(1316090524.755:38): arch=x86_64 syscall=fstat success=yes exit=0 a0=6 a1=7fff83ce2210 a2=7fff83ce2210 a3=65 items=0 ppid=1 pid=1540 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=colord exe=/usr/libexec/colord subj=system_u:system_r:colord_t:s0-s0:c0.c1023 key=(null)

Hash: colord,colord_t,var_lib_t,file,getattr

audit2allow

#============= colord_t ==============
allow colord_t var_lib_t:file getattr;

audit2allow -R

#============= colord_t ==============
allow colord_t var_lib_t:file getattr;

Comment 1 Daniel Walsh 2011-09-15 13:45:48 UTC
The alert told you what to do, you have a mislabeled directory.

restorecon -R -v /var/lib

Will fix

Comment 2 m.nemo 2011-09-16 08:38:57 UTC
(In reply to comment #1)
> The alert told you what to do, you have a mislabeled directory.
> 
> restorecon -R -v /var/lib
> 
> Will fix

Then, sorry for the noise. 

"If you believe that colord should be allowed getattr access on the mapping.db
file by default.
Then you should report this as a bug."

But seems to be default already ;/

Comment 3 Daniel Walsh 2011-09-16 15:27:38 UTC
But the computer was 94.8% confident it was solution 1 :^)