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 863483 - Bad SELinux label of passwd file when preparing chroot env using yum
Summary: Bad SELinux label of passwd file when preparing chroot env using yum
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: rpm
Version: 6.3
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Packaging Maintenance Team
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks: 810905
TreeView+ depends on / blocked
 
Reported: 2012-10-05 15:04 UTC by Martin Bukatovic
Modified: 2014-12-15 12:57 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-12-15 12:57:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Martin Bukatovic 2012-10-05 15:04:25 UTC
Description of problem:

The passwd file has been assigned wrong selinux label when preparing chroot
enviroment for apache using yum --installroot.

Version-Release number of selected component (if applicable):

# rpm -q yum setup redhat-release-server httpd
yum-3.2.29-30.el6.noarch
setup-2.8.14-16.el6.noarch
redhat-release-server-6Server-6.3.0.3.el6.i686
httpd-2.2.15-15.el6_2.1.i686

Steps to Reproduce:

1. create chroot dir
   mkdir -p /var/tmp/chroot/foobar
2. initialize rpm db there
   mkdir -p /var/tmp/chroot/foobar/var/lib/rpm
   rpm --root /var/tmp/chroot/foobar --initdb
3. install rhel release in chroot
   yumdownloader --destdir=/var/tmp redhat-release-server
   rpm --root /var/tmp/chroot/foobar -ivh --nodeps /var/tmp/redhat-release*rpm
4. install httpd package
   yum --installroot=/var/tmp/chroot/foobar -y install httpd

Actual results:

# ls -lZ /var/tmp/chroot/foobar/etc/passwd
-rw-r--r--. root root unconfined_u:object_r:shadow_t:s0 /var/tmp/chroot/foobar/etc/passwd

Expected results:

# ls -lZ /var/tmp/chroot/foobar/etc/passwd
-rw-r--r--. root root system_u:object_r:etc_t:s0  /var/tmp/chroot/foobar/etc/passwd

Additional info:

Since file /etc/passwd is located in setup package:

# rpm -qf /etc/passwd
setup-2.8.14-16.el6.noarch

I tried to install just setup package in the chroot env (steps are the same,
just installing setup package instead of httpd) and selinux context was set
right. Nevertheless when I additionally installed httpd, the label was broken
again.

When I install httpd normally (without --installroot), label is also ok.

Comment 2 RHEL Program Management 2012-12-14 08:12:41 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 3 Florian Festi 2014-12-15 12:57:13 UTC
For me this looks like the selinux policy is missing in the chroot and is though not honoured during the execution of the scriptlets (which execute adduser). RPM has special code to deal with selinux under this situation but the OS has not.

Installing the selinux policy in the chroot might fix this. Even if not rpm won't be able to fix the way SELinux works within a chroot. I close this for now as NOTABUG.


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