Bug 863483 - Bad SELinux label of passwd file when preparing chroot env using yum
Bad SELinux label of passwd file when preparing chroot env using yum
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: rpm (Show other bugs)
6.3
Unspecified Linux
unspecified Severity unspecified
: rc
: ---
Assigned To: packaging-team-maint
BaseOS QE Security Team
: SELinux
Depends On:
Blocks: 810905
  Show dependency treegraph
 
Reported: 2012-10-05 11:04 EDT by Martin Bukatovic
Modified: 2014-12-15 07:57 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-12-15 07:57:13 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Martin Bukatovic 2012-10-05 11:04:25 EDT
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 Product and Program Management 2012-12-14 03:12:41 EST
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 07:57:13 EST
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.