Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2166943

Summary: kinit switches KCM away from the newly issued ticket
Product: Red Hat Enterprise Linux 9 Reporter: Alexey Tikhonov <atikhono>
Component: sssdAssignee: Alejandro López <allopez>
Status: CLOSED ERRATA QA Contact: Jakub Vavra <jvavra>
Severity: low Docs Contact:
Priority: unspecified    
Version: 9.1CC: aboscatt, pbrezina, sgadekar
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: sync-to-jira
Fixed In Version: sssd-2.9.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-07 08:54: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:

Description Alexey Tikhonov 2023-02-03 15:28:50 UTC
This bug was initially created as a copy of Bug #2143925

I am copying this bug because: to track fix for RHEL9



Description of problem:
It may be relevant that I have two ssh sessions active to the same headless server.  In one of them if my ticket has expired and I type 'kinit' to reissue it, the primary cache in the KCM collection changes to a different (expired) ticket, so KRB5 operations still fail.

Version-Release number of selected component (if applicable):
krb5-workstation-1.18.2-14.el8.x86_64
sssd-kcm-2.6.2-4.el8_6.1.x86_64

How reproducible:
It happens reasonably often when my tickets expire.

Transcript (the current time is about 11:30 on Nov 18):

$ klist
Ticket cache: KCM:10282:19556
Default principal: imc.OX.AC.UK

17/11/22 12:22:15  17/11/22 18:04:10  krbtgt/IPA.CS.OX.AC.UK.OX.AC.UK
        renew until 24/11/22 10:04:10

[The ticket has expired.  Let's issue a new one.]

$ kinit
Password for imc.OX.AC.UK: 
$ klist
Ticket cache: KCM:10282:46955
Default principal: imc.OX.AC.UK

Valid starting     Expires            Service principal
17/11/22 11:38:11  18/11/22 10:42:42  krbtgt/IPA.CS.OX.AC.UK.OX.AC.UK

[So, despite having issued a new ticket with 'kinit', the current ticket
is still expired!  The identity of the ticket cache has changed.]

$ kswitch -c KCM:10282:19556
$ klist
Ticket cache: KCM:10282:19556
Default principal: imc.OX.AC.UK

Valid starting     Expires            Service principal
18/11/22 11:33:43  19/11/22 11:33:41  krbtgt/IPA.CS.OX.AC.UK.OX.AC.UK

[Oh look, there is my newly issued ticket after all.]

I would contend that the 'kswitch' there shouldn't be needed in order to
have a valid ticket immediately after a successful 'kinit'.

Comment 3 Alexey Tikhonov 2023-03-27 11:47:42 UTC
Pushed PR: https://github.com/SSSD/sssd/pull/6632

* `master`
    * 55e27a423d4065aa419e1bd80db1826eb8264c4a - KCM: Switch default caches only when there is no current default.
* `sssd-2-8`
    * 767234a3b216a19f94b3a41b15a444877c324494 - KCM: Switch default caches only when there is no current default.

Comment 10 errata-xmlrpc 2023-11-07 08:54: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-2023:6644