Bug 1287945

Summary: Kerberos authentication for remoting on hostname which contains uppercase letter
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: mchoma
Component: Security, Remoting, Domain ManagementAssignee: jboss-set
Status: CLOSED DEFERRED QA Contact: Josef Cacek <jcacek>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4.5CC: anmiller, bbaranow, bdawidow, bmaxwell, darran.lofthouse, lgao, pkremens, pskopek, twalsh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-20 14:30:15 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 mchoma 2015-12-03 05:39:42 UTC
Description of problem:
When EAP runs on server, which contains upper case in hostname (e.g. localhost.Localdomain), it  is unpossible to make kerberos authentication in remoting to work properly.
JDK constructs TGT-REQ with lower case hostname. But remoting client create connection to EAP with upper case letters,  what cause problems.

RFC4120 "The Kerberos Network Authentication Service"  [1] in chapter "6.2.1.  Name of Server Principals" requires "Where the name of the host is not case sensitive (for example, with Internet domain names) the name of the host MUST be lowercase."

Based on information from RFC, IMHO, EAP should handle such scenario. Either remoting client should send lowercase hostname or security realm should map principal case insensitively and look for lower-case keytab record, e.g. remote/localhost.localdomain.

[1] https://www.ietf.org/rfc/rfc4120.txt

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

How reproducible:
on localhost.Localdomain run from AS TS
./integration-tests.sh -Dts.manualmode -Dtest=KerberosInCLITestCase

Steps to Reproduce:
On system which contains Upper case letter host name. E.g. locally edit /etc/hostname, /etc/hosts to localhost.Localdomain 
1) CLI
    11) Setup CLI secured with Kerberos to use lowercase host

            <security-realm name="KerberosSecurityRealm">
                <server-identities>
                    <kerberos>
                        <keytab principal="remote/localhost.localdomain" path="/path/to/krb.keytab"/>
                    </kerberos>
                </server-identities>
                <authentication>
                    <kerberos/>
                </authentication>
            </security-realm>

    12) start eap
    13) try to access cli 
2) EJB
    21) setup remoting subsystem secured with kerberos realm to use lowercase host

        <subsystem xmlns="urn:jboss:domain:remoting:3.0">
            <endpoint/>
            <http-connector name="http-remoting-connector" connector-ref="default" security-realm="TestKerberosRealm"/>
        </subsystem>
        <security-realm name="TestKerberosRealm">
            <server-identities>
                <kerberos>
                <keytab principal="remote/localhost.localdomain" path="/path/to/krb.keytab" debug="true"/>
                </kerberos>
           </server-identities>
           <authentication>
               <kerberos/>
           </authentication>
       </security-realm>

    22) deploy app with ejb, start eap
    23) try to access deloyment


Actual results:

Both scenarios leads to log messages as 
^[[0m17:28:56,922 TRACE [org.jboss.as.domain.management.security] (default I/O-3) No mapping for name 'remote/localhost.Localdomain' to KeytabService, attempting to use host only match.
^[[0m17:28:56,922 TRACE [org.jboss.as.domain.management.security] (default I/O-3) No mapping for host 'localhost.Localdomain' to KeytabService, attempting to use default.
^[[0m17:28:56,922 TRACE [org.jboss.as.domain.management.security] (default I/O-3) No KeytabService available for host 'localhost.Localdomain' unable to return SubjectIdentity.


Expected results:
kerberos authentication working

Additional info:

Cloned from EAP7 issue https://issues.jboss.org/browse/JBEAP-1580