Bug 456870 - avc denial when preinstall scriptlet runs useradd
avc denial when preinstall scriptlet runs useradd
Product: Fedora
Classification: Fedora
Component: qpidc (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Alan Conway
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-07-28 07:08 EDT by David Juran
Modified: 2009-06-10 09:24 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-06-10 09:24:52 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 David Juran 2008-07-28 07:08:33 EDT
Description of problem:
When installing qpidc with selinux enabled, I get an avc denial when useradd,
run from the preinstall scriptlet, tries to create /var/lib/qpidd. I guess the
cure would be to drop the "-m"  flag in the preinstall scriptlet and instead add
/var/lib/qpidd to the rpm itself.

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

How reproducible:
Every time

Steps to Reproduce:
1. yum install qpidc
Actual results:

The following is the avc denial that pops up:

SELinux is preventing useradd (useradd_t) "write" to ./lib (var_lib_t).

Detailed Description:

SELinux is preventing useradd (useradd_t) "write" to ./lib (var_lib_t). The
SELinux type var_lib_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 (./lib) 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 './lib'.
If the file context does not change from var_lib_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 './lib'

Fix Command:

restorecon './lib'

Additional Information:

Source Context                unconfined_u:system_r:useradd_t:SystemLow-
Target Context                system_u:object_r:var_lib_t
Target Objects                ./lib [ dir ]
Source                        useradd
Source Path                   /usr/sbin/useradd
Port                          <Unknown>
Host                          localhost.localdomain
Source RPM Packages           shadow-utils-4.1.1-2.fc9
Target RPM Packages           filesystem-2.4.13-1.fc9
Policy RPM                    selinux-policy-3.3.1-79.fc9
Selinux Enabled               True
Policy Type                   targeted
MLS Enabled                   True
Enforcing Mode                Enforcing
Plugin Name                   mislabeled_file
Host Name                     localhost.localdomain
Platform                      Linux localhost.localdomain
                     #1 SMP Mon Jul 21 01:09:10
                              EDT 2008 x86_64 x86_64
Alert Count                   1
First Seen                    Mon 28 Jul 2008 01:44:50 PM EEST
Last Seen                     Mon 28 Jul 2008 01:44:50 PM EEST
Local ID                      73bb2567-724c-4dd9-9498-68aec0a05a45
Line Numbers                  

Raw Audit Messages            

host=localhost.localdomain type=AVC msg=audit(1217241890.514:188): avc:  denied
 { write } for  pid=15795 comm="useradd" name="lib" dev=dm-3 ino=688130
tcontext=system_u:object_r:var_lib_t:s0 tclass=dir

host=localhost.localdomain type=SYSCALL msg=audit(1217241890.514:188):
arch=c000003e syscall=83 success=no exit=-13 a0=7fff5eed693e a1=0 a2=41
a3=7fff5eed49c0 items=0 ppid=15787 pid=15795 auid=500 uid=0 gid=0 euid=0 suid=0
fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=1 comm="useradd"
exe="/usr/sbin/useradd" subj=unconfined_u:system_r:useradd_t:s0-s0:c0.c1023

Additional info:
Similar issue with qpidc-0.2.667603-1.el5 on RHEL5.
Comment 1 Bug Zapper 2009-06-09 22:16:22 EDT
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '9'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
Comment 2 Alan Conway 2009-06-10 08:39:37 EDT
This is fixed in 0:0.5.752600-5.fc10, I believe it was fixed some time ago but don't know the exact version.

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