Bug 1127162 - Corporate users get wrong selinux contexts for home directory
Summary: Corporate users get wrong selinux contexts for home directory
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: oddjob
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Nalin Dahyabhai
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-06 10:07 UTC by birger
Modified: 2015-12-02 16:11 UTC (History)
11 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-12-02 03:21:26 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description birger 2014-08-06 10:07:05 UTC
Description of problem:
When I create corporate users they get a home directory of the form /home/<domain>/<username> (using gnome user manager, sssd and realmd)

in this case the /home/<domain> gets selinux context as a home directory, and the users home directories as if they are content in a home directory. I discovered this since it kills icedtea-web because of wrong labeling of the .cache dir.

Version-Release number of selected component (if applicable):
selinux-policy-targeted-3.13.1-71.fc21.noarch

How reproducible:
always

Steps to Reproduce:
1. create a corporate (Active Directory in my case) user
2.
3.

Actual results:
home directory with wrong context

Expected results:
home directopry and subdirectories with correct context

Additional info:
restorecon does nothing to fix this problem unless the rules are fixed.

Comment 1 Daniel Walsh 2014-08-06 14:40:12 UTC
Does

semanage fcontext -a -e /home /home/<DOMAIN>
restorecon -R -v /home/

Fix your problem?

Comment 2 birger 2014-08-07 07:20:23 UTC
That seems to help a lot. What component is responsible for creating the <DOMAIN> directory? I guess this bug should get reassigned there.

Comment 3 Daniel Walsh 2014-08-18 13:04:14 UTC
sssd?

Comment 4 Stephen Gallagher 2014-08-18 13:07:10 UTC
Sounds more likely that the user doesn't have pam_oddjob_mkhomedir installed and is instead using pam_mkhomedir, which is known to be broken with SELinux.

Comment 5 Jakub Hrozek 2014-08-19 09:33:25 UTC
I agree, we don't /create/ the directories, we just tell the system what the directory is. The creation of the directory is a job for mkhomedir or oddjob.

birger, can you check your PAM stack for mkhomedir/oddjob and preferably use the latter?

Comment 6 birger 2014-08-21 08:27:30 UTC
[root@sch-lf-02899 pam.d]# grep -i oddjob *
fingerprint-auth:session     optional      pam_oddjob_mkhomedir.so umask=0077
fingerprint-auth-ac:session     optional      pam_oddjob_mkhomedir.so umask=0077
password-auth:session     optional      pam_oddjob_mkhomedir.so umask=0077
password-auth-ac:session     optional      pam_oddjob_mkhomedir.so umask=0077
smartcard-auth:session     optional      pam_oddjob_mkhomedir.so umask=0077
smartcard-auth-ac:session     optional      pam_oddjob_mkhomedir.so umask=0077
system-auth:session     optional      pam_oddjob_mkhomedir.so umask=0077
system-auth-ac:session     optional      pam_oddjob_mkhomedir.so umask=0077

so it seems like I am already using oddjob?

Comment 7 Jakub Hrozek 2014-08-21 09:44:48 UTC
Nalin, do you know how to best debug the problem further?

Comment 8 Nalin Dahyabhai 2014-08-21 12:07:51 UTC
It looks like /home/<DOMAIN> is being created when the user's home directory is supposed to be under it, which is good.  So on a clean system, run the first command from comment #1 before the /home/<DOMAIN> directory is created, then log in as such a user.  If /home/<DOMAIN> is created with the correct label, then the problem appears to be that nothing's updating the local file contexts configuration automatically.  If the directory isn't created, or is created with a label that's not consistent with the policy at the time it's created, then it's a bug in oddjob's mkhomedir helper.

Comment 9 Daniel Walsh 2014-08-21 12:14:11 UTC
Not a real good fix for this problem.  oddjob_mkhomedircon could execute the equivalent of 

semanage fcontext -e /home /home/DOMAIN 

Before creating the directory, would probably be the best solution.  Preventing a restorecon -R -v /home from screwing up the labeling.

Comment 10 Simo Sorce 2014-08-21 12:24:27 UTC
(In reply to Daniel Walsh from comment #9)
> Not a real good fix for this problem.  oddjob_mkhomedircon could execute the
> equivalent of 
> 
> semanage fcontext -e /home /home/DOMAIN 

should sssd do this when it knows it is going to admit a user that has such a home directory ?

> Before creating the directory, would probably be the best solution. 
> Preventing a restorecon -R -v /home from screwing up the labeling.

or should oddjob_mkhomedir automatically perform the above command every time it creates "middle" path components ?

Comment 11 Daniel Walsh 2014-08-21 12:34:08 UTC
Either way, we need a priv process to create this link to make sure the labeling stays consistent.

Comment 12 Fedora End Of Life 2015-11-04 15:14:38 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. 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 EOL if it remains open with a Fedora  'version'
of '21'.

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.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 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, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

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.

Comment 13 Fedora End Of Life 2015-12-02 03:21:32 UTC
Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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