XEP-0368: SRV records for XMPP over TLS

Abstract
This specification defines a procedure to look up xmpps-client/xmpps-server SRV records (for direct TLS connections) in addition to xmpp-client/xmpp-server and mix weights/priorities.
Author
Travis Burtrum
Copyright
© 2015 – 2019 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

Stable

NOTICE: The protocol defined herein is a Stable Standard of the XMPP Standards Foundation. Implementations are encouraged and the protocol is appropriate for deployment in production systems, but some changes to the protocol are possible before it becomes a Final Standard.
Type
Standards Track
Version
1.1.0 (2019-08-20)
Document Lifecycle
  1. Experimental
  2. Proposed
  3. Stable
  4. Final

1. Introduction

XMPP Core [1] specifies the use of xmpp-client/xmpp-server SRV records as the method of discovering how to connect to an XMPP server. This XEP extends that to include new xmpps-client/xmpps-server SRV records pointing to direct TLS ports and combine priorities and weights as if they were a single SRV record similar to RFC 6186 [2]. It also provides an easy way for clients to bypass restrictive firewalls that only allow HTTPS, for servers to host multiple protocols/services on a single port, and for servers and clients to take advantage of less round trips and existing direct TLS loadbalancers.

2. Glossary

Direct TLS
Where TLS is attempted immediately on connect to a TCP socket, like how HTTPS works, not like how STARTTLS works with any protocol.

3. Requirements

The following format for DNS SRV resource records is specified in RFC 2782 [3]:

    _service._proto.name. TTL class SRV priority weight port target.

XMPP Core [1] defines SRV records only where 'service' is 'xmpp-client' and 'xmpp-server'. This document specifies two additionally look up records where 'service' is 'xmpps-client' and 'xmpps-server'. This document specifies that the following additional rules apply:

  1. Both 'xmpp-' and 'xmpps-' records SHOULD be treated as the same record with regard to connection order as specified by RFC 2782 [3], in that all priorities and weights are mixed. This enables the server operator to decide if they would rather clients connect with STARTTLS or direct TLS. However, clients MAY choose to prefer one type of connection over the other.
  2. Where 'service' starts with 'xmpps-' the client or server MUST connect with direct TLS enabled.
  3. Where 'service' starts with 'xmpp-' the client or server MUST NOT connect with direct TLS enabled, connection method is unchanged from XMPP Core [1].
  4. TLS certificates MUST be validated the same way as for STARTTLS. (i.e., as specified in XMPP Core [1]).
  5. STARTTLS MUST NOT be used over direct TLS connections.
  6. Client or server MUST set SNI TLS extension to the JID's domain part.
  7. Client or server SHOULD set the ALPN (RFC 7301 [4]) TLS extension.
  8. When ALPN is used, the ALPN protocol MUST be 'xmpp-client', where the SRV service is 'xmpps-client'.
  9. When ALPN is used, the ALPN protocol MUST be 'xmpp-server', where the SRV service is 'xmpps-server'.

4. Use Cases

For server operators, this provides a way to host multiple services on the same port, especially when SNI or ALPN extensions are used. Servers could even host xmpp-client and xmpp-server services on the same TLS port. For clients, this provides a virtually zero overhead way to bypass restrictive firewalls that only allow HTTP over port 80 and HTTPS over port 443, as XMPP-over-TLS is indistinguishable from HTTP-over-TLS when ALPN is not used. For clients and servers, direct TLS saves round trips vs STARTTLS.

5. Implementation Notes

The only overhead is the single additional SRV lookup. All clients that support STARTTLS already have support for direct TLS.

Server operators should not expect multiplexing (via ALPN) to work in all scenarios and therefore should provide additional SRV record(s) that do not require multiplexing (either standard STARTTLS or dedicated direct XMPP-over-TLS). This is a result of relying on ALPN for multiplexing, where ALPN might not be supported by all devices or may be disabled by a user due to privacy reasons.

If the _xmpps-client (or _xmpps-server) target is set to . (dot), this indicates as per RFC 2782 [3] that the service is not provided for the given domain. In this context, this means that Direct TLS is not supported. In this case, the initiating party SHOULD look up _xmpp-client (or _xmpp-server) records. The initiating party MUST NOT perform A/AAAA fallback as per RFC 6120 [1] (since the service provider has already indicated that the SRV protocol is supported).

6. Security Considerations

Direct TLS provides AT LEAST the same level of security as STARTTLS, and more privacy without ALPN as using STARTTLS leaks that the underlying protocol is XMPP, while any direct TLS stream should be indistinguishable from any other direct TLS stream. Direct TLS provides more security than STARTTLS if RFC 7590 [5] is not followed, as it isn't subject to STARTTLS stripping. All security setup and certificate validation code SHOULD be shared between the STARTTLS and direct TLS logic as well. All SRV-based connection methods are subject to DNS modification/stripping/spoofing of SRV records in the absence of DNSSEC.

7. IANA Considerations

ALPN (RFC 7301 [4]) requires registration of new Protocol IDs. This document specifies two Protocol IDs:

Protocol: XMPP jabber:client namespace
Identification Sequence:
   0x78 0x6d 0x70 0x70 0x2d 0x63 0x6c 0x69 0x65 0x6e 0x74 ("xmpp-client")
Reference: [SRV records for XMPP over TLS (XEP-0368) [6]]

Protocol: XMPP jabber:server namespace
Identification Sequence:
   0x78 0x6d 0x70 0x70 0x2d 0x73 0x65 0x72 0x76 0x65 0x72 ("xmpp-server")
Reference: [SRV records for XMPP over TLS (XEP-0368) [6]]

The ALPN registry is currently located here.

Issues with direct TLS ports mentioned in RFC 2595 [7] Section 7 do not apply here for these reasons:

  1. URL scheme is unchanged.
  2. "Security" is the same between STARTTLS and direct TLS, and post-2014 the general consensus is that no public XMPP server or client should connect without some form of TLS per the ubiquitous encryption manifesto.
  3. A "Use TLS when available" security model is possible here because the client could fall back to standard STARTTLS SRV records if the server administrator supplies them.
  4. No port numbers are assigned because SRV allows using arbitrary ports at the server administrator's discretion.

8. XMPP Registrar Considerations

This document requires no interaction with the XMPP Registrar [8].


Appendices

Appendix A: Document Information

Series
XEP
Number
0368
Publisher
XMPP Standards Foundation
Status
Stable
Type
Standards Track
Version
1.1.0
Last Updated
2019-08-20
Approving Body
XMPP Council
Dependencies
XMPP Core, RFC 2782
Supersedes
None
Superseded By
None
Short Name
NOT_YET_ASSIGNED
Source Control
HTML

This document in other formats: XML  PDF

Appendix B: Author Information

Travis Burtrum
Email
travis@burtrum.org
JabberID
travis@burtrum.org

Copyright

This XMPP Extension Protocol is copyright © 1999 – 2024 by the XMPP Standards Foundation (XSF).

Permissions

Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).

Visual Presentation

The HTML representation (you are looking at) is maintained by the XSF. It is based on the YAML CSS Framework, which is licensed under the terms of the CC-BY-SA 2.0 license.

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.

Appendix E: Discussion Venue

The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.

Discussion on other xmpp.org discussion lists might also be appropriate; see <https://xmpp.org/community/> for a complete list.

Given that this XMPP Extension Protocol normatively references IETF technologies, discussion on the <xsf-ietf@xmpp.org> list might also be appropriate.

Errata can be sent to <editor@xmpp.org>.

Appendix F: Requirements Conformance

The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".

Appendix G: Notes

1. RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core <http://tools.ietf.org/html/rfc6120>.

2. RFC 6186: Use of SRV Records for Locating Email Submission/Access Services <http://tools.ietf.org/html/rfc6186>.

3. RFC 2782: A DNS RR for specifying the location of services (DNS SRV) <http://tools.ietf.org/html/rfc2782>.

4. RFC 7301: Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension <https://tools.ietf.org/html/rfc7301>.

5. RFC 7590: Use of Transport Layer Security (TLS) in the Extensible Messaging and Presence Protocol (XMPP) <http://tools.ietf.org/html/rfc7590>.

6. XEP-0368: SRV records for XMPP over TLS <https://xmpp.org/extensions/xep-0368.html>.

7. RFC 2595: Using TLS with IMAP, POP3 and ACAP <http://tools.ietf.org/html/rfc2595>.

8. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <https://xmpp.org/registrar/>.

Appendix H: Revision History

Note: Older versions of this specification might be available at https://xmpp.org/extensions/attic/

  1. Version 1.1.0 (2019-08-20)

    Describe how to fall back if _xmpps-server/_xmpps-client records cannot be found.

    jsc
  2. Version 1.0.1 (2019-07-15)

    Fix trivial 'to' vs. 'two' typo.

    Nyco
  3. Version 1.0.0 (2017-03-09)

    Advance to draft as approved by the XMPP Council.

    XEP Editor (ssw)
  4. Version 0.1.2 (2017-02-15)

    Implement more last call comments, editorial changes, mixing SRV records is now SHOULD.

    tjb
  5. Version 0.1.1 (2017-02-06)

    Implement last call comments, editorial changes, SNI is now MUST.

    tjb
  6. Version 0.1 (2015-12-15)

    Initial published version approved by the XMPP Council.

    XEP Editor (asw)
  7. Version 0.0.2 (2015-12-15)

    tls proto to tcp, change service instead. Set SNI correctly.

    tjb
  8. Version 0.0.1 (2015-10-31)

    First draft.

    psa

Appendix I: Bib(La)TeX Entry

@report{burtrum2015xep0368,
  title = {SRV records for XMPP over TLS},
  author = {Burtrum, Travis},
  type = {XEP},
  number = {0368},
  version = {1.1.0},
  institution = {XMPP Standards Foundation},
  url = {https://xmpp.org/extensions/xep-0368.html},
  date = {2015-10-31/2019-08-20},
}

END