Bug 757046 - Create a new Linux user mapped in SELinux
Summary: Create a new Linux user mapped in SELinux
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted
Version: 16
Hardware: i386
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-11-25 10:55 UTC by Alessandro Lorenzi
Modified: 2011-11-29 21:09 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-11-29 21:09:34 UTC
Type: ---


Attachments (Terms of Use)

Description Alessandro Lorenzi 2011-11-25 10:55:59 UTC
Description of problem:
The new user is mapped with unconfined_u even if i specify -Z 

Version-Release number of selected component (if applicable):


How reproducible:
create a new user with -Z argument

Steps to Reproduce:
$ useradd -Z user_u foouser
$ su - foouser
$ id -Z
$ semanage login -l
[...]
foouser                  user_u                    s0                       
{this is okkey}

  
Actual results:
$ su - foouser
# id -Z
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

Expected results:
$ su - foouser
# id -Z
user_u:unconfined_r:unconfined_t:s0

Additional info:
--

Comment 1 Daniel Walsh 2011-11-29 03:26:46 UTC
su does not change the selinux label, you have to go through a login program like sshd or login.

If you login that way, do you see the correct context?

Comment 2 Alessandro Lorenzi 2011-11-29 08:10:01 UTC
$ id -Z
user_u:user_r:user_t:s0

with ssh it works... and also loggin in. 

I'm wondering why it doesn't work with "su - "


thanks!
Alessandro

Comment 3 Daniel Walsh 2011-11-29 21:09:34 UTC
Be cause we did not want it to work under su.  We do not have pam_selinux as part of the su pam module.  The reason for this is random system apps and initrc_t script run su, and it can get SELinux confused.  

The only time we set the user context is on initial login to the system.  su and sudo by default do not change the type and role.  sudo does have the ability to change the role if you set it up.


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