Bug 1838037

Summary: Oddjob-mkhomedir fails when using NSS compat
Product: Red Hat Enterprise Linux 8 Reporter: Alexey Tikhonov <atikhono>
Component: sssdAssignee: Sumit Bose <sbose>
Status: CLOSED ERRATA QA Contact: sssd-qe <sssd-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.2CC: atikhono, fweimer, grajaiya, jhrozek, lslebodn, mkosek, mupadhye, mzidek, pbrezina, sbose, sgoveas, sssd-qe, thalman, t.h.amundsen, tscherf
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: sync-to-jira review
Fixed In Version: sssd-2.3.0-3.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1402403 Environment:
Last Closed: 2020-11-04 02:05:17 UTC Type: Bug
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: 1402403, 1834816    
Bug Blocks:    

Comment 2 Pavel Březina 2020-05-21 08:55:08 UTC
Pushed PR: https://github.com/SSSD/sssd/pull/5157

* `master`
    * aac4dbb17f3e19a2fbeefb38b3319827d3bf820e - NSS client: preserve errno during _nss_sss_end* calls

Comment 6 Madhuri 2020-08-07 08:24:47 UTC
[root@ci-vm-10-0-107-1 ~]# rpm -qa sssd glibc oddjob-mkhomedir
oddjob-mkhomedir-0.34.5-2.el8.x86_64
sssd-2.3.0-6.el8.x86_64
glibc-2.28-127.el8.x86_64

Verification steps:

1) pam_mkhomedir is configured (with-mkhomedir option of authselect)
# authselect select sssd with-mkhomedir --force

2) Update /etc/nsswitch.conf

from /etc/nsswitch.conf
passwd_compat: sss
passwd: compat

also added '+' at the end of /etc/passwd

3) Restart sssd

4) Check authentication of user 
[root@ci-vm-10-0-107-1 ~]# ssh -l test_user@ldap localhost
The authenticity of host 'localhost (::1)' can't be established.
ECDSA key fingerprint is SHA256:+mpAR9YB8Buu8NSb/zHNMgsD3bmQ6MKiJqnKr0V7huc.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
test_user@ldap@localhost's password: 
Activate the web console with: systemctl enable --now cockpit.socket

This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register

/usr/bin/id: cannot find name for group ID 14583101
[test_user@ldap@ci-vm-10-0-107-1 ~]$ pwd
/home/test_user
[test_user@ldap@ci-vm-10-0-107-1 ~]$ logout
Connection to localhost closed.


5) Check with C program,
[root@ci-vm-10-0-107-1 ~]# cat test.c
#include <stdio.h>
#include <sys/types.h>
#include <pwd.h>

int main(int argc, char *argv[])
{
        char buf[4];
        int ret;
        struct passwd pwd;
        struct passwd *pw;

        if (argc != 2) {
                return -1;
        }

        ret = getpwnam_r(argv[1], &pwd, buf, sizeof(buf), &pw);

        printf("ret: %d\n", ret);

        return 0;
}

compile and run the code,

[root@ci-vm-10-0-107-1 ~]# gcc -o test test.c 

[root@ci-vm-10-0-107-1 ~]# ./test dfh
ret: 34

34 is returned and the home directory is created after the first login.
Hence marking this verified.

Comment 9 errata-xmlrpc 2020-11-04 02:05:17 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 (sssd bug fix and enhancement update), 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-2020:4569