HACX to route around censorship

This commit is contained in:
Travis Burtrum 2018-05-02 23:44:18 -04:00
parent 34f68c6b6a
commit ff386ef484
2 changed files with 133 additions and 0 deletions

inbox/hacx.xml Normal file
View File

@ -0,0 +1,129 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<title>XMPP Connections across HTTPS (HACX)</title>
<abstract>This specification defines a procedure to look up various connection methods for an XMPP server over HTTPS, with a focus on censorship resistance.</abstract>
<type>Standards Track</type>
<spec>RFC 5785</spec>
<remark><p>First draft.</p></remark>
<section1 topic='Introduction' anchor='intro'>
<p>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.</p>
<section1 topic='Requirements' anchor='reqs'>
<p>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 and use
methods to increase the security of this HTTPS request using all available
means such as HPKP (&rfc7469;), HSTS (&rfc6797;), DANE (&rfc6698;), etc.
<p>A HACX document is retrieved over secure HTTP in the
following way:</p>
<li>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
GET /.well-known/xmpp-client.xml HTTP/1.1
Host: montague.tld.</li>
<li>If the server has a HACX document, it responds with the document like so:
<example caption='Example HACX document'><![CDATA[
<hacx ttl="604800">
<tls ip="fd00:feed:dad:beef::1" port="443" priority="5"/>
<tls ip="" port="443" priority="10" sni="fronting.tld" alpn="aDI="/>
<tls ip="" port="443" priority="15" sni="montague.tld" alpn="eG1wcC1jbGllbnQ=">
<public-key-pin sha-256="4/mggdlVx8A3pvHAWW5sD+qJyMtUHgiRuPjVC48N0XQ=" sha-512="25N+1hB2Vo42l9lSGqw+n3BKFhDHsyork8ou+D9B43TXeJ1J81mdQEDqm39oR/EHkPBDDG1y5+AG94Kec0xVqA=="/>
<websocket url="wss://montague.tld/ws" ip="" port="443" priority="20" weight="50" sni="anotherfront.tld">
<bosh url="https://example.tld/bosh" ip="fd00:feed:dad:beef::2" port="443" priority="20" weight="50">
The document is defined as such:
<li>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.</li>
<li>tls element: This connection type is &xep0368; style Direct TLS connection</li>
<li>websocket element: This connection type is &rfc7395; websocket connection</li>
<li>bosh element: This connection type is &xep0206; bosh connection</li>
<li>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 <link url="https://www.iana.org/assignments/hash-function-text-names/hash-function-text-names.xhtml">hash name</link>. 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;)</li>
<li>ip attribute: MUST be provided as either an IPv4 or IPv6 address, implementors SHOULD provide both IPv4 and IPv6 options.</li>
<li>port attribute: MUST be provided, for maximum censorship resistance implementors are encouraged to use 443 to blend with HTTPS.</li>
<li>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</li>
<li>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.</li>
<li>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.</li>
<li>priority attribute: MUST be provided, same as definition in &rfc2782; SRV records</li>
<li>weight attribute: If missing, default to 0, same as definition in &rfc2782; SRV records</li>
<li>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.</li>
<li>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.</li>
<li>If the server does not have or know about a HACX document, it MUST respond with HTTP status code 404 (Not Found).</li>
<section1 topic='Use Cases' anchor='usecases'>
<p>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.</p>
<section1 topic='Implementation Notes' anchor='impl'>
<p>This should be trivial to implement for any program that already implements &xep0368; and &posh;, much of the same code can be reused.</p>
<p>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.</p>
<section1 topic='Security Considerations' anchor='security'>
<p>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.</p>
<p>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;).</p>
<p>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;</p>
<section1 topic='IANA Considerations' anchor='iana'>
<p>Well-known URIs (&rfc5785;) requires registration of new URI suffixes. This document specifies two URI suffixes:</p>
URI Suffix: xmpp-client.xml<br/>
Change Controller: XSF<br/>
Reference: [TODO: HACX LINK HERE]<br/>
Related Information: XMPP jabber:client namespace<br/>
URI Suffix: xmpp-server.xml<br/>
Change Controller: XSF<br/>
Reference: [TODO: HACX LINK HERE]<br/>
Related Information: XMPP jabber:server namespace<br/>
<p>The Well-known URI registry is currently located <link url='https://www.iana.org/assignments/well-known-uris/well-known-uris.xml'>here</link>.</p>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<p>This document requires no interaction with the &REGISTRAR;.</p>

View File

@ -636,6 +636,7 @@ THE SOFTWARE.
<!ENTITY rfc5646 "<span class='ref'><link url='http://tools.ietf.org/html/rfc5646'>RFC 5646</link></span> <note>RFC 5646: Tags for Identifying Languages &lt;<link url='http://tools.ietf.org/html/rfc5646'>http://tools.ietf.org/html/rfc5646</link>&gt;.</note>" >
<!ENTITY rfc5763 "<span class='ref'><link url='http://tools.ietf.org/html/rfc5763'>RFC 5763</link></span> <note>RFC 5763: Framework for Establishing a Secure Real-time Transport Protocol (SRTP) Security Context Using Datagram Transport Layer Security (DTLS) &lt;<link url='http://tools.ietf.org/html/rfc5763'>http://tools.ietf.org/html/rfc5763</link>&gt;.</note>" >
<!ENTITY rfc5766 "<span class='ref'><link url='http://tools.ietf.org/html/rfc5766'>RFC 5766</link></span> <note>RFC 5766: Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN) &lt;<link url='http://tools.ietf.org/html/rfc5766'>http://tools.ietf.org/html/rfc5766</link>&gt;.</note>" >
<!ENTITY rfc5785 "<span class='ref'><link url='http://tools.ietf.org/html/rfc5785'>RFC 5785</link></span> <note>RFC 5785: Defining Well-Known Uniform Resource Identifiers (URIs) &lt;<link url='http://tools.ietf.org/html/rfc5785'>http://tools.ietf.org/html/rfc5785</link>&gt;.</note>" >
<!ENTITY rfc5802 "<span class='ref'><link url='http://tools.ietf.org/html/rfc5802'>RFC 5802</link></span> <note>RFC 5802: Salted Challenge Response Authentication Mechanism (SCRAM) SASL and GSS-API Mechanisms &lt;<link url='http://tools.ietf.org/html/rfc5802'>http://tools.ietf.org/html/rfc5802</link>&gt;.</note>" >
<!ENTITY rfc5888 "<span class='ref'><link url='http://tools.ietf.org/html/rfc5888'>RFC 5888</link></span> <note>RFC 5888: The Session Description Protocol (SDP) Grouping Framework &lt;<link url='http://tools.ietf.org/html/rfc5888'>http://tools.ietf.org/html/rfc5888</link>&gt;.</note>" >
<!ENTITY rfc5929 "<span class='ref'><link url='http://tools.ietf.org/html/rfc5929'>RFC 5929</link></span> <note>RFC 5929: Channel Bindings for TLS &lt;<link url='http://tools.ietf.org/html/rfc5929'>http://tools.ietf.org/html/rfc5929</link>&gt;.</note>" >
@ -663,11 +664,14 @@ THE SOFTWARE.
<!ENTITY rfc6473 "<span class='ref'><link url='http://tools.ietf.org/html/rfc6473'>RFC 6473</link></span> <note>RFC 6473: vCard KIND:application &lt;<link url='http://tools.ietf.org/html/rfc6473'>http://tools.ietf.org/html/rfc6351</link>&gt;.</note>" >
<!ENTITY rfc6544 "<span class='ref'><link url='http://tools.ietf.org/html/rfc6544'>RFC 6544</link></span> <note>RFC 6544: TCP Candidates with Interactive Connectivity Establishment (ICE) &lt;<link url='http://tools.ietf.org/html/rfc6544'>http://tools.ietf.org/html/rfc6544</link>&gt;.</note>" >
<!ENTITY rfc6648 "<span class='ref'><link url='http://tools.ietf.org/html/rfc6648'>RFC 6648</link></span> <note>RFC 6648: Deprecating the X- Prefix and Similar Constructs in Application Protocols &lt;<link url='http://tools.ietf.org/html/rfc6648'>http://tools.ietf.org/html/rfc6648</link>&gt;.</note>" >
<!ENTITY rfc6698 "<span class='ref'><link url='http://tools.ietf.org/html/rfc6698'>RFC 6698</link></span> <note>RFC 6698: The DNS-Based Authentication of Named Entities (DANE) Transport Layer Security (TLS) Protocol: TLSA &lt;<link url='http://tools.ietf.org/html/rfc6698'>http://tools.ietf.org/html/rfc6698</link>&gt;.</note>" >
<!ENTITY rfc6716 "<span class='ref'><link url='http://tools.ietf.org/html/rfc6716'>RFC 6716</link></span> <note>RFC 6716: Definition of the Opus Audio Codec &lt;<link url='http://tools.ietf.org/html/rfc6716'>http://tools.ietf.org/html/rfc6716</link>&gt;.</note>" >
<!ENTITY rfc6762 "<span class='ref'><link url='http://tools.ietf.org/html/rfc6762'>RFC 6762</link></span> <note>RFC 6762: Multicast DNS &lt;<link url='http://tools.ietf.org/html/rfc6762'>http://tools.ietf.org/html/rfc6762</link>&gt;.</note>" >
<!ENTITY rfc6763 "<span class='ref'><link url='http://tools.ietf.org/html/rfc6763'>RFC 6763</link></span> <note>RFC 6763: DNS-Based Service Discovery &lt;<link url='http://tools.ietf.org/html/rfc6763'>http://tools.ietf.org/html/rfc6763</link>&gt;.</note>" >
<!ENTITY rfc6797 "<span class='ref'><link url='http://tools.ietf.org/html/rfc6797'>RFC 6797</link></span> <note>RFC 6797: HTTP Strict Transport Security (HSTS) &lt;<link url='http://tools.ietf.org/html/rfc6797'>http://tools.ietf.org/html/rfc6797</link>&gt;.</note>" >
<!ENTITY rfc6920 "<span class='ref'><link url='http://tools.ietf.org/html/rfc6920'>RFC 6920</link></span> <note>RFC 6920: Naming Things with Hashes &lt;<link url='http://tools.ietf.org/html/rfc6920'>http://tools.ietf.org/html/rfc6920</link>&gt;.</note>" >
<!ENTITY rfc7081 "<span class='ref'><link url='http://tools.ietf.org/html/rfc7081'>RFC 7081</link></span> <note>RFC 7081: CUSAX: Combined Use of the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP) &lt;<link url='http://tools.ietf.org/html/rfc7081'>http://tools.ietf.org/html/rfc7081</link>&gt;.</note>" >
<!ENTITY rfc7469 "<span class='ref'><link url='http://tools.ietf.org/html/rfc7469'>RFC 7469</link></span> <note>RFC 7469: Public Key Pinning Extension for HTTP &lt;<link url='http://tools.ietf.org/html/rfc7469'>http://tools.ietf.org/html/rfc7469</link>&gt;.</note>" >
<!ENTITY rfc7519 "<span class='ref'><link url='http://tools.ietf.org/html/rfc7519'>RFC 7519</link></span> <note>RFC 7519: JSON Web Token (JWT) &lt;<link url='http://tools.ietf.org/html/rfc7519'>http://tools.ietf.org/html/rfc7519</link>&gt;.</note>" >
<!ENTITY rfc7572 "<span class='ref'><link url='http://tools.ietf.org/html/rfc7572'>RFC 7572</link></span> <note>RFC 7572: Interworking between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP): Instant Messaging &lt;<link url='http://tools.ietf.org/html/rfc7572'>http://tools.ietf.org/html/rfc7572</link>&gt;.</note>" >
<!ENTITY rfc7590 "<span class='ref'><link url='http://tools.ietf.org/html/rfc7590'>RFC 7590</link></span> <note>RFC 7590: Use of Transport Layer Security (TLS) in the Extensible Messaging and Presence Protocol (XMPP) &lt;<link url='http://tools.ietf.org/html/rfc7590'>http://tools.ietf.org/html/rfc7590</link>&gt;.</note>" >