RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 902431 - bind-chroot creates /var/named/chroot/etc/localtime with incorrect selinux context
Summary: bind-chroot creates /var/named/chroot/etc/localtime with incorrect selinux co...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: bind
Version: 6.5
Hardware: Unspecified
OS: Linux
medium
low
Target Milestone: rc
: ---
Assignee: Tomáš Hozza
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-01-21 16:37 UTC by Karel Srot
Modified: 2014-10-14 04:34 UTC (History)
4 users (show)

Fixed In Version: bind-9.8.2-0.27.rc1.el6
Doc Type: Bug Fix
Doc Text:
Cause: The /var/named/chroot/etc/localtime was created during the installation of the bind-chroot package, but its SELinux context was not restored. Consequence: As a consequence, the /var/named/chroot/etc/localtime had wrong SELinux context. Fix: The command to restore the SELinux context of /var/named/chroot/etc/localtime after creation has been added into the post transaction section of the SPEC file. Result: As a result, the /var/named/chroot/etc/localtime has now the correct SELinux context after installation of bind-chroot package.
Clone Of:
Environment:
Last Closed: 2014-10-14 04:34:31 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Restore SELinux context on /var/named/chroot/etc/localtime (828 bytes, patch)
2013-04-08 12:02 UTC, Tomáš Hozza
no flags Details | Diff
Restore SELinux context on /var/named/chroot/etc/localtime (828 bytes, patch)
2013-04-08 12:05 UTC, Tomáš Hozza
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1373 0 normal SHIPPED_LIVE bind bug fix and enhancement update 2014-10-14 01:11:10 UTC

Description Karel Srot 2013-01-21 16:37:30 UTC
Description of problem:

Wrong selinux context is probably not causing any issues but I expect there is a reason for having the file to be locale_t.

# ls -Z /var/named/chroot/etc/localtime
-rw-r--r--. root root unconfined_u:object_r:etc_t:s0   /var/named/chroot/etc/localtime
# matchpathcon /var/named/chroot/etc/localtime
/var/named/chroot/etc/localtime	system_u:object_r:locale_t:s0


Version-Release number of selected component (if applicable):
bind-chroot-9.8.2-0.17.rc1.el6.x86_64
selinux-policy-3.7.19-194.el6.noarch


How reproducible:
always,
install bind-chroot and check the selinux context

Comment 1 Milos Malik 2013-01-22 11:03:35 UTC
missing restorecon ?

Comment 2 Miroslav Grepl 2013-01-22 12:47:36 UTC
[mgrepl@rhel6 ~]$ matchpathcon /var/named/chroot/etc/localtime
/var/named/chroot/etc/localtime	system_u:object_r:locale_t:s0

[mgrepl@rhel6 ~]$ rpm -qf /var/named/chroot/etc/localtime
bind-chroot-9.8.2-0.16.rc1.el6.x86_64


It should work.Or did you create it manually?

Comment 3 Karel Srot 2013-01-22 12:58:36 UTC
It is created by rpm postinstall script. Sorry for not mentioning it.

# rpm -q --scripts bind-chroot
postinstall scriptlet (using /bin/sh):
if [ "$1" -gt 0 ]; then
  [ -e /var/named/chroot/dev/random ] || \
    /bin/mknod /var/named/chroot/dev/random c 1 8
  [ -e /var/named/chroot/dev/zero ] || \
    /bin/mknod /var/named/chroot/dev/zero c 1 5
  [ -e /var/named/chroot/dev/null ] || \
    /bin/mknod /var/named/chroot/dev/null c 1 3
  rm -f /var/named/chroot/etc/localtime
  cp /etc/localtime /var/named/chroot/etc/localtime
  if ! grep -q '^ROOTDIR=' /etc/sysconfig/named; then
    echo 'ROOTDIR=/var/named/chroot' >> /etc/sysconfig/named
    /sbin/service named try-restart > /dev/null 2>&1 || :;
  fi
fi;
:;
preuninstall scriptlet (using /bin/sh):
if [ "$1" -eq 0 ]; then
  rm -f /var/named/chroot/dev/{random,zero,null}
  rm -f /var/named/chroot/etc/localtime
  if grep -q '^ROOTDIR=' /etc/sysconfig/named; then
    # NOTE: Do NOT call `service named try-restart` because chroot
    # files will remain mounted.
    START=no
    [ -e /var/lock/subsys/named ] && START=yes
    /sbin/service named stop > /dev/null 2>&1 || :;
    sed -i -e '/^ROOTDIR=.*/d' /etc/sysconfig/named
    if [ "x$START" = xyes ]; then
      /sbin/service named start > /dev/null 2>&1 || :;
    fi
  fi
fi
:;
posttrans scriptlet (using /bin/sh):
if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
  [ -x /sbin/restorecon ] && /sbin/restorecon /var/named/chroot/dev/* > /dev/null 2>&1;
fi;
:;

Comment 4 Tomáš Hozza 2013-04-08 12:02:38 UTC
Created attachment 732658 [details]
Restore SELinux context on /var/named/chroot/etc/localtime

Comment 5 Tomáš Hozza 2013-04-08 12:05:24 UTC
Created attachment 732659 [details]
Restore SELinux context on /var/named/chroot/etc/localtime

Comment 7 RHEL Program Management 2013-10-14 00:04:07 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 15 errata-xmlrpc 2014-10-14 04:34:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1373.html


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