Bug 511209

Summary: Adding a new user with a non-standard home directory produces incorrect policies
Product: [Fedora] Fedora Reporter: Jón Fairbairn <jon.fairbairn>
Component: libsemanageAssignee: Daniel Walsh <dwalsh>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 11CC: dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-06-28 13:37:08 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 Jón Fairbairn 2009-07-14 08:39:28 UTC
Description of problem:

When installing fedora 11 on a system that had run fedora 9
I kept the home directories (which were in two partitions,
mounted on /home and /home2) from the fedora 9 system. I then used 

groupadd -g $n $user
useradd -M -d /home{,2}/$user -g $user -u $n1 $user

to create each user that had existed on the fedora 9 system,
with the same uid, gid and homedir as before. I did it this
way in the hope that (among other things) it would make the
correct alterations to selinux policies. There was only one
user "aph" with a /home2 directory.

Somewhere along the line,
/etc/selinux/targeted/contexts/files/file_contexts.homedirs
acquired lines like this one:

/home2/aph/[^/]*/\.ssh(/.*)?    unconfined_u:object_r:home_ssh_t:s0

which is clearly wrong!  It should either be

/home2/aph/\.ssh(/.*)?    unconfined_u:object_r:home_ssh_t:s0

or

/home2/[^/]*/\.ssh(/.*)?    unconfined_u:object_r:home_ssh_t:s0

I'm not sure what part of the process of installation/user
addition makes these changes, so I've had no luck
reproducing them, although my attempts haven't produced
correct behaviour either. Current attempts to add users with
home directories in /home2 (or even a new /home3) don't add
any lines to the homedirs contexts file, so home directories
get created with entirely the wrong selinux context.


Version-Release number of selected component (if applicable):
Currently
selinux-policy-targeted-3.6.12-62.fc11.noarch
though that might have been updated since I added the users.

Since I don't know what's supposed to be responsible for altering the policy, I'm not sure that that's the right component.

How reproducible:
Hard to say (see above)

Steps to Reproduce:
1.
2.
3.
  
Actual results:
See above

Expected results:
See above

Additional info:

I can obviously (and will) edit
/etc/selinux/targeted/contexts/files/file_contexts.homedirs
to work around the problem, but you'll have to tell me what
to do to test the thing properly.

Comment 1 Daniel Walsh 2009-07-14 16:06:00 UTC
What does the entry in /etc/passwd look like?

Comment 2 Jón Fairbairn 2009-07-14 16:15:05 UTC
Unexciting:
aph:x:1024:1024::/home2/aph/:/bin/bash

Comment 3 Daniel Walsh 2009-07-14 19:14:36 UTC
That final / is probably screwing up the tools.  If you change
 /home2/aph/

to 

/home2/aph

Run 

genhomedircon

See if the context is correct.

Comment 4 Jón Fairbairn 2009-07-14 19:28:04 UTC
That looks like it was the problem, thanks.

Given that command completion puts the slash on (and apart from a few rather nasty command-line syntaxes foo/ is equivalent to foo), I reckon the tools ought to be adjusted to cope.

I think selinux is worth the effort, but I suspect that quite a lot of people give up and turn it off after hitting one or two snags like this.

Comment 5 Daniel Walsh 2009-07-15 13:19:50 UTC
I agree this is a bug in the tool.  Taking a quick look at the library it looks like it should have handled it, but I will take a closer look.

Comment 6 Bug Zapper 2010-04-27 15:39:57 UTC
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  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 '11'.

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 11'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 11 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: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 7 Bug Zapper 2010-06-28 13:37:08 UTC
Fedora 11 changed to end-of-life (EOL) status on 2010-06-25. Fedora 11 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.

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