%ents; ]>
Best Practices for Use of SASL EXTERNAL with Certificates This document specifies best practices for XMPP usage of the SASL EXTERNAL mechanism in the context of PKIX certificates. &LEGALNOTICE; 0178 Active Informational Standards Council XMPP Core N/A &stpeter; &pgmillard; 1.1rc1 in progress, last updated 2010-09-24 psa

Updated to reflect draft-ietf-xmpp-3920bis and draft-saintandre-tls-server-id-check.

1.0 2007-02-15 psa

Per a vote of the XMPP Council, advanced specification to Active.

0.7 2007-02-06 psa

Clarified that the scope of this specification is limited to X.509 certificates.

0.6 2007-01-29 psa

Allowed client to not include an authorization identity if the certificate contains no XMPP address (thus depending on the server to assign the identity).

0.5 2007-01-25 psa

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.

0.4 2006-11-27 psa

Modified XMPP address encapsulation methods per rfc3920bis; clarified conditions for certificates to be considered acceptable.

0.3 2006-09-21 psa

Added TLS and SASL required child elements per rfc3920bis.

0.2 2006-03-09 psa

Corrected client-server failure case to place error in SASL flow rather than binding flow; added note about non-X.509 usages.

0.1 2006-03-09 psa

Initial version.

0.0.3 2006-02-10 psa/pgm

Specified inclusion of authorization identity for server-to-server.

0.0.2 2006-02-10 psa/pgm

Clarified distinction between authentication and authorization.

0.0.1 2006-02-09 psa/pgm

First draft.

XMPP as specified in &rfc3920; and provisionally clarified in &rfc3920bis; 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 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;., expecially when an XMPP service indicates that TLS is mandatory-to-negotiate. The protocol flows when TLS is not required are more complicated (e.g., alternate flows involving server dialback) and may be described in a future version of this document.

As specified in RFC 3920 and provisionally clarified in rfc3920bis, during the stream negotiation process an XMPP client can present a certificate (here called an "end-user certificate"). If a JabberID is included in an end-user 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 5.1.1. of RFC 3920 and Section 13.7.1.4 of rfc3920bis.

There are three possible cases:

  1. The certificate includes one xmppAddr.
  2. The certificate includes more than one xmppAddr.
  3. The certificate includes no xmppAddr.

This specification includes recommendations that address all three cases.

The RECOMMENDED protocol flow for client-to-server use of SASL EXTERNAL with end-user certificates is as follows:

  1. Client initiates stream to server.

    ]]>
  2. Server replies with stream header.

    ]]>
  3. Server advertises TLS stream feature, which might indicate that TLS is mandatory-to-negotiate.

    ]]>
  4. Client sends STARTTLS command to server.

    ]]>
  5. Server informs client to proceed.

    ]]>
  6. Client presents its certificate during TLS negotiation.

  7. Server and client negotiate TLS; if successful, client initiates a new initial stream header to server over the encrypted TCP connection.

    ]]>
  8. Server replies with response stream header.

    ]]>
  9. Server advertises SASL mechanisms. Here the server offers and prefers the SASL EXTERNAL mechanism (see Section 6.2.4 of rfc3920bis for recommendations regarding the conditions under which to offer the SASL EXTERNAL mechanism).

    EXTERNAL DIGEST-MD5 ANONYMOUS ]]>
  10. Client considers EXTERNAL to be its preferred SASL mechanism. Here the client does not include an authorization identity and therefore sets the XML character data of the <auth/> element to "=", indicating an empty response (see Section 6.2.8 of rfc3920bis for recommendations regarding the conditions under which to include an authorization identity).

    = ]]>
  11. Server determines whether to allow authentication and authorization of user.

    1. 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.

      ]]>
    2. 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.

      ]]>

      If no authorization identity is included, then the server MUST return a SASL failure case of <invalid-authzid/> and close the stream.

      ]]>
    3. 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.

      ]]>

      If JID mapping is unsuccessful, then the server MUST return a SASL failure condition of <not-authorized/> and close the stream.

      ]]>

      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 <invalid-authzid/> and close the stream.

      ]]>
  12. If SASL authentication succeeded, the client opens new stream, then client and server proceed with resource binding as described in RFC 3920 and rfc3920bis.

RFC 3920 specified that if a JabberID is included in a certificate intended for use by an XMPP server (here called a "domain certificate"), it shall be encapsulated as an xmppAddr. That recommendation is udpated in rfc3920bis through a reference to &certid;, 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.

The RECOMMENDED protocol flow for server-to-server use of SASL EXTERNAL with server (domain) certificates is as follows:

  1. Server1 initiates stream to server2.

    ]]>
  2. Server2 replies with stream header.

    ]]>
  3. Server2 advertises TLS stream feature, which might indicate that TLS is mandatory-to-negotiate.

    ]]>
  4. Server1 sends STARTTLS command to Server2.

    ]]>
  5. Server2 informs Server1 to proceed.

    ]]>
  6. Server1 presents its certificate during TLS negotiation.

  7. Server2 validates certificate in accordance with the rules from rfc3920bis and draft-saintandre-tls-server-id-check.

    1. If certificate is unacceptable for the reasons explained in rfc3920bis and draft-saintandre-tls-server-id-check, Server2 closes Server1's TCP connection.

    2. Else Server2 completes successful TLS negotiation and Server1 sends a new initial stream header to Server2 over the encrypted TCP connection.

      ]]>
  8. Server2 replies with stream header.

    ]]>
  9. Server2 advertises SASL mechanisms. If Server2 expects that Server1 will be able to authenticate and authorize as the identity provided in the certificate that Server1 already provided, then Server2 SHOULD advertise the SASL EXTERNAL mechanism.

    EXTERNAL ]]>
  10. Server2 considers EXTERNAL to be its preferred SASL mechanism. Here it includes a base-64-encoded authorization identity as the XML character data of the <auth/> element, setting it to the same value as the 'from' address on the stream header it sent to Server2.

    Y29uZmVyZW5jZS5leGFtcGxlLm9yZwo= ]]>

    (In this case, the authorization identity is "conference.example.org".)

  11. Server2 determines if hostname is valid.

    1. If the authorization identity provided by Server1 can be matched against one of the identifiers provided in the certificate following the matching rules from draft-saintandre-tls-server-id-check, Server2 returns success.

      ]]>
    2. Else server MUST return a ¬authorized; stream error and close the stream.

      ]]>

This document introduces no security considerations or concerns above and beyond those discussed in RFC 3920.

This document requires no interaction with &IANA;.

This document requires no interaction with the ®ISTRAR;.

Thanks to Dave Cridland, Philipp Hancke, Joe Hildebrand, Justin Karneges, Chris Newton, Rob Norris, and Matthias Wimmer for their comments.

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.