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 658532 - restorecond doesn't work for user home directories on a server
Summary: restorecond doesn't work for user home directories on a server
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: policycoreutils
Version: 6.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Daniel Walsh
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-11-30 16:33 UTC by Chris Adams
Modified: 2020-10-05 09:07 UTC (History)
3 users (show)

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


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1637 0 normal SHIPPED_LIVE policycoreutils bug fix and enhancement update 2011-12-06 00:50:40 UTC

Description Chris Adams 2010-11-30 16:33:17 UTC
With RHEL 6, restorecond requires a "-u" option to manage files in user home directories.  The init script doesn't support setting this option, and it appears that the option is only intended to work when run from a desktop login session manager, not a network login (such as ssh).

How are directories (such as public_html and .ssh) supposed to get the proper labels on a server now?

Comment 1 Daniel Walsh 2010-11-30 16:48:25 UTC
You can add 

~/*
~/public_html/*
~/.ssh/*


To /etc/selinux/restorecond.conf

And run the restorecond as a service and it will watch for those files/directories as they are created.

Or the admin/user can run restorecon them selves.


I have thought about running restorecond as a user session via bashrc, but I have the problem of cleaning up the process when the user logs out.

Imagine a user logging into the same machine twice, and logging out.

Comment 3 Chris Adams 2010-11-30 18:59:23 UTC
Ahh, I didn't realize it still supported ~/foo in the main conf (I thought -u was in place of that).

However, it doesn't seem to be working for me.  Running "restorecond -d" under strace, when I create ~/public_html, I see restorecond get the inotify message.  It lstat()s it, lgetxattr()s it (which shows user_home_t), and then goes back to waiting for inotify messages.  It doesn't change the context of public_html.  I added the following to /etc/selinux/restorecond.conf:

~/*
~/public_html/*
~/.ssh/*

I understand how much "fun" it can be to run things for shell users (with no actual session manager).  Maybe a PAM session module that signaled the system daemon (which would then work for SSH, FTP, telnet, getty logins, etc.) could work.

Comment 4 Daniel Walsh 2010-12-22 20:23:28 UTC
I think I have this fixed in Rawhide.   After I check it out for a couple of weeks I will back port it to RHEL6.

Comment 5 Suzanne Logcher 2011-02-15 21:45:55 UTC
This issue was proposed for RHEL 6.1 FasTrack but did not get resolved in time.
It has been moved to RHEL 6.2 FasTrack.

Comment 6 Daniel Walsh 2011-03-15 16:20:25 UTC
Fixed in policycoreutils-2.0.83-33.3.el6

Comment 11 errata-xmlrpc 2011-12-06 15:29:13 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-2011-1637.html


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