Bug 1414568 - MIT Kerberos-generated keytabs are unusable in Java
Summary: MIT Kerberos-generated keytabs are unusable in Java
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: java-1.8.0-ibm
Version: 7.3
Hardware: All
OS: All
Target Milestone: rc
: ---
Assignee: jiri vanek
QA Contact: zzambers
Depends On:
TreeView+ depends on / blocked
Reported: 2017-01-18 21:05 UTC by Daniel Sands
Modified: 2021-01-15 07:30 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2021-01-15 07:30:17 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description Daniel Sands 2017-01-18 21:05:31 UTC
Description of problem:

MIT Kerberos 1.14 seems to have changed the format of their keytab files, as hinted at in the release notes about key version numbers.  Current versions of Java, seemingly all flavors, but first noticed in IBM's and also tested in OpenJDK, cannot read this keytab format.  Attempts to use MIT-generated keytabs fail with strange errors, usually along the lines of null keys or inability to read the file.

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

Tried current latest:  java-1.8.0-ibm-

How reproducible:


Steps to Reproduce:
1.  Create a keytab using MIT Kerberos:
$ ktutil
ktutil:  addent -password -p testuser -k 1 -e aes256-cts-hmac-sha1-96
Password for testuser@EXAMPLE.COM: 
ktutil:  wkt test.keytab
ktutil:  q

2.  Attempt to use the keytab in Java.
$ /usr/lib/jvm/jre-ibm/bin/klist -k -t test.keytab

Key table: test.keytab
Number of entries: 0

$ /usr/lib/jvm/jre-ibm/bin/ktab -l -k test.keytab
The format of key table test.keytab is incorrect.

$ /usr/lib/jvm/jre-ibm/bin/kinit -k -t test.keytab testuser # Assumes testuser is in the database
com.ibm.security.krb5.KrbException, status code: 25
	message: Additional pre-authentication required

Actual results:

Odd error messages

Expected results:

Parsing and use of the keytab file

Additional info:

For verification, I also used Java's ktab program to generate a keytab.  It created a usable keytab file for both Java and MIT Kerberos.

Comment 2 Peter G. Toennies 2017-02-07 23:50:30 UTC
Has anyone else verified this bug? Is there a target date when it might be fixed?

Comment 3 Andrew John Hughes 2017-02-08 00:48:37 UTC
The bug is filed against the IBM JDK, which I believe is provided to Red Hat as a series of binaries. You would thus need to contact IBM to fix the bug there.

We could look at this as an OpenJDK bug if requested.

Comment 4 Daniel Sands 2017-02-08 19:07:07 UTC
Additional testing reveals the following:

OpenJDK  Reads the keytab file
Oracle  Does not read the keytab file
IBM  Does not read the keytab file.

Example program:

import java.io.File;
import javax.security.auth.kerberos.KerberosKey;
import javax.security.auth.kerberos.KerberosPrincipal;
import javax.security.auth.kerberos.KeyTab;

public class keytab {
   public static void main( String[] argv )
      File keytabFile = new File( argv[0] );
      KerberosPrincipal princ = new KerberosPrincipal( argv[1] );
      KeyTab keytab = KeyTab.getInstance( keytabFile );
      for( KerberosKey k : keytab.getKeys( princ ) )
         System.out.println( k.toString() );

To run:
java keytab <keytab_file> <principal in file>

On keytabs created in older Kerberos distros, this will output the keys in the keytab.  With keytabs created by current Kerberos in RHEL7, this will output nothing.

Comment 5 Daniel Sands 2017-02-08 20:30:06 UTC
Correction:  I had freshly installed the Oracle version and forgot the unrestricted policy.  After installing the policy, Oracle's Java also read the keytab.  So it appears that IBM Java is the only version that fails to read the keytab (even with their unrestricted policy in place).

Comment 6 Andrew John Hughes 2017-02-09 03:08:21 UTC
Thanks. I was able to read a keytab file generated on RHEL 7's mit-krb5 with the app provided on both java-1.7.0-openjdk and java-1.8.0-openjdk. Looks like an IBM-specific issue.

Comment 10 RHEL Program Management 2021-01-15 07:30:17 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.

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