Bug 1803134

Summary: Improve "unlock" time when user session already active
Product: Red Hat Enterprise Linux 8 Reporter: hgraham
Component: sssdAssignee: Sumit Bose <sbose>
Status: CLOSED ERRATA QA Contact: sssd-qe <sssd-qe>
Severity: high Docs Contact:
Priority: unspecified    
Version: 8.1CC: atikhono, dminnich, grajaiya, jhrozek, lslebodn, mniranja, mzidek, pbrezina, sbose, sgoveas, ssorce, stephenfin, thalman, tscherf, vvasilev
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Linux   
Whiteboard: sync-to-jira
Fixed In Version: sssd-2.3.0-4.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-04 02:04:37 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:    
Bug Blocks: 1842946    

Description hgraham 2020-02-14 14:44:11 UTC
Description of problem:
Upstream bug: https://pagure.io/SSSD/sssd/pull-request/4104


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


How reproducible:


Steps to Reproduce:
1. 
2. 
3.

Actual results:


Expected results:


Additional info:

Comment 2 Martin Kosek 2020-02-14 15:07:25 UTC
Henry (or Sumit), when following up on this bug, please fill also Description of the Problem, Severity and Reproduction scenario. This is needed for following reviews, testing, documentation, etc.

Comment 3 hgraham 2020-02-14 15:37:33 UTC
Description of problem:

Because of the initgroups call performed by sssd, users that have an active session on a system are seeing subsequent logins taking 10-20seconds. This affects usability and is hindering our roll out of IPA to CSB.


Steps to Reproduce:
1. Set up a CSB RHEL8 server
2. Join to RHIT's IPA environment

Actual results:
unlocking a machine with an already active user session takes 10-20seconds


Expected results:
Subsequent unlocking only takes a few seconds


Additional info:
Upstream with patches that help in 8.0 but not 8.1
https://pagure.io/SSSD/sssd/pull-request/4104

Comment 4 hgraham 2020-05-05 17:05:37 UTC
Is there anything else needed from me for this?

Comment 5 Sumit Bose 2020-05-19 16:07:27 UTC
master:
  - 272efe4 - pam: make sure initgr cache is not created twice
  - 74f0a45 - cache_req: no refresh with CACHE_REQ_BYPASS_PROVIDER
  - 68aa68e - pam: use pam_initgroups_scheme
  - b66f0e4 - pam: add option pam_initgroups_scheme
  - d2424bf - pam: Use cache for users with existing session
  - b572871 - cache_req: introduce cache_behavior enumeration

Comment 6 Sumit Bose 2020-06-09 05:23:45 UTC
Upstream ticket:
https://github.com/SSSD/sssd/issues/5062

Comment 12 Pavel Březina 2020-07-02 08:16:27 UTC
Pushed PR: https://github.com/SSSD/sssd/pull/5222

* `master`
    * 100839b64390d7010bfa28552fd9381ef4366496 - PAM: do not treat error for cache-only lookups as fatal

Comment 20 Simo Sorce 2020-09-18 18:40:25 UTC
I just use brew download-build to get sssd-2.3.0-9.el8 9and all its dependencies)

I see no appreciable difference in behavior after the update.

I ran a sudo -i command and it took it 10 seconds to give me a password prompt, then it took another 10 second to complete authentication.
This is consistent with a previous report that my original patchset stopped working sometimes between around 8.1+ as some other code is now forcing a synchronous LDAP call in the code path.

The way to test this is the following:

configure SSSD against an IPA server.
- log in a user.
- cause the connection to the server to fail (restart ldap on the server for example).
- try to use sudo or other call that causes authentication.
- *verify* that no attempt to make LDAP calls happen until after the password prompt is shown

HTH
(IMO this is a FailQA situation)

Comment 21 Sumit Bose 2020-09-18 18:59:46 UTC
Henry, for which platform do you want a build?

Simo, can you attach your current logs?

bye,
Sumit

Comment 32 Simo Sorce 2020-09-23 15:46:54 UTC
Hi Sumit,
that is exactly the issue.

I searched the timestmaps db and it was empty except for the basic skeleton tree entries.

After adding the entry and refreshing the user now sudo access is very quick, sub-second delays.
The same also for GDM logins, no more delays to unlock the screen.

Thanks a lot, seem that fixing that bug is quite important for a decent experience.

My hypothesys is that a database migration over an upgrade failed to port/create proper timestamps. The code should be fixed to cretae a timestamp on update if an entry does not exist I guess.

In any case, thanks a lot for diagnosing this.
It means the unlock patches work as expected now and all is good from my side!!

Comment 35 Sumit Bose 2020-09-24 11:15:17 UTC
(In reply to Simo Sorce from comment #32)
> Hi Sumit,
> that is exactly the issue.
> 
> I searched the timestmaps db and it was empty except for the basic skeleton
> tree entries.
> 
> After adding the entry and refreshing the user now sudo access is very
> quick, sub-second delays.
> The same also for GDM logins, no more delays to unlock the screen.

Great, so this explains as well, why I didn't see such strong delays and unexpected initgroup requests in my test.

> 
> Thanks a lot, seem that fixing that bug is quite important for a decent
> experience.
> 
> My hypothesys is that a database migration over an upgrade failed to
> port/create proper timestamps. The code should be fixed to cretae a
> timestamp on update if an entry does not exist I guess.

Yes.

> 
> In any case, thanks a lot for diagnosing this.
> It means the unlock patches work as expected now and all is good from my
> side!!

yw, thanks for your patience.

bye,
Sumit

Comment 43 Sumit Bose 2020-10-22 09:49:45 UTC
*** Bug 1795127 has been marked as a duplicate of this bug. ***

Comment 45 errata-xmlrpc 2020-11-04 02:04:37 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