Bug 1683295

Summary: Kerberos cleanup procedures do not work with GSSAPIDelegateCredentials and default ccache from krb5.conf
Product: Red Hat Enterprise Linux 8 Reporter: Jakub Jelen <jjelen>
Component: opensshAssignee: Jakub Jelen <jjelen>
Status: CLOSED ERRATA QA Contact: Anderson Sasaki <ansasaki>
Severity: unspecified Docs Contact: Abhimanyu Jamaiyar <ajamaiya>
Priority: medium    
Version: 8.1CC: ansasaki, lmanasko, omoris, pasik, szidek, tmraz
Target Milestone: rcKeywords: Triaged
Target Release: 8.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openssh-8.0p1-1.el8 Doc Type: Bug Fix
Doc Text:
.Kerberos cleanup procedures are now compatible with `GSSAPIDelegateCredentials` and default cache from `krb5.conf` Previously, when the `default_ccache_name` option was configured in the `krb5.conf` file, the kerberos credentials were not cleaned up with the `GSSAPIDelegateCredentials` and `GSSAPICleanupCredentials` options set. This bug is now fixed by updating the source code to clean up credential caches in the described use cases. After the configuration, the credential cache gets cleaned up on exit if the user configures it.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-05 22:41:32 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: 1682500    
Bug Blocks:    

Description Jakub Jelen 2019-02-26 14:31:22 UTC
Description of problem:
Based on the discussion in bug #1645291, it turned out that the cleanup procedure for the kerberos tickets created during GSSAPI Credential forwarding or Kerberos authentication are attempted to be cleaned with root context. This works fine with all the caches, but not with the KCM:, which is the new default.

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

How reproducible:
100%

Steps to Reproduce:
1. Run the test /CoreOS/openssh/Sanity/gssapi-ccname
2. Observe some failures with KCM: 

Actual results:
credential cache when the credential cleanup was not performed as expected with KCM 

Expected results:
The credentials are properly cleaned up (by switching to the user that has acquired them)

Comment 1 Jakub Jelen 2019-03-01 10:50:28 UTC
From the code, the cleanup procedure of the GSSAPIDelegateCredentials is called twice, once as a root from the privileged process and once as a user from the user process, which is still not correct but rules out the issue is caused by calling the cleanup from different user.

Additionally, it looks like the krb5_cc_resolve() is called with empty name argument, which is something I am wondering why it could work with other credential cache types. It looks like an issue of the test.

The problem here is that the cleanup procedure of GSSAPIDelegateCredentials is getting the NULL name which makes it fail and prevents the cleanup in any case. It is caused by the recent modifications of OpenSSH to not set the environment variables KRB5CCNAME if the default is used.

This is minor issue, which should be fixed in RHEL 8.1 and it should be documented as a know issue.

Comment 16 errata-xmlrpc 2019-11-05 22:41:32 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/RHSA-2019:3702