Bug 517452 - setroubleshoot: SELinux is preventing tzdata-update (tzdata_t) "unlink" to /etc/localtime (etc_t).
Summary: setroubleshoot: SELinux is preventing tzdata-update (tzdata_t) "unlink" ...
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: rawhide
Hardware: i386
OS: Linux
low
medium
Target Milestone: ---
Assignee: Daniel Walsh
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: setroubleshoot_trace_hash:d8adc4f4b5a...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-08-14 06:46 UTC by Vladimir Ermakov
Modified: 2009-08-14 13:22 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-08-14 13:22:30 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Vladimir Ermakov 2009-08-14 06:46:17 UTC
The following was filed automatically by setroubleshoot:

Summary:

SELinux is preventing tzdata-update (tzdata_t) "unlink" to /etc/localtime
(etc_t).

Detailed Description:

SELinux is preventing tzdata-update (tzdata_t) "unlink" to /etc/localtime
(etc_t). The SELinux type etc_t, is a generic type for all files in the
directory and very few processes (SELinux Domains) are allowed to write to this
SELinux type. This type of denial usual indicates a mislabeled file. By default
a file created in a directory has the gets the context of the parent directory,
but SELinux policy has rules about the creation of directories, that say if a
process running in one SELinux Domain (D1) creates a file in a directory with a
particular SELinux File Context (F1) the file gets a different File Context
(F2). The policy usually allows the SELinux Domain (D1) the ability to write,
unlink, and append on (F2). But if for some reason a file (/etc/localtime) was
created with the wrong context, this domain will be denied. The usual solution
to this problem is to reset the file context on the target file, restorecon -v
'/etc/localtime'. If the file context does not change from etc_t, then this is
probably a bug in policy. Please file a bug report
(http://bugzilla.redhat.com/bugzilla/enter_bug.cgi) against the selinux-policy
package. If it does change, you can try your application again to see if it
works. The file context could have been mislabeled by editing the file or moving
the file from a different directory, if the file keeps getting mislabeled, check
the init scripts to see if they are doing something to mislabel the file.

Allowing Access:

You can attempt to fix file context by executing restorecon -v '/etc/localtime'

Fix Command:

restorecon '/etc/localtime'

Additional Information:

Source Context                unconfined_u:system_r:tzdata_t:s0-s0:c0.c1023
Target Context                unconfined_u:object_r:etc_t:s0
Target Objects                /etc/localtime [ lnk_file ]
Source                        tzdata-update
Source Path                   /usr/sbin/tzdata-update
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           glibc-common-2.10.1-2
Target RPM Packages           glibc-2.10.1-2
Policy RPM                    selinux-policy-3.6.12-69.fc11
Selinux Enabled               True
Policy Type                   targeted
MLS Enabled                   True
Enforcing Mode                Enforcing
Plugin Name                   mislabeled_file
Host Name                     (removed)
Platform                      Linux (removed)
                              2.6.29.6-217.2.3.fc11.i586 #1 SMP Wed Jul 29
                              15:46:46 EDT 2009 i686 i686
Alert Count                   2
First Seen                    Tue 11 Aug 2009 07:55:41 PM MSD
Last Seen                     Tue 11 Aug 2009 07:55:41 PM MSD
Local ID                      e919f436-88ea-4525-a6d2-e554d1f2b7a2
Line Numbers                  

Raw Audit Messages            

node=(removed) type=AVC msg=audit(1250006141.341:92): avc:  denied  { unlink } for  pid=19641 comm="tzdata-update" name="localtime" dev=dm-0 ino=55046 scontext=unconfined_u:system_r:tzdata_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:etc_t:s0 tclass=lnk_file

node=(removed) type=SYSCALL msg=audit(1250006141.341:92): arch=40000003 syscall=38 success=no exit=-13 a0=bfba6ec0 a1=80488cf a2=0 a3=3 items=0 ppid=19571 pid=19641 auid=500 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="tzdata-update" exe="/usr/sbin/tzdata-update" subj=unconfined_u:system_r:tzdata_t:s0-s0:c0.c1023 key=(null)


audit2allow suggests:

#============= tzdata_t ==============
allow tzdata_t etc_t:lnk_file unlink;

Comment 1 Miroslav Grepl 2009-08-14 10:53:39 UTC
This is a mislabeled /etc/localtime 

Try to run what setroubleshoot suggests

# restorecon '/etc/localtime'

Comment 2 Daniel Walsh 2009-08-14 13:03:11 UTC
Vladimor, any idea how it got mislabeled?  Did you run some tool to change the timezone?

Comment 3 Vladimir Ermakov 2009-08-14 13:10:06 UTC
# restorecon '/etc/localtime' 
Can't stat directory "/home/venom/.gvfs", Permission denied.

Comment 4 Daniel Walsh 2009-08-14 13:22:30 UTC
Ignore the .gvfs error,  the /etc/localtime file now has the correct label.

If you update to the latest policycoreutils package restorecon will not print an error on .gvfs.

Unless you can identify how the /etc/localtime file got mislabeled, I am going to close this bug as WORKSFORME.

Potential ways this got mislabeled would be, if someone changed the file using a tool that we did not know about. Changing via the clock applet should not cause it to become mislabeled.  Potentially something within a yum update could have caused it also.

You could use the restorecond service to make sure this does not happen again.


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