Bug 658532

Summary: restorecond doesn't work for user home directories on a server
Product: Red Hat Enterprise Linux 6 Reporter: Chris Adams <linux>
Component: policycoreutilsAssignee: Daniel Walsh <dwalsh>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: dwalsh, mmalik, syeghiay
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 15:29:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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