Bug 412411 - selinux module changes take ages and give genhomedircon errors
Summary: selinux module changes take ages and give genhomedircon errors
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: policycoreutils   
(Show other bugs)
Version: 5.1
Hardware: All
OS: Linux
Target Milestone: ---
: ---
Assignee: Daniel Walsh
QA Contact: Ben Levenson
Depends On:
TreeView+ depends on / blocked
Reported: 2007-12-05 16:56 UTC by Michael Young
Modified: 2009-09-03 13:56 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-01-20 22:00:28 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2009:0206 normal SHIPPED_LIVE policycoreutils bug fix update 2009-01-20 16:06:12 UTC

Description Michael Young 2007-12-05 16:56:31 UTC
The bug below also exists in policycoreutils-1.33.12-12.el5 on CentOS 5 (and
presumably therefore RHEL5 as well).

+++ This bug was initially created as a clone of Bug #247117 +++

Whenever I use semodule to add or remove a module or update some selinux
packages I get a lot of errors like
*username* homedir /home/*servername*/misc/*username* or its parent directory
conflicts with a
defined context in /etc/selinux/targeted/contexts/files/file_contexts,
/usr/sbin/genhomedircon will not create a new context. This usually indicates an
incorrectly defined system account.  If it is a system account please make sure
its login shell is /sbin/nologin.

We have a lot of home directories of the form /home/server/misc/user and it
seems that the problem is that genhomedircon is comparing each with the /misc
line in /etc/selinux/targeted/contexts/files/file_contexts and deciding they
match and thus produces an error. I believe the problem is that in the 
checkExists subroutine of genhomedircon the line
if re.search(regex,home, 0):
causes a match if regex fits any substring of "home". I believe you actually want
if re.match(regex,home):
so that it matches from the beginning of the string.

I have seen this with a number of versions of policycoreutils, including the
current one: policycoreutils-2.0.16-6.fc7

-- Additional comment from m.a.young@durham.ac.uk on 2007-07-05 10:47 EST --
Created an attachment (id=158595)
Suggested patch for genhomedircon

-- Additional comment from dwalsh@redhat.com on 2007-07-06 10:24 EST --
Fixed in policycoreutils-2.0.22-4.fc8

Comment 1 Daniel Walsh 2008-09-17 19:58:19 UTC
Fixed in policycoreutils-1.33.12-14.1.el5

Comment 2 RHEL Product and Program Management 2008-09-17 20:24:55 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update

Comment 7 errata-xmlrpc 2009-01-20 22:00:28 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


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