Bug 985757 - SELinux is preventing /usr/bin/updatedb from 'unlink' accesses on the file /var/lib/mlocate/mlocate.db.
SELinux is preventing /usr/bin/updatedb from 'unlink' accesses on the file /v...
Product: Fedora
Classification: Fedora
Component: selinux-policy (Show other bugs)
x86_64 Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Miroslav Grepl
Fedora Extras Quality Assurance
: 985758 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 2013-07-18 03:56 EDT by Jan Sedlák
Modified: 2013-07-18 11:24 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-07-18 11:24:07 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jan Sedlák 2013-07-18 03:56:23 EDT
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.
# /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
# 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.
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 09:47:47 EDT
*** Bug 985758 has been marked as a duplicate of this bug. ***
Comment 2 Miroslav Grepl 2013-07-18 09:49:46 EDT
What does

# ls -lZ /var/lib/mlocate/mlocate.db
Comment 3 Daniel Walsh 2013-07-18 11:24:07 EDT
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.
# /sbin/restorecon -v /var/lib/mlocate/mlocate.db

Note You need to log in before you can comment on or make changes to this bug.