1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-22 01:02:17 -05:00
xeps/xep-0178.xml

339 lines
13 KiB
XML
Raw Normal View History

<?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</title>
<abstract>This document specifies best practices for use of the SASL EXTERNAL mechanism within XMPP.</abstract>
&LEGALNOTICE;
<number>0178</number>
<status>Experimental</status>
<type>Informational</type>
<jig>Standards JIG</jig>
<approver>Council</approver>
<dependencies>
<spec>XMPP Core</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>N/A</shortname>
&stpeter;
&pgmillard;
<revision>
<version>0.3</version>
<date>2006-09-21</date>
<initials>psa</initials>
<remark><p>Added TLS and SASL required child elements per rfc3920bis.</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'>
&BISNOTE;
<p><cite>RFC 3920</cite> allows the use of any SASL mechanism (see &rfc4422;) in XMPP authentication, including the SASL EXTERNAL mechanism. This document specifies a recommended protocol flow for such use, specifically when use of TLS is required by a deployment. <note>The protocol flows when TLS is not required are more complicated (e.g., alternate flows involving server dialback) and may be documented in a future version of this document.</note></p>
</section1>
<section1 topic='Client-to-Server Recommendation' anchor='c2s'>
<p>The RECOMMENDED protocol flow for client-to-server use of SASL EXTERNAL with end-user 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'
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'
version='1.0'>
]]></code>
</li>
<li>
<p>Server advertises TLS stream feature.</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>Client presents certificate.</p>
</li>
<li>
<p>Server validates certificate.</p>
<ol>
<li>
<p>If certification authority is untrusted or certificate has been revoked, server closes client's TCP connection.</p>
</li>
<li>
<p>Else server completes successful TLS negotiation and client initiates a new stream header to server.</p>
<code><![CDATA[
<stream:stream
xmlns:stream='http://etherx.jabber.org/streams'
xmlns='jabber:client'
to='example.com'
version='1.0'>
]]></code>
</li>
</ol>
</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_345'
from='example.com'
version='1.0'>
]]></code>
</li>
<li>
<p>Server advertises SASL mechanisms. Because client presented a certificate, server advertises and prefers 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>Because client presented a certificate, client SHOULD consider EXTERNAL to be its preferred SASL mechanism. The client SHOULD NOT include an authorization identity (i.e., XML character data for the &lt;auth/&gt; element) since client-to-server authorization in XMPP is handled during resource binding.</p>
<code><![CDATA[
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='EXTERNAL'/>
]]></code>
</li>
<li>
<p>Server determines whether to allow authenticatation of user.</p>
<ol>
<li>
<p>If the certificate presented by the client contains only one valid XMPP address <note>A valid XMPP address is a JID encapsulated as a subjectAltName with an ASN.1 Object Identifier of "id-on-xmppAddr" (which is equivalent to the dotted display format of "1.3.6.1.5.5.7.8.5").</note> that corresponds to a registered account on the server, the server SHOULD allow authentication 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), the server SHOULD allow authentication of the JID whose hostname matches the 'to' address of the stream header sent by the client to the server.</p>
<code><![CDATA[
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
]]></code>
</li>
<li>
<p>If the certificate does not contain a valid XMPP address that corresponds to a registered account on the server, 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 in the certificate; if such a JID mapping is successful, the server SHOULD allow authentication of that mapped JID.</p>
<code><![CDATA[
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
]]></code>
</li>
<li>
<p>If the user cannot be associated with an account registered on the server, the server MUST return a SASL failure 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>
</li>
</ol>
</li>
<li>
<p>If SASL authentication succeeded, client opens new stream, then client and server proceed with resource binding as described in <cite>RFC 3920</cite>.</p>
</li>
</ol>
</section1>
<section1 topic='Server-to-Server Recommendation' anchor='s2s'>
<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.</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>Server1 presents certificate.</p>
</li>
<li>
<p>Server2 validates certificate.</p>
<ol>
<li>
<p>If certification authority is untrusted or certificate has been revoked, Server2 closes Server1's TCP connection.</p>
</li>
<li>
<p>Else Server2 completes successful TLS negotiation and Server1 initiates a new stream header 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>
</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. Because Server1 presented a certificate, Server2 advertises SASL EXTERNAL mechanism.</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>Because Server1 presented a certificate, Server1 SHOULD consider EXTERNAL to be its preferred SASL mechanism. Server1 SHOULD include an authorization identity (base64-encoded as described in RFC 3920) as the XML character data of the &lt;auth/&gt; element, which SHOULD be the same as the 'from' address on the stream header.</p>
<code><![CDATA[
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='EXTERNAL'>Y29uZmVyZW5jZS5leGFtcGxlLm9yZwo=</auth>
]]></code>
<p>(In this case, the authorization identity is "conference.example.org".)</p>
</li>
<li>
<p>Server2 determines if hostname is valid.</p>
<ol>
<li>
<p>If the authorization identity provided by Server1 matches one of the valid XMPP addresses <note>A valid XMPP address is a JID encapsulated as a subjectAltName with an ASN.1 Object Identifier of "id-on-xmppAddr" (which is equivalent to the dotted display format of "1.3.6.1.5.5.7.8.5").</note> in the certificate or one of the Common Names in the certificates, Server2 SHOULD return success.</p>
<code><![CDATA[
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
]]></code>
</li>
<li>
<p>Else server MUST return a &notauthorized; failure 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='Use of SASL EXTERNAL Without Certificates' anchor='other'>
<p>The SASL EXTERNAL mechanism can be used outside the context of X.509 certificates, for example via Internet Protocol Security (IPSec) as specified in &rfc4301;. A future version of this specification may document best practices for use of SASL EXTERNAL outside the context of the X.509 infrastructure.</p>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<p>This document introduces no security considerations or concerns above and beyond those discussed in <cite>RFC 3920</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='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>