<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
  <!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
  <title>XMPP Server Registration for use with Kerberos V5</title>
  <abstract>This specification defines the Kerberos principal name of an XMPP server. It also details a method by which a connecting client can determine this Kerberos principal name when authenticating using the "GSSAPI" SASL mechanism.</abstract>
  &LEGALNOTICE;
  <number>0233</number>
  <status>Draft</status>
  <lastcall>2017-03-01</lastcall>
  <lastcall>2017-02-22</lastcall>
  <type>Standards Track</type>
  <sig>Standards</sig>
  <approver>Council</approver>
  <dependencies>
    <spec>XMPP Core</spec>
    <spec>RFC 5178</spec>
    <spec>RFC 5179</spec>
  </dependencies>
  <supersedes/>
  <supersededby/>
  <shortname>kerberos5</shortname>
  &linuxwolf;
  &stpeter;
  &hildjj;
  <author>
    <firstname>Mili</firstname>
    <surname>Verma</surname>
    <email>mili.verma@isode.com</email>
    <jid>mili.verma@isode.com</jid>
  </author>
  <revision>
    <version>1.0.0</version>
    <date>2017-03-16</date>
    <initials>XEP Editor (ssw)</initials>
    <remark><p>Move to draft by order of the XMPP Council.</p></remark>
  </revision>
  <revision>
    <version>0.5.1</version>
    <date>2017-03-03</date>
    <initials>mv</initials>
    <remark><p>Clarified regarding insecure DNS queries.</p></remark>
  </revision>
  <revision>
    <version>0.5</version>
    <date>2015-10-20</date>
    <initials>mv</initials>
    <remark><p>Included support for Microsoft SSPI (Mili Verma).</p></remark>
  </revision>
  <revision>
    <version>0.4</version>
    <date>2011-08-26</date>
    <initials>psa</initials>
    <remark><p>Focused the document purely on the Kerberos use case, with the intent of handling the non-Kerberos use case in a separate specification; incremented the protocol version number to prevent confusion with deployed uses of the non-Kerberos functionality.</p></remark>
  </revision>
  <revision>
    <version>0.3</version>
    <date>2011-06-22</date>
    <initials>psa</initials>
    <remark><p>Tightened the conformance terminology in several places; updated references.</p></remark>
  </revision>
  <revision>
    <version>0.2</version>
    <date>2010-06-10</date>
    <initials>psa</initials>
    <remark><p>Expanded use beyond Kerberos; updated namespace; corrected schema; updated references.</p></remark>
  </revision>
  <revision>
    <version>0.1</version>
    <date>2008-01-30</date>
    <initials>psa</initials>
    <remark><p>Initial published version.</p></remark>
  </revision>
  <revision>
    <version>0.0.2</version>
    <date>2007-12-11</date>
    <initials>mm/psa</initials>
    <remark><p>Corrected syntax.</p></remark>
  </revision>
  <revision>
    <version>0.0.1</version>
    <date>2007-12-05</date>
    <initials>mm/psa</initials>
    <remark><p>First draft.</p></remark>
  </revision>
</header>

<section1 topic='Introduction' anchor='intro'>
  <p>The Kerberos Network Authentication Service (V5) is described in &rfc4120;. An application can call the Kerberos library through the Generic Security Services Application Programming Interface (GSS-API) described in &rfc4121; or the proprietary Microsoft Windows Security Service Provider Interface (SSPI).</p>
  <p>The Simple Authentication and Security Layer or SASL (&rfc4422;) is a framework for adding authentication support to connection-based protocols. The SASL mechanism used in environments that make use of Kerberos V5 is called "GSSAPI" and is described in &rfc4752;. Note that the <cite>RFC 4121</cite> API has a hyphen and the SASL mechanism does not.</p>
  <p>Before using the "GSSAPI" SASL mechanism to authenticate to an XMPP server (which is referred to as the "acceptor" in Kerberos terminology), a connecting client needs to obtain a Kerberos ticket from the Key Distribution Centre (KDC). For this the client needs to determine the Kerberos principal name of the XMPP server. This scenario was not addressed in &rfc3920; or &rfc6120;.</p>
  <p>This specification sets out the rules that must be followed when registering the Kerberos principal name of an XMPP server. It also details how a client can determine the hostname of the XMPP server which can then be used to construct the Kerberos principal name.</p>
</section1>

<section1 topic='Client Determination of Hostname' anchor='hostname'>
  <p>An XMPP client will initiate a connection to the XMPP server.</p>
  <p>The XMPP server will communicate its hostname in a child element of the &lt;mechanisms/&gt; element during SASL negotation, as allowed by <cite>RFC 6120</cite> (see Section 6.3.5 and the schema for the 'urn:ietf:params:xml:ns:xmpp-sasl' namespace in Appendix A.4).</p>
  <p>This child element is &lt;hostname/&gt; qualified by the 'urn:xmpp:domain-based-name:1' namespace. &NSNOTE;.</p>
  <p>The XML character data of the &lt;hostname/&gt; element specifies the fully-qualified name of the XMPP server. This should be used for constructing the Kerberos principal name and is independent of the usual rules that an XMPP client uses for establishing a network connection to the XMPP server which may use insecure DNS queries (also see &rfc4120;).</p>
</section1>

<section1 topic='Kerberos Principal Name in the GSS-API environment' anchor='principal'>
  <p>When the XMPP server is implemented using GSS-API, the domain-based service name (&rfc5178;, &rfc5179;) is used as the Kerberos principal name. Domain-based service names contain a domain name in addition to a hostname. This allows naming clustered servers after the domain which they service.</p>
  <p>The domain-based service name is mapped to the Kerberos principal name following the format specified in <cite>RFC 5179</cite> (i.e., "service/hostname/domain@REALM") and setting the values as follows:</p>
  <ul>
    <li>The <strong>service</strong> string MUST be "xmpp".</li>
    <li>The <strong>hostname</strong> string MUST be the hostname of the XMPP server, as provided by the server in the XML character data of the &lt;hostname/&gt; element during SASL negotiation.</li>
    <li>The <strong>domain</strong> string MUST be the canonical name of the service. This is typically communicated by the client in the 'to' address of the initial stream header.</li>
    <li>The <strong>REALM</strong> string SHOULD be determined according to the network policies in effect (usually the domain name, in an uppercase mapping).</li>
  </ul>
</section1>

<section1 topic='Kerberos Principal Name in the Microsoft SSPI environment' anchor='windows'>
  <p>Microsoft Windows provides the proprietary SSPI to support the "GSSAPI" SASL mechanism. This section describes the Windows equivalent of the domain-based service name for an XMPP server.</p>
  <p>In the Microsoft Windows environment, the concept of Service Principal Name (SPN) is used, which is specified in <link url='https://msdn.microsoft.com/en-us/library/ms677601%28v=vs.85%29.aspx'>https://msdn.microsoft.com/en-us/library/ms677601%28v=vs.85%29.aspx</link>. This format ("service class/host:port/service name") is similar to the one specified in <cite>RFC 5179</cite>. The SPN can be generated by setting the values as follows:</p>
  <ul>
    <li>The <strong>service class</strong> string MUST be "xmpp".</li>
    <li>The <strong>host</strong> string MUST be the hostname of the XMPP server, as provided by the server in the XML character data of the &lt;hostname/&gt; element during SASL negotiation.</li>
    <li>The <strong>port</strong> is optional. It can be used to differentiate between multiple XMPP servers on a single host computer and should be omitted if the XMPP server uses the default port of 5222 for accepting client connections.</li>
    <li>The <strong>service name</strong> string MUST be the canonical name of the service. This is typically communicated by the client in the 'to' address of the initial stream header.</li>
  </ul>
</section1>

<section1 topic='Interoperability between GSS-API and SSPI' anchor='interop'>
  <p>The goal of this section is to help developers of applications so that clients and servers implemented over SSPI can interoperate with servers and clients implemented over GSS-API.</p>
  <p>Interoperability is achieved by the GSS-API system joining the Windows Active Directory domain or by having a cross-realm trust between the KDCs of the GSS-API and SSPI systems.</p>
  <p>The SPN of the SSPI server does not specify a realm. A GSS-API client constucts the Kerberos principal name according to the rules in the GSS-API environment and adds a realm to the Kerberos principal name, but the Kerberos principal name is mapped to the correct XMPP server on SSPI.</p>
  <p>When the server uses GSS-API, the SPN for the server needs to be created in the SSPI environment. The SPN constructed by the SSPI client according to the rules in the SSPI environment is then mapped to the correct GSS-API XMPP server.</p>
  <p>The domain-based service name of GSS-API does not specify a port, so the port option of the SPN in SSPI should only be used in testing scenarios when both the XMPP client and the XMPP server are implemented using SSPI. The port SHOULD NOT be used in any other scenarios.</p>
  <p>So in effect, whether an endpoint uses SSPI or GSS-API does not affect interoperability as long as the port in SSPI is not used.</p>
</section1>

<section1 topic='Examples' anchor='examples'>
  <p>Consider the example of an XMPP service "example.com" offered by the XMPP server located on the host "auth42.us.example.com", using the default port of 5222 for accepting client connections. When a client connects to the XMPP server, the server communicates its hostname along with supported SASL mechanisms as follows:</p>
  <example caption="Communicating the hostname"><![CDATA[
<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
  <mechanism>GSSAPI</mechanism>
  <mechanism>DIGEST-MD5</mechanism>
  <hostname xmlns='urn:xmpp:domain-based-name:1'>auth42.us.example.com</hostname>
</mechanisms>
]]></example>
  <p>To use the "GSSAPI" SASL mechanism, the client needs to determine the Kerberos principal name of the XMPP server, which will be:</p>
  <ul>
    <li>the domain-based service name "xmpp/auth42.us.example.com/example.com@EXAMPLE.COM" if the client is using GSS-API.</li>
    <li>the SPN "xmpp/auth42.us.example.com/example.com" if the client is using SSPI.</li>
  </ul>
</section1>

<section1 topic='Security Considerations' anchor='security'>
  <p>The communication of the XMPP server's hostname during SASL negotiation is not known to introduce new security vulnerabilities, as long as it is done after the underlying channel has been secured using Transport Layer Security (TLS; &rfc5246;) as described for XMPP in <cite>RFC 6120</cite>. For additional security considerations, refer to <cite>RFC 5178</cite> and <cite>RFC 5179</cite>.</p>
</section1>

<section1 topic='IANA Considerations' anchor='iana'>
  <p>This document requires no interaction with &IANA;.</p>
</section1>

<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  <section2 topic='Protocol Namespaces' anchor='registrar-ns'>
    <p>This specification defines the following XML namespace:</p>
    <ul>
      <li>urn:xmpp:domain-based-name:1</li>
    </ul>
    <p>Upon advancement of this specification from a status of Experimental to a status of Draft, the &REGISTRAR; shall add the foregoing namespace to the registry located at &NAMESPACES;, as described in Section 4 of &xep0053;.</p>
  </section2>
  <section2 topic='Protocol Versioning' anchor='registrar-versioning'>
    &NSVER;
  </section2>
</section1>

<section1 topic='XML Schema' anchor='schema'>
  <code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:domain-based-name:1'
    xmlns='urn:xmpp:domain-based-name:1'
    elementFormDefault='qualified'>

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      XEP-0233: http://www.xmpp.org/extensions/xep-0233.html
    </xs:documentation>
  </xs:annotation>

  <xs:element name='hostname' type='xs:string'/>

</xs:schema>
]]></code>
</section1>

<section1 topic='Acknowledgements' anchor='ack'>
  <p>Thanks to Owen Friel, Shane Hannon, Seamus Kerrigan, Eliot Lear, Alexey Melnikov, Klaas Wierenga, and Dave Cridland for their comments.</p>
</section1>

</xep>
