Bug 1301099 - Latest 4.5.0 kernels break kerberos KEYRING:persistent credential caches
Summary: Latest 4.5.0 kernels break kerberos KEYRING:persistent credential caches
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: rawhide
Hardware: x86_64
OS: Linux
unspecified
urgent
Target Milestone: ---
Assignee: David Howells
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: F24AlphaBlocker
TreeView+ depends on / blocked
 
Reported: 2016-01-22 15:18 UTC by Stephen Gallagher
Modified: 2016-01-30 05:45 UTC (History)
14 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-01-30 05:45:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Patch to revert the change that caused the problem (1.82 KB, patch)
2016-01-27 01:11 UTC, David Howells
no flags Details | Diff

Description Stephen Gallagher 2016-01-22 15:18:38 UTC
Description of problem:
This morning, I upgraded to the latest kernel available in the Rawhide repositories. Immediately thereafter, I started getting permission denied errors when trying to authenticate using my Kerberos credentials through SSSD.

I did some debugging and discovered that the permission denials are coming from the kernel keyring. The problem was not present in kernel-4.5.0-0.rc0.git1.1.fc24 and manifested in kernel-4.5.0-0.rc0.git5.1.fc24. (There were no other successful builds in Koji between 1.1 and 5.1, so I cannot narrow the problem down any further.

Version-Release number of selected component (if applicable):
kernel-4.5.0-0.rc0.git5.1.fc24 and later
kernel-4.5.0-0.rc0.git5.1.fc24

How reproducible:
Every time

Steps to Reproduce:
1. Configure a system with SSSD to authenticate using Kerberos
2. Attempt to log in "online" (not using cached credentials for disconnected operation)

Actual results:
Authentication fails, logs show permission-denied errors coming from the kerberos library credential cache operations.

Expected results:
Authentication should succeed.


Additional info:

Comment 1 Fedora Blocker Bugs Application 2016-01-25 16:25:34 UTC
Proposed as a Blocker for 24-alpha by Fedora user sgallagh using the blocker tracking app because:

 Alpha criterion:
"It must be possible to join the system to a FreeIPA or Active Directory domain at install time and post-install, and the system must respect the identity, authentication and access control configuration provided by the domain."

Comment 2 Stephen Gallagher 2016-01-25 19:21:16 UTC
I took a closer look at the Koji builds and saw that kernel-4.5.0-0.rc0.git3.1.fc24 built successfully for x86_64, so I installed that version. It worked properly, which means that the issue must have been introduced between 3.1 and 5.1.

Looking at the things that changed between those two versions, I'd hazard a guess that the commit that introduced it is probably http://pkgs.fedoraproject.org/cgit/rpms/kernel.git/commit/?id=42aa4321c736d85b027e9cf2e595db174b3cc76b

Comment 3 Adam Williamson 2016-01-25 20:43:55 UTC
I can confirm the issue, exactly as sgallagh describes, and I'm +1 blocker.

Comment 4 Stephen Gallagher 2016-01-25 20:51:34 UTC
As an incomplete workaround, one can add
krb5_ccname_template = FILE:/tmp/krb5cc_%U_XXXXXX

to the [domain/DOMAINNAME] section of sssd.conf and then run
ldbedit -H /var/lib/sss/db/cache_DOMAINNAME.ldb
and delete any line starting with 'ccacheFile`

This will switch back to using the old /tmp file-based approach to credential caches. This is not a good long-term solution as it doesn't play well with poly-instantiated /tmp or multiple-TGT setups.

Or you can do what I'm doing and hold the kernel back at a working version until this is fixed.

Comment 5 David Howells 2016-01-26 16:05:04 UTC
(In reply to Stephen Gallagher from comment #2)
> Looking at the things that changed between those two versions, I'd hazard a
> guess that the commit that introduced it is probably
> http://pkgs.fedoraproject.org/cgit/rpms/kernel.git/commit/
> ?id=42aa4321c736d85b027e9cf2e595db174b3cc76b

There's nothing in that commit that would have an effect that I can see.  The only keyring-related thing is specific to asymmetric keys and IMA - neither of which should be involved here.

Comment 6 Josh Boyer 2016-01-26 16:16:23 UTC
(In reply to David Howells from comment #5)
> (In reply to Stephen Gallagher from comment #2)
> > Looking at the things that changed between those two versions, I'd hazard a
> > guess that the commit that introduced it is probably
> > http://pkgs.fedoraproject.org/cgit/rpms/kernel.git/commit/
> > ?id=42aa4321c736d85b027e9cf2e595db174b3cc76b
> 
> There's nothing in that commit that would have an effect that I can see. 
> The only keyring-related thing is specific to asymmetric keys and IMA -
> neither of which should be involved here.

You need to look more closely.

That's a typical rawhide git snapshot commit.  Which means the bulk of the change isn't in flat files in Fedora git.  It's in the snapshot patch itself.  If git5.1 is the commit that introduces the problem, that corresponds with upstream commit 5807fca, and if git4.1 doesn't show the problem, that corresponds to upstream commit 7d1fc01.  There are almost 3000 commits upstream between those two points.  Namely among them are the security tree merge, which includes all the key patches.

Comment 7 David Howells 2016-01-26 16:18:02 UTC
Doing a successful kinit followed by a kdestroy shows:

    kdestroy: Operation not permitted while destroying cache
    Ticket cache NOT destroyed!

which appears to be related to the problem.

Comment 8 David Howells 2016-01-26 16:27:40 UTC
The problem is in upstream commit 1d6d167c2efcfe9539d9cffb1a1be9c92e39c2c0 where the application of KEY_FLAG_KEEP is made unconditional.

Comment 9 David Howells 2016-01-27 01:09:37 UTC
You can test this with:

    keyctl newring foo @s
    keyctl add user a a %:foo
    keyctl unlink %user:a %:foo
    keyctl clear %:foo

The last two commands fail with the unfixed kernel, but all the commands should work.

Comment 10 David Howells 2016-01-27 01:11:01 UTC
Created attachment 1118644 [details]
Patch to revert the change that caused the problem

Comment 11 Justin M. Forbes 2016-01-27 15:44:49 UTC
This patch has been applied to kernel-4.5.0-0.rc1.git0.2.fc24 (building now) If you could test with this kernel once the build completes and let us know, I would appreciate it.

Comment 12 Stephen Gallagher 2016-01-28 14:11:22 UTC
(In reply to Justin M. Forbes from comment #11)
> This patch has been applied to kernel-4.5.0-0.rc1.git0.2.fc24 (building now)
> If you could test with this kernel once the build completes and let us know,
> I would appreciate it.

Tested and working!


Note You need to log in before you can comment on or make changes to this bug.