%ents; ]>
XMPP Connections across HTTPS (HACX) This specification defines a procedure to look up various connection methods for an XMPP server over HTTPS, with a focus on censorship resistance. &LEGALNOTICE; xxxx ProtoXEP Standards Track Standards Council XEP-0368 RFC 5785 NOT_YET_ASSIGNED Travis Burtrum travis@burtrum.org travis@burtrum.org 0.0.2 2018-05-16 tjb

Fix requirements, editing, add alternatives.

0.0.1 2018-05-01 tjb

First draft.

Various methods exist to connect to XMPP servers over direct TLS, &xep0368; defines SRV records, &rfc7395; defines websocket, &xep0206; defines BOSH. HACX defines a method to retrieve all of those along with optional extra information such as SNI/ALPN requirements and pinned public keys from a &rfc5785; well-known URI over HTTPS.

Several alternatives were considered to avoid writing yet-another-spec but they were all deficient in various ways:

HACX servers MUST use HTTPS. This means that the HACX client MUST verify the certificate of the HTTPS service at the source domain in order to securely "bootstrap" into the use of HACX; specifically, the rules of &rfc2818; apply to this "bootstrapping" step to provide a secure basis for all subsequent HACX operations. HACX clients and servers MUST support HPKP (&rfc7469;), HSTS (&rfc6797;), and DANE (&rfc6698;), and SHOULD support any future standard that serves to increase the security of this HTTPS request.

A HACX document is retrieved over secure HTTP in the following way:

  1. The HACX client performs an HTTPS GET request at the source domain to the path "/.well-known/xmpp-{client/server}.xml". The value of "{client/server}" is either "client" or "server" depending on if you want to connect to a server providing the jabber:client or jabber:server namespace. For example, if a client is trying to connect a user with the jid romeo@montague.tld using HACX, then the HTTPS GET request would be as follows: GET /.well-known/xmpp-client.xml HTTP/1.1 Host: montague.tld.
  2. If the server has a HACX document, it responds with the document like so: ]]> The document is defined as such:
    1. ttl attribute: If missing, assume a value of 30, MUST be non-negative integer representing number of seconds to cache this document. If connectivity is blocked, you SHOULD still use this document past TTL expiration.
    2. tls element: This connection type is &xep0368; style Direct TLS connection
    3. websocket element: This connection type is &rfc7395; websocket connection
    4. bosh element: This connection type is &xep0206; bosh connection
    5. public-key-pin element: This can be on any connection type, and is a base64 hash of the DER encoding of certificate's public key, not the certificate itself, HPKP (&rfc7469;) style. Multiple of these may be provided, only one must match, and all different hash types for a single element MUST match the same key so only one hash type need be checked. If these are provided and none match, the connection MUST be considered untrusted and MUST be aborted. Attributes can be any valid registered hash name. If missing, TLS certificates MUST be validated the same way as for STARTTLS. (i.e., as specified in &xmppcore;), or another equivalent such as DANE (&rfc6698;) or POSH (&posh;)
    6. ip attribute: MUST be provided as either an IPv4 or IPv6 address, implementors SHOULD provide both IPv4 and IPv6 options.
    7. port attribute: MUST be provided, for maximum censorship resistance implementors are encouraged to use 443 to blend with HTTPS.
    8. url attribute: MUST be provided for websocket/bosh elements, MUST NOT be provided for tls elements, protocol MUST be wss:// for websocket, https:// for bosh (mandatory TLS), ip and port MUST be overriden with ip/port attributes, hostname in URL MUST be sent in HTTP Host: header
    9. sni attribute: If missing, HACX client MUST NOT use/set the SNI TLS extension at all, if set, HACX client MUST set the SNI TLS extension to this value exactly.
    10. alpn attribute: If missing, HACX client MUST NOT use/set the ALPN (&rfc7301;) TLS extension at all, if set, HACX client MUST base64 decode this field and set the ALPN TLS extension to that value exactly. MUST NOT be provided for websocket/bosh elements so proper http protocol can be negotiated.
    11. priority attribute: MUST be provided, same as definition in &rfc2782; SRV records
    12. weight attribute: If missing, default to 0, same as definition in &rfc2782; SRV records
    13. HACX clients MUST discard any connection method they don't have support for, or do not wish to try due to privacy reasons (ALPN set to xmpp-client), then SHOULD try them in proper priority/weight order until a successful connection is achieved. Any type of connection error MUST trigger a fallback to the next record. Common errors include invalid protocol (HTTP when you expect XMPP), TLS certificate validation errors, and more.
  3. If the server knows where a HACX document can be found, it MUST respond with a HTTP status code 302 (Found) and a redirect to the correct location. The location provided in the redirect response MUST specify an HTTPS URI. To protect against circular references, it is RECOMMENDED that HACX clients follow no more than 10 redirects, although applications or implementations can require that fewer redirects be followed.
  4. If the server does not have or know about a HACX document, it MUST respond with HTTP status code 404 (Not Found).

HACX provides a simple way to look up exactly how to connect to any given XMPP server in a simple, censorship resistant, distributed way. An attacker would have to block all A and AAAA record lookups and/or HTTPS to completely block this lookup, and even then it's easily done over something like Tor which otherwise does not support things like DNS SRV or TXT lookups. Additionally, DNS SRV records can not provide values for SNI or ALPN extensions, or a relative priority for other connections methods like BOSH and Websockets.

This should be trivial to implement for any program that already implements &xep0368; and &posh;, much of the same code can be reused.

Server operators might want to prioritize connection methods that maximize privacy, like no ALPN, domain fronting (different SNI value), or no SNI. Consider looking at everything available at an HTTP level to potentially lie to attackers, while providing correct info to users. Consider providing different sets of servers to different IP blocks or regions. Consider using any of the multitude of free or cheap HTTP hosts or CDNs to forward traffic to your real server. The possibilities are endless.

POSH (&posh;) already provides the ability of anyone with control of an HTTPS server to override trust of TLS certificates for the XMPP server matching that domain, HACX is slightly different in that it pins public keys like HPKP (&rfc7469;) and not certificates like POSH, but the delegation is the same.

HACX additionally delegates what were previously DNS lookups to the HTTPS server, since this is protected by TLS certificate validation, this should be even more secure than plain DNS, equivalent to something like DNS-over-HTTPS or DNS-over-TLS, but without trusting a 3rd party DNS server. DNSSEC delegation is preserved as well since it protects the A/AAAA record for the HTTPS host, and can also validate it with DANE (&rfc6698;).

This does allow anyone with write access to the /.well-known/ directory on an HTTPS host to host a XMPP server for that domain even if they don't have access to create DNS records or listen on port 5222, but this was already true due to &xep0156; (HTTP Lookup Method) and &rfc7395;

Well-known URIs (&rfc5785;) requires registration of new URI suffixes. This document specifies two URI suffixes:

URI Suffix: xmpp-client.xml
Change Controller: XSF
Reference: [TODO: HACX LINK HERE]
Related Information: XMPP jabber:client namespace

URI Suffix: xmpp-server.xml
Change Controller: XSF
Reference: [TODO: HACX LINK HERE]
Related Information: XMPP jabber:server namespace

The Well-known URI registry is currently located here.

This document requires no interaction with the ®ISTRAR;.