<?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>S2S Components</title>
  <abstract>This document describes a modernized method of connecting 'components' to a server, expressed as a profile of the existing standard server-to-server protocol.</abstract>
  &LEGALNOTICE;
  <number>XXXX</number>
  <status>ProtoXEP</status>
  <type>Standards Track</type>
  <sig>Standards</sig>
  <dependencies>
    <spec>XMPP Core</spec>
    <spec>XEP-0220</spec>
    <spec>XEP-0288</spec>
  </dependencies>
  <supersedes>
    <spec>XEP-0114</spec>
    <spec>XEP-0225</spec>
  </supersedes>
  <supersededby/>
  <shortname>comp-s2s</shortname>
  &dcridland;
  <revision>
    <version>0.0.1</version>
    <date>2015-01-20</date>
    <initials>dwd</initials>
    <remark>
      <ul>
        <li>Initial Revision</li>
      </ul>
    </remark>
  </revision>
</header>

<section1 topic='Introduction' anchor='intro'>
  <p>Many server implementations of XMPP provide support for hosting external components, which service specific domains.</p>
	<p>There are currently two protocols defined for components. Firstly, there is the well-deployed, but limited, XEP-0114. This models components as a special entity, using a special content namespace on the stream. Use of stream features has never been well-documented, and using them can cause interoperability problems. Furthermore, the authentication model both requires high entropy stream identifiers, providing a potential entropy attack, and moreover uses a single mechanism and hash algorithm. Other issues are documented in XEP-0225.</p>
  <p>XEP-0225 also defines another component protocol, though not widely implemented. It models components in effect as specialist clients, and uses a component binding protocol to bind multiple domains to a single connection, being otherwise a standard C2S connection. This has problems, since the allowable stanza addressing on a real C2S stream is very different to that allowed by a XEP-0225 stream.</p>
  <p>This specification describes a third approach; modelling components as remote servers. This eliminates the special handling at the stream level, and can reuse much of the protocol infrastructure that already exists for S2S.</p>
</section1>

<section1 topic='Overview'>
  <p>A Component provides services for one or more service domains. In order to connect to other service domains, hosted both on a local server and remote servers via federation, a component connects to a single host server. This host server in turn accepts traffic over both S2S and C2S for the component's service domains, and routes (forwards) stanzas to the component for handling.</p>
  <p>In this protocol, a component connects to a host server according to its configuration, and opens an S2S stream to the special domain "__xmpp-component". It then negotiates TLS and BIDI, authenticates via SASL, and then optionally requests further domains via Dialback requests,</p>
  <p>From this point, the communications between the component and host server are in every respect the same as between any two federated servers.</p>
</section1>

<section1 topic='Differences to S2S' anchor='diff'>
  <section2 topic='Discovery and DNS'>
    <p>Components do not perform SRV lookups to locate the server, as they do not connect to any particular domain. Therefore components SHOULD be configured to connect to a specific host and port by the administrator. No default host or port is provided by this specification.</p>
  </section2>
	<section2 topic='Stream Addressing' anchor='to-from'>
		<p>Components do connect to any particular domain; indeed the host server may not have any domain name. In order to avoid the use of an unusual pattern - for example, "to" and "from" being the same - connecting components SHALL use a placeholder label of "__xmpp-component".</p>
    <p>The "from" attribute of the stream MUST be one of the service domains the component intends to host.</p>
	</section2>
  <section2 topic='Mandatory Extension Support'>
    <section3 topic='TLS'>
      <p>Host servers MUST offer, and components SHOULD negotiate, TLS support. Components are sometimes operated on  the same physical machine as the host server, in which case TLS might be considered superfulous.</p>
      <p>Note the comments about use of PKIX under the SASL Authentication section.</p>
    </section3>
    <section3 topic='BiDi'>
      <p>Host servers MUST offer, and components SHALL negotiate, the Bidirectional Stream protocol described in XEP-0288; host servers cannot connect to the component for outbound stanza transmission.</p>
    </section3>
    <section3 topic='Dialback'>
      <p>Host servers MAY offer, and in such cases components MAY use, the XEP-0220 &lt;db:result> framework for requesting hosting for additional service domains. Host servers offering Server Dialback in this way MUST include error support, and MUST NOT attempt the dialback portion of the protocol (ie, MUST NOT attempt to connect and send &lt;db:verify> elements).</p>
      <p>Note that the contents of the &lt;db:result/> elements exchanged between Components and host servers are ignored by both parties.</p>
    </section3>
  </section2>
  <section2 topic='SASL Authentication'>
    <p>Host servers MUST offer, and components SHALL negotiate, SASL authentication. If the EXTERNAL mechanism is implemented, careful consideration may be requierd on what certificates to accept; use of PKIX authorization would imply that the certificate used by the component could also be used by the server. This could be undesirable, and use of configured key identifiers might be preferable.</p>
    <p>For support of deployments where a simple pre-shared secret is preferable, host servers MUST implement SCRAM-SHA1 and SCRAM-SHA1-PLUS.</p>
  </section2>
</section1>

<section1 topic='Security Considerations' anchor='security'>
  <p>The entirety of this document is concerned with security.</p>
</section1>

<section1 topic='IANA Considerations' anchor='iana'>
  <p>This XEP requires no interaction with &IANA;. </p>
</section1>

<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
	<p>None.</p>
</section1>

<section1 topic='Acknowledgements' anchor='ack'>
  <p>This document was inspired by discussions with various members of the community.</p>
</section1>

</xep>
