1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-10 03:15:00 -05:00
xeps/xep-0178.xml
2011-04-20 09:30:57 -06:00

413 lines
19 KiB
XML

<?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>Best Practices for Use of SASL EXTERNAL with Certificates</title>
<abstract>This document specifies best practices for XMPP usage of the SASL EXTERNAL mechanism in the context of PKIX certificates.</abstract>
&LEGALNOTICE;
<number>0178</number>
<status>Active</status>
<interim/>
<type>Informational</type>
<sig>Standards</sig>
<approver>Council</approver>
<dependencies>
<spec>XMPP Core</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>N/A</shortname>
&stpeter;
&pgmillard;
<revision>
<version>1.1rc5</version>
<date>in progress, last updated 2011-04-20</date>
<initials>psa</initials>
<remark><p>Updated to be consistent with RFC 6120 and RFC 6125.</p></remark>
</revision>
<revision>
<version>1.0</version>
<date>2007-02-15</date>
<initials>psa</initials>
<remark><p>Per a vote of the XMPP Council, advanced specification to Active.</p></remark>
</revision>
<revision>
<version>0.7</version>
<date>2007-02-06</date>
<initials>psa</initials>
<remark><p>Clarified that the scope of this specification is limited to X.509 certificates.</p></remark>
</revision>
<revision>
<version>0.6</version>
<date>2007-01-29</date>
<initials>psa</initials>
<remark><p>Allowed client to not include an authorization identity if the certificate contains no XMPP address (thus depending on the server to assign the identity).</p></remark>
</revision>
<revision>
<version>0.5</version>
<date>2007-01-25</date>
<initials>psa</initials>
<remark><p>Clarified distinction between authentication and authorization; corrected handling of authorization identities; corrected conditions under which SASL EXTERNAL mechanism is offered; specified recommended formats for client and server certificates.</p></remark>
</revision>
<revision>
<version>0.4</version>
<date>2006-11-27</date>
<initials>psa</initials>
<remark><p>Modified XMPP address encapsulation methods per revisions to RFC 3920; clarified conditions for certificates to be considered acceptable.</p></remark>
</revision>
<revision>
<version>0.3</version>
<date>2006-09-21</date>
<initials>psa</initials>
<remark><p>Added TLS and SASL required child elements per revisions to RFC 3920.</p></remark>
</revision>
<revision>
<version>0.2</version>
<date>2006-03-09</date>
<initials>psa</initials>
<remark><p>Corrected client-server failure case to place error in SASL flow rather than binding flow; added note about non-X.509 usages.</p></remark>
</revision>
<revision>
<version>0.1</version>
<date>2006-03-09</date>
<initials>psa</initials>
<remark><p>Initial version.</p></remark>
</revision>
<revision>
<version>0.0.3</version>
<date>2006-02-10</date>
<initials>psa/pgm</initials>
<remark><p>Specified inclusion of authorization identity for server-to-server.</p></remark>
</revision>
<revision>
<version>0.0.2</version>
<date>2006-02-10</date>
<initials>psa/pgm</initials>
<remark><p>Clarified distinction between authentication and authorization.</p></remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2006-02-09</date>
<initials>psa/pgm</initials>
<remark><p>First draft.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>XMPP as specified in &rfc3920; and updated in &rfc6120; allows the use of any SASL (&rfc4422;) mechanism in the authentication of XMPP entities. This document specifies a recommended protocol flow for use of the SASL EXTERNAL mechanism with PKIX (&rfc5280;) certificates <note>This specification focuses on the use of the SASL EXTERNAL mechanism with X.509 certificates. Future specifications may document best practices for use of SASL EXTERNAL outside the context of the X.509 infrastructure, for example via Internet Protocol Security (IPSec) as specified in &rfc4301;.</note>, expecially when an XMPP service indicates that TLS is mandatory-to-negotiate.</p>
</section1>
<section1 topic='Client-to-Server Recommendation' anchor='c2s'>
<p>As specified in <cite>RFC 3920</cite> and updated in <cite>RFC 6120</cite>, during the stream negotiation process an XMPP client can present a certificate (a "client certificate"). If a JabberID is included in a client certificate, it is encapsulated as an id-on-xmppAddr Object Identifier ("xmppAddr"), i.e., a subjectAltName entry of type otherName with an ASN.1 Object Identifier of "id-on-xmppAddr" as specified in Section 13.7.1.4 of <cite>RFC 6120</cite>.</p>
<p>There are three possible cases:</p>
<ol>
<li>The certificate includes one xmppAddr.</li>
<li>The certificate includes more than one xmppAddr.</li>
<li>The certificate includes no xmppAddr.</li>
</ol>
<p>This specification includes recommendations that address all three cases.</p>
<p>The RECOMMENDED protocol flow for client-to-server use of SASL EXTERNAL with client certificates is as follows:</p>
<ol>
<li>
<p>Client initiates stream to server.</p>
<code><![CDATA[
<stream:stream
xmlns:stream='http://etherx.jabber.org/streams'
xmlns='jabber:client'
from='juliet@example.com'
to='example.com'
version='1.0'>
]]></code>
</li>
<li>
<p>Server replies with stream header.</p>
<code><![CDATA[
<stream:stream
xmlns:stream='http://etherx.jabber.org/streams'
xmlns='jabber:client'
id='c2s_234'
from='example.com'
to='juliet@example.com'
version='1.0'>
]]></code>
</li>
<li>
<p>Server advertises TLS stream feature, which might indicate that TLS is mandatory-to-negotiate.</p>
<code><![CDATA[
<stream:features>
<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
<required/>
</starttls>
</stream:features>
]]></code>
</li>
<li>
<p>Client sends STARTTLS command to server.</p>
<code><![CDATA[
<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
]]></code>
</li>
<li>
<p>Server informs client to proceed.</p>
<code><![CDATA[
<proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
]]></code>
</li>
<li>
<p>Server requests, and client presents, the client certificate during TLS negotiation.</p>
</li>
<li>
<p>Server and client successfully complete the TLS negotiation and client initiates a new initial stream header to server over the encrypted TCP connection.</p>
<code><![CDATA[
<stream:stream
xmlns:stream='http://etherx.jabber.org/streams'
xmlns='jabber:client'
from='juliet@example.com'
to='example.com'
version='1.0'>
]]></code>
</li>
<li>
<p>Server replies with response stream header.</p>
<code><![CDATA[
<stream:stream
xmlns:stream='http://etherx.jabber.org/streams'
xmlns='jabber:client'
id='c2s_345'
from='example.com'
to='juliet@example.com'
version='1.0'>
]]></code>
</li>
<li>
<p>Server advertises SASL mechanisms. Because the client presented a client certificate, here the server offers the SASL EXTERNAL mechanism (see Section 6.3.4 of <cite>RFC 6120</cite> for recommendations regarding the conditions under which to offer the SASL EXTERNAL mechanism).</p>
<code><![CDATA[
<stream:features>
<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<mechanism>EXTERNAL<mechanism>
<mechanism>DIGEST-MD5<mechanism>
<mechanism>ANONYMOUS<mechanism>
<required/>
</mechanisms>
</stream:features>
]]></code>
</li>
<li>
<p>Client considers EXTERNAL to be its preferred SASL mechanism so it attempts to complete SASL negotiation using that mechanism. The following paragraphs illustrate several possible paths, depending on whether the client includes an authorization identity (for the official rules regarding when to include the authorization identity, see Section 6.3.8 of <cite>RFC 6120</cite>).</p>
<ol style='list-style-type:lower-alpha'>
<li>
<p>If the client certificate contains only one JID, then the client MAY include an authorization identity, but only if it desires to be authorized as a JID other than the address in the client certificate; else it MUST NOT include include an authorization identity (this is shown in the following example by setting the XML character data of the &lt;auth/&gt; element to "=").</p>
<code><![CDATA[
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
mechanism='EXTERNAL'>=</auth>
]]></code>
</li>
<li>
<p>If the client certificate contains more than one JID, then the client MUST include an authorization identity so that the server can determine which JID to use (this is shown in the following example by setting the XML character data of the &lt;auth/&gt; element to "anVsaWV0QGV4YW1wbGUuY29t", which is the base 64 encoding for "juliet@example.com").</p>
<code><![CDATA[
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
mechanism='EXTERNAL'>anVsaWV0QGV4YW1wbGUuY29t</auth>
]]></code>
</li>
<li>
<p>If the client certificate does not contain a JID, then the client MAY include an authorization identity, but only if it desires to be authorized as a JID other than the address in the client certificate; else it MUST NOT include include an authorization identity (this is shown in the following example by setting the XML character data of the &lt;auth/&gt; element to "=").</p>
<code><![CDATA[
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
mechanism='EXTERNAL'>=</auth>
]]></code>
</li>
</ol>
</li>
<li>
<p>Server determines whether to allow authentication and authorization of user.</p>
<ol style='list-style-type:lower-alpha'>
<li>
<p>If (1) the certificate presented by the client contains only one valid XMPP address that corresponds to a registered account on the server and (2) the client did not pass an authorization identity in the SASL exchange, then the server SHOULD allow authentication and authorization of that JID.</p>
<code><![CDATA[
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
]]></code>
</li>
<li>
<p>If the certificate contains more than one valid XMPP address that corresponds to a registered account on the server (e.g., because the server offers virtual hosting), then the server SHOULD allow authentication and authorization of the JID specified as the authorization identity in the SASL exchange.</p>
<code><![CDATA[
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
]]></code>
<p>If no authorization identity is included, then the server SHOULD return a SASL failure case of &lt;invalid-authzid/&gt; and close the stream.</p>
<code><![CDATA[
<failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<invalid-authzid/>
</failure>
</stream:stream>
]]></code>
</li>
<li>
<p>If the certificate does not contain an XMPP address, then the server MAY attempt to determine if there is a registered account associated with the user, for example by performing an LDAP lookup based on the Common Name or other information presented by the client in the certificate; if such a JID mapping is successful and the mapped JID matches the authorization identity provided, then the server SHOULD allow authentication and authorization of that mapped JID.</p>
<code><![CDATA[
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
]]></code>
<p>If JID mapping is unsuccessful, then the server MUST return a SASL failure condition of &lt;not-authorized/&gt; and close the stream.</p>
<code><![CDATA[
<failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<not-authorized/>
</failure>
</stream:stream>
]]></code>
<p>If JID mapping is successful but the mapped JID does not match the authorization identity provided (if any), then the server MUST return a SASL failure condition of &lt;invalid-authzid/&gt; and close the stream.</p>
<code><![CDATA[
<failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<invalid-authzid/>
</failure>
</stream:stream>
]]></code>
</li>
</ol>
</li>
<li>
<p>If SASL authentication succeeded, the client opens new stream, then client and server proceed with resource binding as described in <cite>RFC 3920</cite> and <cite>RFC 6120</cite>.</p>
</li>
</ol>
</section1>
<section1 topic='Server-to-Server Recommendation' anchor='s2s'>
<p><cite>RFC 3920</cite> specified that if a JabberID is included in a certificate intended for use by an XMPP server (a "server certificate"), it shall be encapsulated as an xmppAddr. That recommendation is updated in <cite>RFC 6120</cite> through a reference to &rfc6125;, which prefers use of a dNSName and/or SRVName entry in the Subject Alternative Name. The DNS domain name contained in the certificate can be a fully-qualified domain name ("FQDN") or a so-called "wildcard" with the '*' character as the complete left-most label (see <cite>RFC 6125</cite> for complete details).</p>
<p>The RECOMMENDED protocol flow for server-to-server use of SASL EXTERNAL with server (domain) certificates is as follows:</p>
<ol>
<li>
<p>Server1 initiates stream to server2.</p>
<code><![CDATA[
<stream:stream
xmlns:stream='http://etherx.jabber.org/streams'
xmlns='jabber:server'
from='conference.example.org'
to='example.com'
version='1.0'>
]]></code>
</li>
<li>
<p>Server2 replies with stream header.</p>
<code><![CDATA[
<stream:stream
xmlns:stream='http://etherx.jabber.org/streams'
xmlns='jabber:server'
id='s2s_234'
from='example.com'
to='conference.example.org'
version='1.0'>
]]></code>
</li>
<li>
<p>Server2 advertises TLS stream feature, which might indicate that TLS is mandatory-to-negotiate.</p>
<code><![CDATA[
<stream:features>
<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
<required/>
</starttls>
</stream:features>
]]></code>
</li>
<li>
<p>Server1 sends STARTTLS command to Server2.</p>
<code><![CDATA[
<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
]]></code>
</li>
<li>
<p>Server2 informs Server1 to proceed.</p>
<code><![CDATA[
<proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
]]></code>
</li>
<li>
<p>Server2 requests, and Server1 presents, Server1's certificate during TLS negotiation.</p>
</li>
<li>
<p>Server2 validates certificate in accordance with the rules from <cite>RFC 6120</cite> and <cite>RFC 6125</cite>.</p>
<ol style='list-style-type:lower-alpha'>
<li>
<p>If certificate is unacceptable for the reasons explained in <cite>RFC 6120</cite> and <cite>RFC 6125</cite>, Server2 closes Server1's TCP connection.</p>
</li>
<li>
<p>Else Server2 completes successful TLS negotiation and Server1 sends a new initial stream header to Server2 over the encrypted TCP connection.</p>
<code><![CDATA[
<stream:stream
xmlns:stream='http://etherx.jabber.org/streams'
xmlns='jabber:server'
from='conference.example.org'
to='example.com'
version='1.0'>
]]></code>
</li>
</ol>
</li>
<li>
<p>Server2 replies with stream header.</p>
<code><![CDATA[
<stream:stream
xmlns:stream='http://etherx.jabber.org/streams'
xmlns='jabber:server'
id='s2s_345'
from='example.com'
to='conference.example.org'
version='1.0'>
]]></code>
</li>
<li>
<p>Server2 advertises SASL mechanisms. If the 'from' attribute of the stream header sent by Server1 can be matched against one of the identifiers provided in the certificate following the matching rules from <cite>RFC 6125</cite>, Server2 SHOULD advertise the SASL EXTERNAL mechanism. If no match is found, Server2 MAY either close Server1's TCP connection or continue with a &xep0220; negotiation.</p>
<code><![CDATA[
<stream:features>
<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<mechanism>EXTERNAL<mechanism>
<required/>
</mechanisms>
</stream:features>
]]></code>
</li>
<li>
<p>Server1 considers EXTERNAL to be its preferred SASL mechanism. For server-to-server authentication, the &lt;auth/&gt; element MAY include an authorization identity, however a future version of this specification might disallow use of the authorization identity in server-to-server authentication (in the following example, Server1 includes an empty response of "=" as shown in <cite>RFC 6120</cite>).</p>
<code><![CDATA[
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='EXTERNAL'>=</auth>
]]></code>
<p>Interoperability Note: Previous versions of this specification relied on the authorization identity being present on the receiving server. Even though this is no longer required, the connecting server should include it for backward compability.</p>
</li>
<li>
<p>Server2 determines if hostname is valid.</p>
<ol style='list-style-type:lower-alpha'>
<li>
<p>If the 'from' attribute of stream header sent by Server1 can be matched against one of the identifiers provided in the certificate following the matching rules from <cite>RFC 6125</cite>, Server2 returns success.</p>
<code><![CDATA[
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
]]></code>
<p>Implementation Note: If Server2 needs to assign an authorization identity during SASL negotiation, it SHOULD use the value of the 'from' attribute of the stream header sent by Server1.</p>
</li>
<li>
<p>Else Server2 MUST return a &notauthorized; stream error and close the stream.</p>
<code><![CDATA[
<failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<not-authorized/>
</failure>
</stream:stream>
]]></code>
</li>
</ol>
</li>
</ol>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<p>This document introduces no security considerations or concerns above and beyond those discussed in <cite>RFC 6120</cite> and <cite>RFC 6125</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'>
<p>This document requires no interaction with the &REGISTRAR;.</p>
</section1>
<section1 topic='Acknowledgements' anchor='ack'>
<p>Thanks to Dave Cridland, Philipp Hancke, Joe Hildebrand, Justin Karneges, Chris Newton, Rob Norris, and Matthias Wimmer for their comments.</p>
</section1>
<section1 topic='Author Note' anchor='authornote'>
<p>Peter Millard, co-author of the initial version of this specification, died on April 26, 2006. The remaining author appreciates his assistance in defining the best practices described herein.</p>
</section1>
</xep>