Bug 985757

Summary: SELinux is preventing /usr/bin/updatedb from 'unlink' accesses on the file /var/lib/mlocate/mlocate.db.
Product: [Fedora] Fedora Reporter: Jan Sedlák <jsedlak>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: dominick.grift, dwalsh, jsedlak, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:253d12dad9abdbe44212eac7340736f5360f022216ae0dd0f67dfe194509b6a0
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-18 15:24:07 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 Jan Sedlák 2013-07-18 07:56:23 UTC
Description of problem:
SELinux is preventing /usr/bin/updatedb from 'unlink' accesses on the file /var/lib/mlocate/mlocate.db.

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

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

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

If you want to allow updatedb to have unlink access on the mlocate.db file
Then you need to change the label on /var/lib/mlocate/mlocate.db
Do
# semanage fcontext -a -t FILE_TYPE '/var/lib/mlocate/mlocate.db'
where FILE_TYPE is one of the following: locate_var_lib_t. 
Then execute: 
restorecon -v '/var/lib/mlocate/mlocate.db'


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

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

Additional Information:
Source Context                system_u:system_r:locate_t:s0-s0:c0.c1023
Target Context                system_u:object_r:unlabeled_t:s0
Target Objects                /var/lib/mlocate/mlocate.db [ file ]
Source                        updatedb
Source Path                   /usr/bin/updatedb
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           mlocate-0.26-3.fc19.x86_64
Target RPM Packages           mlocate-0.26-3.fc19.x86_64
Policy RPM                    selinux-policy-3.12.1-63.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.9.9-302.fc19.x86_64 #1 SMP Sat
                              Jul 6 13:41:07 UTC 2013 x86_64 x86_64
Alert Count                   3
First Seen                    2013-07-16 11:46:12 CEST
Last Seen                     2013-07-18 03:40:57 CEST
Local ID                      a2d1516c-bb83-4cb7-a6d2-191fbd69b7b6

Raw Audit Messages
type=AVC msg=audit(1374111657.649:659): avc:  denied  { unlink } for  pid=17176 comm="updatedb" name="mlocate.db" dev="dm-2" ino=2366488 scontext=system_u:system_r:locate_t:s0-s0:c0.c1023 tcontext=system_u:object_r:unlabeled_t:s0 tclass=file


type=SYSCALL msg=audit(1374111657.649:659): arch=x86_64 syscall=rename success=no exit=EACCES a0=7f327f0db4e0 a1=7f327e701c99 a2=15 a3=7fff09f236a0 items=0 ppid=17170 pid=17176 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=18 tty=(none) comm=updatedb exe=/usr/bin/updatedb subj=system_u:system_r:locate_t:s0-s0:c0.c1023 key=(null)

Hash: updatedb,locate_t,unlabeled_t,file,unlink

Additional info:
reporter:       libreport-2.1.5
hashmarkername: setroubleshoot
kernel:         3.9.9-302.fc19.x86_64
type:           libreport

Comment 1 Miroslav Grepl 2013-07-18 13:47:47 UTC
*** Bug 985758 has been marked as a duplicate of this bug. ***

Comment 2 Miroslav Grepl 2013-07-18 13:49:46 UTC
What does

# ls -lZ /var/lib/mlocate/mlocate.db

Comment 3 Daniel Walsh 2013-07-18 15:24:07 UTC
Run the restocon command suggested by the alert.

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