You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

495 line

  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>External Service Discovery</title>
  10. <abstract>This document specifies an XMPP protocol extension for discovering services external to the XMPP network.</abstract>
  12. <number>0215</number>
  13. <status>Deferred</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <approver>Council</approver>
  17. <dependencies>
  18. <spec>XMPP Core</spec>
  19. </dependencies>
  20. <supersedes/>
  21. <supersededby/>
  22. <shortname>extdisco</shortname>
  23. &stpeter;
  24. &seanegan;
  25. &mlundblad;
  26. &lance;
  27. <revision>
  28. <version>0.7</version>
  29. <date>2015-10-20</date>
  30. <initials>ls</initials>
  31. <remark>
  32. <ul>
  33. <li>Clarified which attributes are needed to identify a service when requesting credentials.</li>
  34. <li>Added 'action' attribute to indicate if a service is being added/removed/updated in a push update.</li>
  35. <li>Added 'expires' attribute to indicate when provided credentials will expire.</li>
  36. <li>Added 'restricted' attribute to indicate the need for fetching credentials for a service.</li>
  37. <li>Bumped namespace version.</li>
  38. </ul>
  39. </remark>
  40. </revision>
  41. <revision>
  42. <version>0.6</version>
  43. <date>2014-02-27</date>
  44. <initials>psa</initials>
  45. <remark><p>Updated references to IETF specifications.</p></remark>
  46. </revision>
  47. <revision>
  48. <version>0.5</version>
  49. <date>2010-02-17</date>
  50. <initials>psa</initials>
  51. <remark><p>Added ability to request credentials from a particular service; incremented the protocol version number to reflect the new feature.</p></remark>
  52. </revision>
  53. <revision>
  54. <version>0.4</version>
  55. <date>2009-02-17</date>
  56. <initials>psa/ml</initials>
  57. <remark><p>Revived the spec by popular demand; updated namespace to use XMPP URN; defined registry process and several initial entries.</p></remark>
  58. </revision>
  59. <revision>
  60. <version>0.3</version>
  61. <date>2007-08-30</date>
  62. <initials>psa</initials>
  63. <remark><p>Added name attribute for human-readable labels; added internationalization considerations; added security considerations.</p></remark>
  64. </revision>
  65. <revision>
  66. <version>0.2</version>
  67. <date>2007-08-28</date>
  68. <initials>psa</initials>
  69. <remark><p>Broadened scope from discovery of STUN servers to discovery of any external (non-XMPP) service.</p></remark>
  70. </revision>
  71. <revision>
  72. <version>0.1</version>
  73. <date>2007-05-16</date>
  74. <initials>psa/se</initials>
  75. <remark><p>Initial published version.</p></remark>
  76. </revision>
  77. <revision>
  78. <version>0.0.5</version>
  79. <date>2007-05-10</date>
  80. <initials>psa</initials>
  81. <remark><p>Added attributes for username and password; reverted to IQ method since credentials are individualized.</p></remark>
  82. </revision>
  83. <revision>
  84. <version>0.0.4</version>
  85. <date>2007-04-18</date>
  86. <initials>psa</initials>
  87. <remark><p>Modified to use a well-known publish-subscribe node instead of a dedicated IQ exchange.</p></remark>
  88. </revision>
  89. <revision>
  90. <version>0.0.3</version>
  91. <date>2007-03-30</date>
  92. <initials>psa</initials>
  93. <remark><p>Made port mandatory since spec assumes that SRV is not available; added XML schema.</p></remark>
  94. </revision>
  95. <revision>
  96. <version>0.0.2</version>
  97. <date>2007-03-27</date>
  98. <initials>psa</initials>
  99. <remark><p>Made port optional.</p></remark>
  100. </revision>
  101. <revision>
  102. <version>0.0.1</version>
  103. <date>2007-03-23</date>
  104. <initials>psa/se</initials>
  105. <remark><p>First draft.</p></remark>
  106. </revision>
  107. </header>
  108. <section1 topic='Introduction' anchor='intro'>
  109. <p>An XMPP client or other entity might need to discover services external to the XMPP network in order to complete certain XMPP-related use cases. One example is the discovery of STUN servers (see &rfc5389;) and TURN relays (see &rfc5766;) for the sake of negotiating media exchanges via the &xep0176;. <note>The protocol specified herein is functionally equivalent to the protocol currently used in the Google Talk service for discovery of STUN servers, as documented at &lt;<link url=''></link>&gt;, but has been broadened in scope to address additional use cases if desired.</note> An XMPP entity can already discover such external services in several ways, including:</p>
  110. <ol>
  111. <li>The service is specified in the application's default settings.</li>
  112. <li>The service is manually added into the application's configuration by a human user.</li>
  113. <li>The service is discovered via non-XMPP service discovery protocols, such as:
  114. <ul>
  115. <li>DNS SRV records (&rfc2782;)</li>
  116. <li>Service Location Protocol (SLP; &rfc2608;)</li>
  117. <li>The Dynamic Delegation Discovery System (DDDS; &rfc3401;)</li>
  118. <li>The NAPTR profile of DDDS (&rfc3403;)</li>
  119. <li>The S-NAPTR profile of DDDS (&rfc3958;)</li>
  120. <li>The U-NAPTR profile of DDDS (&rfc4848;)</li>
  121. </ul>
  122. </li>
  123. </ol>
  124. <p>Unfortunately, some of the foregoing methods are subject to human error and others are either not widely available or cannot be deployed in wide range of scenarios (e.g., when the administrators of an XMPP service do not have access to DNS SRV records). Therefore, this document defines a way for an XMPP server or discovery service to provide information about external services, which might include extended information such as temporary credentials for authentication at such services. This method SHOULD be used only as a fallback when the relevant service discovery technologies (DNS SRV, DDDS, SLP, S-NAPTR, U-NAPTR, etc.) are not available to the XMPP entities involved (typically a client and server). This method does not use &xep0030; since that technology is designed for discovery of XMPP entities, not entities outside an XMPP network.</p>
  125. </section1>
  126. <section1 topic='Protocol' anchor='protocol'>
  127. <p>In order to learn about external services known to an XMPP server or discovery service, a requesting entity (typically a client) sends an IQ-get containing an empty &lt;services/&gt; element qualified by the 'urn:xmpp:extdisco:2' namespace &NSNOTE;, typically to its own server but perhaps alternatively to a dedicated discovery service.</p>
  128. <p>The responding entity (XMPP server or discovery service) SHOULD return the list of external services it is aware of, but MAY instead return an appropriate error, such as &unavailable; if the responding entity does not support this protocol or &forbidden; if the requesting entity does not have permission to receive the list of external services. Each service is encapsulated via a &lt;service/&gt; element.</p>
  129. <p>Note: The processes by which a responding entity discovers external services for "proxying" to XMPP entities are out of scope for this specification.</p>
  130. <p>The &lt;service/&gt; element MAY be empty or MAY include extended information about the service as described in the <link url='#extended'>Extended Information</link> section of this document.</p>
  131. <p>The attributes of the &lt;service/&gt; element are summarized in the following table.</p>
  132. <table caption='Attributes'>
  133. <tr>
  134. <th>Name</th>
  135. <th>Definition</th>
  136. <th>Inclusion</th>
  137. </tr>
  138. <tr>
  139. <td>action</td>
  140. <td>When sending a push update, the action value indicates if the service is being added or deleted from the set of known services (or simply being modified). The defined values are "add", "remove", and "modify", where "add" is the default.</td>
  141. <td>OPTIONAL</td>
  142. </tr>
  143. <tr>
  144. <td>expires</td>
  145. <td>A timestamp indicating when the provided username and password credentials will expire. The format MUST adhere to the dateTime format specified in &xep0082; and MUST be expressed in UTC.</td>
  146. <td>OPTIONAL</td>
  147. </tr>
  148. <tr>
  149. <td>host</td>
  150. <td>Either a fully qualified domain name (FQDN) or an IP address (IPv4 or IPv6).</td>
  151. <td>REQUIRED</td>
  152. </tr>
  153. <tr>
  154. <td>name</td>
  155. <td>A friendly (human-readable) name or label for the service.</td>
  156. <td>OPTIONAL</td>
  157. </tr>
  158. <tr>
  159. <td>password</td>
  160. <td>A service- or server-generated password for use at the service. *</td>
  161. <td>OPTIONAL</td>
  162. </tr>
  163. <tr>
  164. <td>port</td>
  165. <td>The communications port to be used at the host.</td>
  166. <td>RECOMMENDED</td>
  167. </tr>
  168. <tr>
  169. <td>restricted</td>
  170. <td>A boolean value indicating that username and password credentials are required and will need to be requested if not already provided (see <link url="#credentials">Requesting Credentials</link>).</td>
  171. <td>OPTIONAL</td>
  172. </tr>
  173. <tr>
  174. <td>transport</td>
  175. <td>The underlying transport protocol to be used when communicating with the service (typically either TCP or UDP).</td>
  176. <td>RECOMMENDED</td>
  177. </tr>
  178. <tr>
  179. <td>type</td>
  180. <td>The service type as registered with the &REGISTRAR;.</td>
  181. <td>REQUIRED</td>
  182. </tr>
  183. <tr>
  184. <td>username</td>
  185. <td>A service- or server-generated username for use at the service. *</td>
  186. <td>OPTIONAL</td>
  187. </tr>
  188. </table>
  189. <p>* Note: The processes by which an external service might generate (or an XMPP server might negotiate) the username and password are outside the scope of this specification. One possible approach is for the XMPP server to generate a short-term authentication credential based on a private key shared with the external service.</p>
  190. </section1>
  191. <section1 topic='Use Cases' anchor='usecases'>
  192. <section2 topic='Requesting All Services' anchor='all'>
  193. <p>A requesting entity requests all services by sending a &lt;services/&gt; element to its server or a discovery service.</p>
  194. <example caption='Entity Requests All External Services'><![CDATA[
  195. <iq from='bard@shakespeare.lit/globe'
  196. id='ul2bc7y6'
  197. to='shakespeare.lit'
  198. type='get'>
  199. <services xmlns='urn:xmpp:extdisco:2'/>
  200. </iq>
  201. ]]></example>
  202. <example caption='XMPP Server Returns List'><![CDATA[
  203. <iq from='shakespeare.lit'
  204. id='ul2bc7y6'
  205. to='bard@shakespeare.lit/globe'
  206. type='result'>
  207. <services xmlns='urn:xmpp:extdisco:2'>
  208. <service host='stun.shakespeare.lit'
  209. port='9998'
  210. transport='udp'
  211. type='stun'/>
  212. <service host='relay.shakespeare.lit'
  213. password='jj929jkj5sadjfj93v3n'
  214. port='9999'
  215. transport='udp'
  216. type='turn'
  217. username='nb78932lkjlskjfdb7g8'/>
  218. <service host=''
  219. port='8888'
  220. transport='udp'
  221. type='stun'/>
  222. <service host=''
  223. port='8889'
  224. password='93jn3bakj9s832lrjbbz'
  225. transport='udp'
  226. type='turn'
  227. username='auu98sjl2wk3e9fjdsl7'/>
  228. <service host='ftp.shakespeare.lit'
  229. name='Shakespearean File Server'
  230. password='guest'
  231. port='20'
  232. transport='tcp'
  233. type='ftp'
  234. username='guest'/>
  235. </services>
  236. </iq>
  237. ]]></example>
  238. </section2>
  239. <section2 topic='Requesting Selected Services' anchor='select'>
  240. <p>A requesting entity requests services of a particular type by sending a &lt;services/&gt; element including a 'type' attribute specifying the service type of interest.</p>
  241. <example caption='Entity Requests Selected Services'><![CDATA[
  242. <iq from='bard@shakespeare.lit/globe'
  243. id='yv2c19f7'
  244. to='shakespeare.lit'
  245. type='get'>
  246. <services xmlns='urn:xmpp:extdisco:2' type='turn'/>
  247. </iq>
  248. ]]></example>
  249. <example caption='XMPP Server Returns List'><![CDATA[
  250. <iq from='shakespeare.lit'
  251. id='yv2c19f7'
  252. to='bard@shakespeare.lit/globe'
  253. type='result'>
  254. <services xmlns='urn:xmpp:extdisco:2'
  255. type='turn'>
  256. <service host='turn.shakespeare.lit'
  257. password='jj929jkj5sadjfj93v3n'
  258. port='9999'
  259. transport='udp'
  260. type='turn'
  261. username='nb78932lkjlskjfdb7g8'/>
  262. <service host=''
  263. port='8889'
  264. password='93jn3bakj9s832lrjbbz'
  265. transport='udp'
  266. type='turn'
  267. username='auu98sjl2wk3e9fjdsl7'/>
  268. </services>
  269. </iq>
  270. ]]></example>
  271. <p>If a requesting entity requests services of a particular type, the responding service MAY as needed send an updated list of the relevant services by "pushing" the list to a requesting entity that has previously requested the list. However, it MUST NOT push updates to the requesting entity unless it has presence information about the requesting entity (e.g., because the requesting entity is connected to the XMPP server or because the requesting entity has shared presence with a remote discovery service). A push is an IQ set to the requesting entity containing a &lt;services/&gt; payload with updated data about services matching the requested type (e.g., new services or updated credentials). Each &lt;service/&gt; element SHOULD contain an 'action' attribute indicating if the service is being added, deleted, or modified.</p>
  272. <example caption='Services Push'><![CDATA[
  273. <iq from='shakespeare.lit'
  274. id='lh3f1vc7'
  275. to='bard@shakespeare.lit/globe'
  276. type='set'>
  277. <services xmlns='urn:xmpp:extdisco:2'
  278. type='turn'>
  279. <service action='add'
  280. host='stun.shakespeare.lit'
  281. port='9999'
  282. transport='udp'
  283. type='turn'
  284. username='1nas9dlm3hzl89d0b9v'
  285. password='gh9023ljjdk109iajqn'>
  286. <service action='add'
  287. host=''
  288. port='7778'
  289. transport='udp'
  290. type='turn'
  291. username='bnsv120afg48snsdozp'
  292. password='zxp023na98dsfahn1kk'/>
  293. <service action='delete'
  294. host=''
  295. port='8889'
  296. type='turn'/>
  297. </services>
  298. </iq>
  299. ]]></example>
  300. <p>Upon receiving a push, the requesting entity would then send an IQ-result to the responding service in accordance with &xmppcore;.</p>
  301. </section2>
  302. <section2 topic='Requesting Credentials' anchor='credentials'>
  303. <p>An entity might know about an external service via DNS or some other means, but still might need short-term credentials to use the service. The entity can request credentials by sending a special request to the server composed of a &lt;credentials/&gt; element qualified by the 'urn:xmpp:extdisco:2' namespace and contains a &lt;service/&gt; element which MUST include the 'host' and 'type' attributes to identify the desired service (the 'port' attribute MAY be provided if there are multiple services with the same host and type but different ports).</p>
  304. <example caption='Entity Requests Credentials at a Service'><![CDATA[
  305. <iq from='bard@shakespeare.lit/globe'
  306. id='xi2cax48'
  307. to='shakespeare.lit'
  308. type='get'>
  309. <credentials xmlns='urn:xmpp:extdisco:2'>
  310. <service host='turn.shakespeare.lit' type='turn' />
  311. </credentials>
  312. </iq>
  313. ]]></example>
  314. <p>The server then returns credentials if possible.</p>
  315. <example caption='Server Returns Credentials'><![CDATA[
  316. <iq from='shakespeare.lit'
  317. id='xi2cax48'
  318. to='bard@shakespeare.lit/globe'
  319. type='get'>
  320. <credentials xmlns='urn:xmpp:extdisco:2'>
  321. <service host='turn.shakespeare.lit'
  322. type='turn'
  323. password='jj929jkj5sadjfj93v3n'
  324. username='nb78932lkjlskjfdb7g8'/>
  325. </credentials>
  326. </iq>
  327. ]]></example>
  328. <p>For TURN, the server might construct time-limited credentials as described in &turn-rest;.</p>
  329. <p>There MAY be multiple &lt;service/&gt; elements in the result if more than one service matched the requested service identity (e.g., the same host provides service on multiple ports).</p>
  330. <p>If the server cannot obtain credentials at the service, it returns an appropriate stanza error, such as &notfound;, &remoteserver;, &timeout;, or &notauthorized;.</p>
  331. </section2>
  332. </section1>
  333. <section1 topic='Extended Information' anchor='extended'>
  334. <p>If a server or service needs to include extended information, it SHOULD do so by including each bit of information as the XML character data of the &lt;value/&gt; child of a distinct &lt;field/&gt; element, with the entire set of fields contained within an &lt;x/&gt; element of type "result" qualified by the 'jabber:x:data' namespace (see &xep0004;); this &lt;x/&gt; element SHOULD be a child of the &lt;service/&gt; element qualified by the 'urn:xmpp:extdisco:2' namespace &NSNOTE;. Thus the IQ result SHOULD be of the following form:</p>
  335. <code><![CDATA[
  336. <iq type='result'>
  337. <services xmlns='urn:xmpp:extdisco:2'>
  338. <service>
  339. <x type='result' xmlns='jabber:x:data'>
  340. <field var='[var-name]' label='[optional]'>
  341. <value>[var-value]</value>
  342. </field>
  343. [ ... ]
  344. </x>
  345. </service>
  346. </services>
  347. </iq>]]></code>
  348. <p>Note: A &lt;field/&gt; element MAY contain more than one &lt;value/&gt; child if appropriate.</p>
  349. <p>If the data fields are to be used in the context of a protocol approved by the XMPP Standards Foundation, they SHOULD be registered in accordance with the rules defined in &xep0068;, resulting in the inclusion of a &lt;field/&gt; element whose 'var' attribute has a value of "FORM_TYPE" and whose 'type' attribute has a value of "hidden".</p>
  350. <p>Note: Although &xep0128; specifies that an XMPP entity MUST NOT supply extended information about associated children communicated via the '' namespace, that rule does not apply to External Service Discovery since services external to the XMPP network cannot communicate via XMPP.</p>
  351. </section1>
  352. <section1 topic='Determining Support' anchor='disco'>
  353. <p>If an XMPP entity supports this protocol, it MUST report that fact by including a service discovery feature of "urn:xmpp:extdisco:2" &NSNOTE; in response to a &xep0030; information request:</p>
  354. <example caption="Service Discovery Information Request"><![CDATA[
  355. <iq from='romeo@montague.lit/orchard'
  356. id='ix61z3m9'
  357. to='montague.lit'
  358. type='get'>
  359. <query xmlns=''/>
  360. </iq>
  361. ]]></example>
  362. <example caption="Service Discovery Information Response"><![CDATA[
  363. <iq from='montague.lit'
  364. id='ix61z3m9'
  365. to='romeo@montague.lit/orchard'
  366. type='result'>
  367. <query xmlns=''>
  368. <feature var='urn:xmpp:extdisco:2'/>
  369. </query>
  370. </iq>
  371. ]]></example>
  372. </section1>
  373. <section1 topic='Internationalization Considerations' anchor='i18n'>
  374. <p>If the requesting entity includes an 'xml:lang' attribute with its request, the responding entity SHOULD include appropriately internationalized text as the value of the 'name' attribute. No other attributes are human-readable.</p>
  375. </section1>
  376. <section1 topic='Security Considerations' anchor='security'>
  377. <p>Because the responding entity (XMPP server or discovery service) functions as a "proxy" from external services to the XMPP network, it could modify the information it receives before passing it on to the requesting entity.</p>
  378. </section1>
  379. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  380. <section2 topic='Protocol Namespaces' anchor='registrar-ns'>
  381. <p>This specification defines the following XML namespace:</p>
  382. <ul>
  383. <li>urn:xmpp:extdisco:2</li>
  384. </ul>
  385. <p>Upon advancement of this specification from a status of Experimental to a status of Draft, the &REGISTRAR; shall add the foregoing namespace to the registry located at &NAMESPACES;, as described in Section 4 of &xep0053;.</p>
  386. </section2>
  387. <section2 topic='Protocol Versioning' anchor='registrar-versioning'>
  388. &NSVER;
  389. </section2>
  390. <section2 topic='External Service Types Registry' anchor='registrar-services'>
  391. <p>The XMPP Registrar shall maintain a registry of external service types and their associated transport protocol(s). Such service types will probably be derived from the &ianaports;, defined DNS SRV record types, defined DDDS records for NAPTR, S-NAPTR, and U-NAPTR, and &ianaslp;.</p>
  392. <section3 topic='Process' anchor='registrar-methods-process'>
  394. <code><![CDATA[
  395. <service>
  396. <name>the XML character data of the service type</name>
  397. <desc>a natural-language description of the service type</desc>
  398. <doc>the document that best defines the service type</doc>
  399. </service>
  400. ]]></code>
  401. <p>The registrant can register more than one service type at a time, each contained in a separate &lt;service/&gt; element.</p>
  402. </section3>
  403. <section3 topic='Registration' anchor='registrar-methods-init'>
  404. <code><![CDATA[
  405. <service>
  406. <name>stun</name>
  407. <desc>a server that provides Session Traversal Utilities for NAT (STUN)</desc>
  408. <doc>RFC 5389</doc>
  409. </service>
  410. <service>
  411. <name>turn</name>
  412. <desc>a server that provides Traversal Using Relays around NAT (TURN)</desc>
  413. <doc>RFC 5766</doc>
  414. </service>
  415. ]]></code>
  416. </section3>
  417. </section2>
  418. </section1>
  419. <section1 topic='XML Schema' anchor='schema'>
  420. <code><![CDATA[
  421. <?xml version='1.0' encoding='UTF-8'?>
  422. <xs:schema
  423. xmlns:xs=''
  424. targetNamespace='urn:xmpp:extdisco:2'
  425. xmlns='urn:xmpp:extdisco:2'
  426. elementFormDefault='qualified'>
  427. <xs:import
  428. namespace='jabber:x:data'
  429. schemaLocation=''/>
  430. <xs:element name='services'>
  431. <xs:complexType>
  432. <xs:sequence minOccurs='0'>
  433. <xs:element ref='service'/>
  434. </xs:sequence>
  435. <xs:attribute name='type' type='xs:NCName' use='optional'/>
  436. </xs:complexType>
  437. </xs:element>
  438. <xs:element name='credentials'>
  439. <xs:complexType>
  440. <xs:sequence>
  441. <xs:element ref='service' minOccurs='0' maxOccurs='unbounded'/>
  442. </xs:sequence>
  443. </xs:complexType>
  444. </xs:element>
  445. <xs:element name='service'>
  446. <xs:complexType>
  447. <xs:sequence xmlns:xdata='jabber:x:data'>
  448. <xs:element ref='xdata:x' minOccurs='0'/>
  449. </xs:sequence>
  450. <xs:attribute name='action' use='optional' default='add'>
  451. <xs:simpleType>
  452. <xs:restriction base='xs:NCName'>
  453. <xs:enumeration value='add'/>
  454. <xs:enumeration value='delete'/>
  455. <xs:enumeration value='modify'/>
  456. </xs:restriction>
  457. </xs:simpleType>
  458. </xs:attribute>
  459. <xs:attribute name='expires' type='xs:dateTime' use='optional'/>
  460. <xs:attribute name='host' type='xs:string' use='required'/>
  461. <xs:attribute name='name' type='xs:string' use='optional'/>
  462. <xs:attribute name='password' type='xs:string' use='optional'/>
  463. <xs:attribute name='port' type='xs:string' use='required'/>
  464. <xs:attribute name='restricted' type='xs:boolean' use='optional'/>
  465. <xs:attribute name='transport' type='xs:NCName' use='optional'/>
  466. <xs:attribute name='type' type='xs:NCName' use='required'/>
  467. <xs:attribute name='username' type='xs:string' use='optional'/>
  468. </xs:complexType>
  469. </xs:element>
  470. </xs:schema>
  471. ]]></code>
  472. </section1>
  473. <section1 topic='Acknowledgements' anchor='ack'>
  474. <p>Thanks to Philipp Hancke, Justin Karneges, Evgeniy Khramtsov, and Unnikrishnan Vikrama Panicker for their feedback.</p>
  475. </section1>
  476. </xep>