Bug 1645047

Summary: sssd only sets the SELinux login context if it differs from the default [rhel-7.6.z]
Product: Red Hat Enterprise Linux 7 Reporter: Oneata Mircea Teodor <toneata>
Component: sssdAssignee: SSSD Maintainers <sssd-maint>
Status: CLOSED ERRATA QA Contact: ipa-qe <ipa-qe>
Severity: high Docs Contact:
Priority: high    
Version: 7.5CC: aheverle, gparente, grajaiya, jhrozek, ksiddiqu, lmanasko, lslebodn, mkosek, myusuf, mzidek, pbrezina, plautrba, rblakley, rmetrich, sgoveas, ssidhaye, sssd-maint, tmihinto, toneata, tscherf, zpytela
Target Milestone: rcKeywords: Regression, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: sssd-1.16.2-13.el7_6.1 Doc Type: Bug Fix
Doc Text:
Previously, if a user had a non-standard home directory and did not have explicit mapping to an SELinux user, the SSSD service skipped setting this user's login context due to a bad optimization in the code. This update removes the optimization. As a result, SSSD now sets the SELinux login context even for users with a non-standard home directory and no explicit mapping to an SELinux user.
Story Points: ---
Clone Of: 1619706 Environment:
Last Closed: 2019-01-29 17:22:03 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:
Bug Depends On: 1619706    
Bug Blocks:    

Description Oneata Mircea Teodor 2018-11-01 10:10:57 UTC
This bug has been copied from bug #1619706 and has been proposed to be backported to 7.6 z-stream (EUS).

Comment 2 Oneata Mircea Teodor 2018-11-01 10:12:42 UTC
*** Bug 1645044 has been marked as a duplicate of this bug. ***

Comment 4 Jakub Hrozek 2018-11-06 08:16:01 UTC
Hi Michal, this needs packaging.

Comment 10 Jakub Hrozek 2019-01-17 12:05:38 UTC
Can you show me some logs? (selinux_child and domain) ?

btw you don't have to add a selinux user or a role. Just with the default configuration, logging in as the user should add that user to the database

Comment 11 Mohammad Rizwan 2019-01-17 13:31:53 UTC
version:
ipa-server-4.6.4-10.el7_6.2.x86_64
sssd-1.16.2-13.el7_6.5.x86_64

Steps:
1. add ipa user and login with it
2. semanage login -l

Actual result:

[root@master ~]# ipa user-add testuser2 --first  test2 --last user --password
Password: 
Enter Password again to verify: 
----------------------
Added user "testuser2"
----------------------
  User login: testuser2
  First name: test2
  Last name: user
  Full name: test2 user
  Display name: test2 user
  Initials: tu
  Home directory: /home/testuser2
  GECOS: test2 user
  Login shell: /bin/sh
  Principal name: testuser2
  Principal alias: testuser2
  User password expiration: 20190117132244Z
  Email address: testuser2
  UID: 1181800004
  GID: 1181800004
  Password: True
  Member of groups: ipausers
  Kerberos keys available: True
[root@master ~]# 
[root@master ~]# 
[root@master ~]# ssh testuser2.test
Password: 
Password: 
Password expired. Change your password now.
Current Password: 
New password: 
Retype new password: 
Last failed login: Thu Jan 17 08:23:04 EST 2019 from master.testrelm.test on ssh:notty
There was 1 failed login attempt since the last successful login.
Last login: Thu Jan 17 08:05:41 2019 from master.testrelm.test
**  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **
         This System is part of the Red Hat Test System.              
                                                                      
      Please do not use this system for individual unit testing.      
                                                                      
      RHTS Test information:                                          
                         HOSTNAME=master.khw1.lab.eng.bos.redhat.com                           
                            JOBID=3291850                              
                         RECIPEID=6397532                           
                       LAB_SERVER=                         
                    RESULT_SERVER=[::1]:7096                      
                           DISTRO=RHEL-7.6-20190115.n.0                             
**  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **
Could not chdir to home directory /home/testuser2: No such file or directory
/usr/bin/id: cannot find name for group ID 1181800003
-sh-4.2$ 
-sh-4.2$ semanage login -l
ValueError: SELinux policy is not managed or store cannot be accessed.
-sh-4.2$ exit
logout
Connection to master.testrelm.test closed.
[root@master ~]# 
[root@master ~]# 
[root@master ~]# semanage login -l

Login Name           SELinux User         MLS/MCS Range        Service

__default__          unconfined_u         s0-s0:c0.c1023       *
root                 unconfined_u         s0-s0:c0.c1023       *
system_u             system_u             s0-s0:c0.c1023       *
testuser2            unconfined_u         s0-s0:c0.c1023       *

SELinux login context set for user with default context. 

Based on above observation, marking the bug verified.

Comment 13 errata-xmlrpc 2019-01-29 17:22:03 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.

https://access.redhat.com/errata/RHBA-2019:0169