<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep xmlns="">
<header>
  <title>Hop Check</title>
  <abstract>This document defines an XMPP protocol extension that enables an entity to check the security of client-to-server and server-to-server hops between it and another entity. Note: This specification has been retracted by the author because the problem is not compelling and a real solution would be too complicated.</abstract>
  
<legal>
<copyright>This XMPP Extension Protocol is copyright © 1999 – 2024 by the <link url="https://xmpp.org/">XMPP Standards Foundation</link> (XSF).</copyright>
<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.</permissions>
<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. ##</warranty>
<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.</liability>
<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 &lt;<link url="https://xmpp.org/about/xsf/ipr-policy">https://xmpp.org/about/xsf/ipr-policy</link>&gt; or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).</conformance>
</legal>
  <number>0219</number>
  <status>Retracted</status>
  <type>Standards Track</type>
  <sig>Standards</sig>
  <approver>Council</approver>
  <dependencies>
    <spec>XMPP Core</spec>
  </dependencies>
  <supersedes/>
  <supersededby/>
  <shortname>TO BE ASSIGNED</shortname>
  
  <author>
    <firstname>Peter</firstname>
    <surname>Saint-Andre</surname>
    <email>stpeter@stpeter.im</email>
    <jid>stpeter@jabber.org</jid>
    <uri>https://stpeter.im/</uri>
  </author>

  <revision>
    <version>0.3</version>
    <date>2008-06-12</date>
    <initials>psa</initials>
    <remark><p>Retracted by the author because the problem is not compelling and a real solution would be too complicated.</p></remark>
  </revision>
  <revision>
    <version>0.2</version>
    <date>2007-10-30</date>
    <initials>psa</initials>
    <remark><p>Clarified meaning of encrypted; specified rules for reporting of server-to-server connections.</p></remark>
  </revision>
  <revision>
    <version>0.1</version>
    <date>2007-05-30</date>
    <initials>psa</initials>
    <remark><p>Initial published version.</p></remark>
  </revision>
  <revision>
    <version>0.0.4</version>
    <date>2007-05-16</date>
    <initials>psa</initials>
    <remark><p>Split secure attribute into encrypted (for TLS/SSL) and auth.</p></remark>
  </revision>
  <revision>
    <version>0.0.3</version>
    <date>2007-05-11</date>
    <initials>psa</initials>
    <remark><p>Specified protocol.</p></remark>
  </revision>
  <revision>
    <version>0.0.2</version>
    <date>2007-05-02</date>
    <initials>psa</initials>
    <remark><p>Added more detailed security considerations; broadened applicability to be more similar to traceroute; changed name of status attribute to secure and its type to boolean; added delay attribute; defined XML schema.</p></remark>
  </revision>
  <revision>
    <version>0.0.1</version>
    <date>2007-05-01</date>
    <initials>psa</initials>
    <remark><p>First draft.</p></remark>
  </revision>
</header>

<section1 topic="Introduction" anchor="intro">
  <p><em>Note: This specification has been retracted by the author because the problem is not compelling and a real solution would be too complicated.</em></p>
  <section2 topic="Motivation" anchor="motivation">
    <p>When two XMPP users communicate, one or both of them may want to know the status of the XMPP communications path (i.e., of all the hops) between them. While the primary motivation is to determine if all the hops are secured via Transport Layer Security (see <span class="ref"><link url="http://tools.ietf.org/html/rfc5246">RFC 5246</link></span> <note>RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 &lt;<link url="http://tools.ietf.org/html/rfc5246">http://tools.ietf.org/html/rfc5246</link>&gt;.</note>) as specified for XMPP in <span class="ref"><link url="http://tools.ietf.org/html/rfc6120">XMPP Core</link></span> <note>RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core &lt;<link url="http://tools.ietf.org/html/rfc6120">http://tools.ietf.org/html/rfc6120</link>&gt;.</note>, more general information about the communications path may also be of interest.</p>
    <p>This document describes a protocol for discovering such information, similar in spirit to the traceroute protocol specified in <span class="ref"><link url="http://tools.ietf.org/html/rfc1393">RFC 1393</link></span> <note>RFC 1393: Traceroute Using an IP Option &lt;<link url="http://tools.ietf.org/html/rfc1393">http://tools.ietf.org/html/rfc1393</link>&gt;.</note> but specific to XMPP.</p>
  </section2>
  <section2 topic="Approach" anchor="approach">
    <p>As a user, I may want to know three things:</p>
    <ol>
      <li>If my connection to my server is encrypted.</li>
      <li>If my server's connection to my contact's server is encrypted.</li>
      <li>If my contact's connection to their server is encrypted.</li>
    </ol>
    <p>If the answer to all three of these questions is "yes" and I have some level of trust in my XMPP server (see <link url="#security">Security Considerations</link>) then I have some assurance that communications between me and my contact will not be subject to interception by the likes of "Eve" (a passive attacker who can eavesdrop on messages) and "Mallory" (an active attacker who can maliciously modify messages in transit).</p>
    <p>Note: By "encrypted" is meant channel encryption with Transport Layer Security (or, for client-to-server connections, legacy SSL) using something other than the null cipher. This protocol does not include more sophisticated information about the connection, such as the cipher suite used, the SASL authentication mechanism used (if any), the certificate identity (if any), the trusted roots involved in certificate authenticate, etc.</p>
    <p>The answer to the first question is straightforward, since my client knows if its connection to my server is encrypted (as well as the certificates involved).</p>
    <p>If I trust my server, I can ask it to report on the security of its connection to my contact's server. (Note: Because server-to-server connections are unidirectional and it is possible for the connection in one direction to be encrypted but for the connection in the opposite direction to be unencrypted, my server MUST NOT report the connection to my contact's server as encrypted unless the connection is encrypted in both directions.)</p>
    <p>If the server-to-server connection is encrypted and my server trusts that connection, my server can ask my contact's server to report on the security of my contact's connection.</p>
    <p>By feeling my way along the hops in this manner, I can learn if all three hops are encrypted and therefore can have some assurance that the entire communications path is encrypted.</p>
  </section2>
  <section2 topic="How It Works" anchor="howitworks">
    <p>Because XMPP has a decentralized architecture, there may be multiple hops along the communications path. Consider two users Juliet at capulet.lit and Romeo at montague.lit. <note>This specification uses the example of two clients, but the protocol can be used to check hops between any two XMPP entities.</note> There is one hop from Juliet's client to the capulet.lit server, one hop from the capulet.lit server to the montague.lit server, and one hop from the montague.lit server to Romeo's client. <note>If both capulet.lit and montague.lit are virtual hosts of the same server, it is possible that there are only two hops in this situation rather than three. Moreover, in certain circumstances (e.g., if one of the clients connects to a third-party HTTP connection manager) it is possible for there to be more than three hops. However, this document assumes a standard XMPP architecture.</note></p>
    <p>We assume that Juliet's connection to capulet.lit is encrypted and that she has some trust in her server. If she wants to check the security of the path between her and Romeo, she should would send the following request:</p>
    <example caption="Hop check request"><![CDATA[
<iq type='get'
    from='juliet@capulet.lit/balcony'
    to='capulet.lit'
    id='check1'>
  <hopcheck xmlns='http://www.xmpp.org/extensions/xep-0219.html#ns'
            to='romeo@montague.lit/orchard'/>
</iq>
]]></example>
    <p>Naturally, capulet.lit knows about the security of Juliet's connection to capulet.lit and about the security of its connection to montague.lit. But it does not know about the security of Romeo's connection to montague.net; therefore on behalf of Juliet it needs to ask montague.lit about that hop before returning an answer to Juliet:</p>
    <example caption="Intermediate hop check request"><![CDATA[
<iq type='get'
    from='capulet.lit'
    to='montague.lit'
    id='check2'>
  <hopcheck xmlns='http://www.xmpp.org/extensions/xep-0219.html#ns'
            for='juliet@capulet.lit/balcony'
            to='romeo@montague.lit/orchard'/>
</iq>
]]></example>
    <p>The montague.lit server would then report to capulet.lit regarding the hops from juliet@capulet.lit to romeo@montague.lit/orchard:</p>
    <example caption="Intermediate hop check result"><![CDATA[
<iq type='result'
    from='montague.lit'
    to='juliet@capulet.lit'
    id='check2'>
  <hopcheck xmlns='http://www.xmpp.org/extensions/xep-0219.html#ns'
            for='juliet@capulet.lit/balcony'
            to='romeo@montague.lit/orchard'>
    <hop from='capulet.lit'
         to='montague.lit'
         ip='192.0.2.1'
         delay='7.178'
         auth='EXTERNAL'
         encrypted='1'/>
    <hop from='montague.lit'
         to='romeo@montague.lit/orchard'
         delay='15.734'
         auth='PLAIN'
         encrypted='1'/>
  </hopcheck>
</iq>
]]></example>
    <p>The capulet.lit server would then report to Juliet regarding the security of all the hops:</p>
    <example caption="Hop check result"><![CDATA[
<iq type='result'
    from='capulet.lit'
    to='juliet@capulet.lit/balcony'
    id='check1'>
  <hopcheck xmlns='http://www.xmpp.org/extensions/xep-0219.html#ns'
            from='juliet@capulet.lit/balcony'
            to='romeo@montague.lit/orchard'>
    <hop from='juliet@capulet.lit/balcony'
         to='capulet.lit'
         auth='DIGEST-MD5'
         encrypted='true'/>
    <hop from='capulet.lit'
         to='montague.lit'
         ip='192.0.2.1'
         delay='11.602'
         auth='EXTERNAL'
         encrypted='true'/>
    <hop from='montague.lit'
         to='romeo@montague.lit/orchard'
         delay='15.734'
         auth='PLAIN'
         encrypted='1'/>
  </hopcheck>
</iq>
]]></example>
    <p>The foregoing shows only the "happy path"; many alternate flows and error conditions are possible, as described in the <link url="#protocol">Protocol</link> section of this document.</p>
  </section2>
</section1>

<section1 topic="Protocol" anchor="protocol">
  <section2 topic="Request" anchor="protocol-request">
    <p>In order for an entity to check the communications path between itself and a target entity, the entity shall generate a hopcheck request of the following form:</p>
    <code><![CDATA[
<iq type='get'
    from='sender'
    to='respondent'
    id='foo'>
  <hopcheck xmlns='http://www.xmpp.org/extensions/xep-0219.html#ns'
            [for='original-sender']
            to='target'/>
</iq>
]]></code>
    <p>The sender MUST set the respondent to be the entity that the sender believes is the entity at the other end of the next hop in the communications path. (For a connected resource, this is the server to which the client is connected; for a server, this is the server corresponding to the domain portion of the JID in the triggering request received from a connected resource or other local entity.)</p>
    <p>If the sender is a server but it is making the request on behalf of a connected resource, it MUST include the 'for' attribute and set it to the 'from' address of the triggering request.</p>
  </section2>
  <section2 topic="Errors" anchor="protocol-errors">
    <p>The following error cases are defined:</p>
    <ul>
      <li>If the respondent does not support the hopcheck namespace, it MUST return a &lt;service-unavailable/&gt; error.</li>
      <li>If the &lt;hopcheck/&gt; element does not include a 'to' attribute, the respondent MUST return a &lt;bad-request/&gt; error.</li>
      <li>If the 'to' or 'for' attribute of the &lt;hopcheck/&gt; element contains a JID that is malformed, the respondent MUST return a &lt;jid-malformed/&gt; error.</li>
      <li>If the respondent is a server and the sender is a full JID &lt;localpart@domain.tld/resource&gt;, the server MUST verify that the JID is a connected resource of the server (per <span class="ref"><link url="http://tools.ietf.org/html/rfc6120">RFC 6120</link></span> <note>RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core &lt;<link url="http://tools.ietf.org/html/rfc6120">http://tools.ietf.org/html/rfc6120</link>&gt;.</note>); if it is not, then the respondent MUST return a &lt;forbidden/&gt; error.</li>
      <li>If both the sender and the respondent are servers and the domain identifier of the &lt;hopcheck/&gt; element's 'to' attribute does not match a validated domain of the respondent, the respondent MUST return a &lt;item-not-found/&gt; error.</li>
      <li>If both the sender and the respondent are servers, the JID of the &lt;hopcheck/&gt; element's 'to' is a connected resource of the respondent server, and the JID of the &lt;hopcheck/&gt; element's 'for' is not authorized to know the presence of the target (either via presence subscription or temporary presence sharing via directed presence as defined in <span class="ref"><link url="http://tools.ietf.org/html/rfc6121">XMPP IM</link></span> <note>RFC 6121: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence &lt;<link url="http://tools.ietf.org/html/rfc6121">http://tools.ietf.org/html/rfc6121</link>&gt;.</note>), then the respondent MUST return a &lt;forbidden/&gt; error.</li>
    </ul>
  </section2>
  <section2 topic="Response" anchor="protocol-response">
    <p>If an error does not occur, the response shall be of the following form:</p>
    <code><![CDATA[
<iq type='result'
    from='respondent'
    to='sender'
    id='foo'>
  <hopcheck xmlns='http://www.xmpp.org/extensions/xep-0219.html#ns'
            [for='original-sender']
            to='target'>
    <hop auth='some-defined-value'
         [delay='float']
         from='sender-or-respondent'
         [ip='some-IP-address']
         encrypted='boolean'
         to='respondent-or-target'/>
  </hopcheck>
</iq>
]]></code>
    <p>The 'delay' attribute is OPTIONAL. If included, it represents the time in milliseconds that it took for the respondent to receive a reply from the target or intermediate respondent.</p>
    <p>The 'ip' attribute is OPTIONAL. If included, it represents the IPv4 or IPv6 address of the target or intermediate respondent.</p>
    <p>The 'encrypted' attribute is REQUIRED. It is a boolean <note>In accordance with Section 3.2.2.1 of <cite>XML Schema Part 2: Datatypes</cite>, the allowable lexical representations for the xs:boolean datatype are the strings "0" and "false" for the concept 'false' and the strings "1" and "true" for the concept 'true'; implementations MUST support both styles of lexical representation.</note> that represents whether the hop in question is encrypted via Transport Layer Security (see <span class="ref"><link url="http://tools.ietf.org/html/rfc5246">RFC 5246</link></span> <note>RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 &lt;<link url="http://tools.ietf.org/html/rfc5246">http://tools.ietf.org/html/rfc5246</link>&gt;.</note>) or at a legacy SSL port.</p>
    <p>The 'auth' attribute is REQUIRED. It represents whether and how the hop in question is authenticated, in particular via one of the following means:</p>
    <ul>
      <li>A Simple Authentication and Security Layer mechanism (see <span class="ref"><link url="http://tools.ietf.org/html/rfc4422">RFC 4422</link></span> <note>RFC 4422: Simple Authentication and Security Layer (SASL) &lt;<link url="http://tools.ietf.org/html/rfc4422">http://tools.ietf.org/html/rfc4422</link>&gt;.</note> for the specification and <span class="ref"><link url="http://www.iana.org/assignments/sasl-mechanisms">IANA SASL Mechanisms Registry</link></span> <note>IANA registry of mechanisms used in the Simple Authentication and Security Layer protocol &lt;<link url="http://www.iana.org/assignments/sasl-mechanisms">http://www.iana.org/assignments/sasl-mechanisms</link>&gt;.</note> for a list of registered SASL mechanisms; the names for standardized, non-obsolete mechanisms are used as values of the 'auth' attribute).</li>
      <li>The obsolete <span class="ref"><link url="https://xmpp.org/extensions/xep-0078.html">Non-SASL Authentication (XEP-0078)</link></span> <note>XEP-0078: Non-SASL Authentication &lt;<link url="https://xmpp.org/extensions/xep-0078.html">https://xmpp.org/extensions/xep-0078.html</link>&gt;.</note> protocol using the "plaintext" or "digest" method.</li>
      <li>The server dialback protocol ("dialback") as specified in <span class="ref"><link url="https://xmpp.org/extensions/xep-0220.html">Server Dialback (XEP-0220)</link></span> <note>XEP-0220: Server Dialback &lt;<link url="https://xmpp.org/extensions/xep-0220.html">https://xmpp.org/extensions/xep-0220.html</link>&gt;.</note>.</li>
    </ul>
  </section2>
</section1>

<section1 topic="Discovering Support" anchor="disco">
  <p>If an entity supports the Hop Check protocol, it MUST report that by including a service discovery feature of "http://www.xmpp.org/extensions/xep-0219.html#ns" (see <link url="#ns">Protocol Namespaces</link> regarding issuance of one or more permanent namespaces) in response to a <span class="ref"><link url="https://xmpp.org/extensions/xep-0030.html">Service Discovery (XEP-0030)</link></span> <note>XEP-0030: Service Discovery &lt;<link url="https://xmpp.org/extensions/xep-0030.html">https://xmpp.org/extensions/xep-0030.html</link>&gt;.</note> information request:</p>
  <example caption="Service Discovery information request"><![CDATA[
<iq type='get'
    from='juliet@capulet.lit/balcony'
    from='capulet.lit'
    id='disco1'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
]]></example>
  <example caption="Service Discovery information response"><![CDATA[
<iq type='result'
    from='capulet.lit'
    to='juliet@capulet.lit/balcony'
    id='disco1'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    ...
    <feature var='http://www.xmpp.org/extensions/xep-0219.html#ns'/>
    ...
  </query>
</iq>
]]></example>
</section1>

<section1 topic="Security Considerations" anchor="security">
  <section2 topic="Server Trust" anchor="security-trust">
    <p>Trust levels vary. The administrator of a server may have complete trust in the server they run. A user of a friend's server may have significant trust in the server. A user of a server in a military environment may have no choice of server and may trust that their superiors are doing the right thing. And so on. While the trust that a user places in a server may or may not be warranted, this document uses the level of trust that exists to bootstrap greater trust in the entire communications path.</p>
  </section2>
  <section2 topic="Cleartext" anchor="security-cleartext">
    <p>Even if all the hops are encrypted, the traffic may still be available in cleartext to a representative of an Internet Service Provider ("Isaac"), a representative of the justice system ("Justin"), or a malicious attacker ("Mallory") that has gained access to any of the servers along the communications path. The protocol described herein is decidedly NOT a substitute for end-to-end encryption technologies such as <span class="ref"><link url="https://xmpp.org/extensions/xep-0116.html">Encrypted Session Negotiation (XEP-0116)</link></span> <note>XEP-0116: Encrypted Session Negotiation &lt;<link url="https://xmpp.org/extensions/xep-0116.html">https://xmpp.org/extensions/xep-0116.html</link>&gt;.</note>.</p>
  </section2>
</section1>

<section1 topic="IANA Considerations" anchor="iana">
  <p>This document requires no interaction with the <span class="ref"><link url="http://www.iana.org/">Internet Assigned Numbers Authority (IANA)</link></span> <note>The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see &lt;<link url="http://www.iana.org/">http://www.iana.org/</link>&gt;.</note>.</p>
</section1>

<section1 topic="XMPP Registrar Considerations" anchor="registrar">
  <section2 topic="Protocol Namespaces" anchor="ns">
    <p>Until this specification advances to a status of Draft, its associated namespace shall be "http://www.xmpp.org/extensions/xep-0219.html#ns"; upon advancement of this specification, the <span class="ref"><link url="https://xmpp.org/registrar/">XMPP Registrar</link></span> <note>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 &lt;<link url="https://xmpp.org/registrar/">https://xmpp.org/registrar/</link>&gt;.</note> shall issue a permanent namespace in accordance with the process defined in Section 4 of <span class="ref"><link url="https://xmpp.org/extensions/xep-0053.html">XMPP Registrar Function (XEP-0053)</link></span> <note>XEP-0053: XMPP Registrar Function &lt;<link url="https://xmpp.org/extensions/xep-0053.html">https://xmpp.org/extensions/xep-0053.html</link>&gt;.</note>.</p>
  </section2>
</section1>

<section1 topic="XML Schema" anchor="schema">
  <code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='http://www.xmpp.org/extensions/xep-0219.html#ns'
    xmlns='http://www.xmpp.org/extensions/xep-0219.html#ns'
    elementFormDefault='qualified'>

  <xs:element name='hopcheck'>
    <xs:complexType>
      <xs:sequence minOccurs='0' maxOccurs='unbounded'>
        <xs:element ref='hop'/>
      </xs:sequence>
      <xs:attribute name='for' type='xs:string' use='optional'/>
      <xs:attribute name='to' type='xs:string' use='required'/>
    </xs:complexType>
  </xs:element>

  <xs:element name='hop'>
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base='empty'>
          <xs:attribute name='auth' use='required'>
            <xs:simpleType>
              <xs:restriction base='xs:NCName'>
                <xs:enumeration value='ANONYMOUS'/>
                <xs:enumeration value='CRAM-MD5'/>
                <xs:enumeration value='DIGEST-MD5'/>
                <xs:enumeration value='EXTERNAL'/>
                <xs:enumeration value='GSSAPI'/>
                <xs:enumeration value='KERBEROS_V4'/>
                <xs:enumeration value='OTP'/>
                <xs:enumeration value='PLAIN'/>
                <xs:enumeration value='SECURID'/>
                <xs:enumeration value='dialback'/>
                <xs:enumeration value='digest'/>
                <xs:enumeration value='plaintext'/>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name='delay' type='xs:double' use='optional'/>
          <xs:attribute name='encrypted' type='xs:boolean' use='required'/>
          <xs:attribute name='from' type='xs:string' use='required'/>
          <xs:attribute name='ip' type='xs:string' use='optional'/>
          <xs:attribute name='to' type='xs:string' use='required'/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name='empty'>
    <xs:restriction base='xs:string'>
      <xs:enumeration value=''/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>
]]></code>
</section1>
</xep>
