forked from xsf/xeps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxep-0215.xml
519 lines (501 loc) · 23.7 KB
/
xep-0215.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
<?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>External Service Discovery</title>
<abstract>This document specifies an XMPP protocol extension for discovering services external to the XMPP network.</abstract>
&LEGALNOTICE;
<number>0215</number>
<status>Draft</status>
<lastcall>2022-07-27</lastcall>
<type>Standards Track</type>
<sig>Standards</sig>
<approver>Council</approver>
<dependencies>
<spec>XMPP Core</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>extdisco</shortname>
&stpeter;
&seanegan;
&mlundblad;
&lance;
<revision>
<version>1.0.0</version>
<date>2022-08-23</date>
<initials>XEP Editor (jsc)</initials>
<remark>Accept as Stable as per Council Vote from 2022-08-03.</remark>
</revision>
<revision>
<version>0.7.2</version>
<date>2021-10-23</date>
<initials>egp</initials>
<remark>
<p>Fix the schema to:</p>
<ul>
<li>Allow more than a single <service/> in <services/>.</li>
<li>Restrict the 'port' attribute to xs:unsignedShort, but make it optional as per section 3.3.</li>
</ul>
</remark>
</revision>
<revision>
<version>0.7.1</version>
<date>2021-08-31</date>
<initials>ka</initials>
<remark><p>Fix incorrect type on IQ response in example 7</p></remark>
</revision>
<revision>
<version>0.7</version>
<date>2015-10-20</date>
<initials>ls</initials>
<remark>
<ul>
<li>Clarified which attributes are needed to identify a service when requesting credentials.</li>
<li>Added 'action' attribute to indicate if a service is being added/removed/updated in a push update.</li>
<li>Added 'expires' attribute to indicate when provided credentials will expire.</li>
<li>Added 'restricted' attribute to indicate the need for fetching credentials for a service.</li>
<li>Bumped namespace version.</li>
</ul>
</remark>
</revision>
<revision>
<version>0.6</version>
<date>2014-02-27</date>
<initials>psa</initials>
<remark><p>Updated references to IETF specifications.</p></remark>
</revision>
<revision>
<version>0.5</version>
<date>2010-02-17</date>
<initials>psa</initials>
<remark><p>Added ability to request credentials from a particular service; incremented the protocol version number to reflect the new feature.</p></remark>
</revision>
<revision>
<version>0.4</version>
<date>2009-02-17</date>
<initials>psa/ml</initials>
<remark><p>Revived the spec by popular demand; updated namespace to use XMPP URN; defined registry process and several initial entries.</p></remark>
</revision>
<revision>
<version>0.3</version>
<date>2007-08-30</date>
<initials>psa</initials>
<remark><p>Added name attribute for human-readable labels; added internationalization considerations; added security considerations.</p></remark>
</revision>
<revision>
<version>0.2</version>
<date>2007-08-28</date>
<initials>psa</initials>
<remark><p>Broadened scope from discovery of STUN servers to discovery of any external (non-XMPP) service.</p></remark>
</revision>
<revision>
<version>0.1</version>
<date>2007-05-16</date>
<initials>psa/se</initials>
<remark><p>Initial published version.</p></remark>
</revision>
<revision>
<version>0.0.5</version>
<date>2007-05-10</date>
<initials>psa</initials>
<remark><p>Added attributes for username and password; reverted to IQ method since credentials are individualized.</p></remark>
</revision>
<revision>
<version>0.0.4</version>
<date>2007-04-18</date>
<initials>psa</initials>
<remark><p>Modified to use a well-known publish-subscribe node instead of a dedicated IQ exchange.</p></remark>
</revision>
<revision>
<version>0.0.3</version>
<date>2007-03-30</date>
<initials>psa</initials>
<remark><p>Made port mandatory since spec assumes that SRV is not available; added XML schema.</p></remark>
</revision>
<revision>
<version>0.0.2</version>
<date>2007-03-27</date>
<initials>psa</initials>
<remark><p>Made port optional.</p></remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2007-03-23</date>
<initials>psa/se</initials>
<remark><p>First draft.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<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 <<link url='http://code.google.com/apis/talk/jep_extensions/jingleinfo.html'>http://code.google.com/apis/talk/jep_extensions/jingleinfo.html</link>>, 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>
<ol>
<li>The service is specified in the application's default settings.</li>
<li>The service is manually added into the application's configuration by a human user.</li>
<li>The service is discovered via non-XMPP service discovery protocols, such as:
<ul>
<li>DNS SRV records (&rfc2782;)</li>
<li>Service Location Protocol (SLP; &rfc2608;)</li>
<li>The Dynamic Delegation Discovery System (DDDS; &rfc3401;)</li>
<li>The NAPTR profile of DDDS (&rfc3403;)</li>
<li>The S-NAPTR profile of DDDS (&rfc3958;)</li>
<li>The U-NAPTR profile of DDDS (&rfc4848;)</li>
</ul>
</li>
</ol>
<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>
</section1>
<section1 topic='Protocol' anchor='protocol'>
<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 <services/> element qualified by the 'urn:xmpp:extdisco:2' namespace &NSNOTE;, typically to its own server but perhaps alternatively to a dedicated discovery service.</p>
<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 <service/> element.</p>
<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>
<p>The <service/> 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>
<p>The attributes of the <service/> element are summarized in the following table.</p>
<table caption='Attributes'>
<tr>
<th>Name</th>
<th>Definition</th>
<th>Inclusion</th>
</tr>
<tr>
<td>action</td>
<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>
<td>OPTIONAL</td>
</tr>
<tr>
<td>expires</td>
<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>
<td>OPTIONAL</td>
</tr>
<tr>
<td>host</td>
<td>Either a fully qualified domain name (FQDN) or an IP address (IPv4 or IPv6).</td>
<td>REQUIRED</td>
</tr>
<tr>
<td>name</td>
<td>A friendly (human-readable) name or label for the service.</td>
<td>OPTIONAL</td>
</tr>
<tr>
<td>password</td>
<td>A service- or server-generated password for use at the service. *</td>
<td>OPTIONAL</td>
</tr>
<tr>
<td>port</td>
<td>The communications port to be used at the host.</td>
<td>RECOMMENDED</td>
</tr>
<tr>
<td>restricted</td>
<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>
<td>OPTIONAL</td>
</tr>
<tr>
<td>transport</td>
<td>The underlying transport protocol to be used when communicating with the service (typically either TCP or UDP).</td>
<td>RECOMMENDED</td>
</tr>
<tr>
<td>type</td>
<td>The service type as registered with the ®ISTRAR;.</td>
<td>REQUIRED</td>
</tr>
<tr>
<td>username</td>
<td>A service- or server-generated username for use at the service. *</td>
<td>OPTIONAL</td>
</tr>
</table>
<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>
</section1>
<section1 topic='Use Cases' anchor='usecases'>
<section2 topic='Requesting All Services' anchor='all'>
<p>A requesting entity requests all services by sending a <services/> element to its server or a discovery service.</p>
<example caption='Entity Requests All External Services'><![CDATA[
<iq from='[email protected]/globe'
id='ul2bc7y6'
to='shakespeare.lit'
type='get'>
<services xmlns='urn:xmpp:extdisco:2'/>
</iq>
]]></example>
<example caption='XMPP Server Returns List'><![CDATA[
<iq from='shakespeare.lit'
id='ul2bc7y6'
to='[email protected]/globe'
type='result'>
<services xmlns='urn:xmpp:extdisco:2'>
<service host='stun.shakespeare.lit'
port='9998'
transport='udp'
type='stun'/>
<service host='relay.shakespeare.lit'
password='jj929jkj5sadjfj93v3n'
port='9999'
transport='udp'
type='turn'
username='nb78932lkjlskjfdb7g8'/>
<service host='192.0.2.1'
port='8888'
transport='udp'
type='stun'/>
<service host='192.0.2.1'
port='8889'
password='93jn3bakj9s832lrjbbz'
transport='udp'
type='turn'
username='auu98sjl2wk3e9fjdsl7'/>
<service host='ftp.shakespeare.lit'
name='Shakespearean File Server'
password='guest'
port='20'
transport='tcp'
type='ftp'
username='guest'/>
</services>
</iq>
]]></example>
</section2>
<section2 topic='Requesting Selected Services' anchor='select'>
<p>A requesting entity requests services of a particular type by sending a <services/> element including a 'type' attribute specifying the service type of interest.</p>
<example caption='Entity Requests Selected Services'><![CDATA[
<iq from='[email protected]/globe'
id='yv2c19f7'
to='shakespeare.lit'
type='get'>
<services xmlns='urn:xmpp:extdisco:2' type='turn'/>
</iq>
]]></example>
<example caption='XMPP Server Returns List'><![CDATA[
<iq from='shakespeare.lit'
id='yv2c19f7'
to='[email protected]/globe'
type='result'>
<services xmlns='urn:xmpp:extdisco:2'
type='turn'>
<service host='turn.shakespeare.lit'
password='jj929jkj5sadjfj93v3n'
port='9999'
transport='udp'
type='turn'
username='nb78932lkjlskjfdb7g8'/>
<service host='192.0.2.1'
port='8889'
password='93jn3bakj9s832lrjbbz'
transport='udp'
type='turn'
username='auu98sjl2wk3e9fjdsl7'/>
</services>
</iq>
]]></example>
<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 <services/> payload with updated data about services matching the requested type (e.g., new services or updated credentials). Each <service/> element SHOULD contain an 'action' attribute indicating if the service is being added, deleted, or modified.</p>
<example caption='Services Push'><![CDATA[
<iq from='shakespeare.lit'
id='lh3f1vc7'
to='[email protected]/globe'
type='set'>
<services xmlns='urn:xmpp:extdisco:2'
type='turn'>
<service action='add'
host='stun.shakespeare.lit'
port='9999'
transport='udp'
type='turn'
username='1nas9dlm3hzl89d0b9v'
password='gh9023ljjdk109iajqn'>
<service action='add'
host='192.0.2.2'
port='7778'
transport='udp'
type='turn'
username='bnsv120afg48snsdozp'
password='zxp023na98dsfahn1kk'/>
<service action='delete'
host='192.0.2.1'
port='8889'
type='turn'/>
</services>
</iq>
]]></example>
<p>Upon receiving a push, the requesting entity would then send an IQ-result to the responding service in accordance with &xmppcore;.</p>
</section2>
<section2 topic='Requesting Credentials' anchor='credentials'>
<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 <credentials/> element qualified by the 'urn:xmpp:extdisco:2' namespace and contains a <service/> 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>
<example caption='Entity Requests Credentials at a Service'><![CDATA[
<iq from='[email protected]/globe'
id='xi2cax48'
to='shakespeare.lit'
type='get'>
<credentials xmlns='urn:xmpp:extdisco:2'>
<service host='turn.shakespeare.lit' type='turn' />
</credentials>
</iq>
]]></example>
<p>The server then returns credentials if possible.</p>
<example caption='Server Returns Credentials'><![CDATA[
<iq from='shakespeare.lit'
id='xi2cax48'
to='[email protected]/globe'
type='result'>
<credentials xmlns='urn:xmpp:extdisco:2'>
<service host='turn.shakespeare.lit'
type='turn'
password='jj929jkj5sadjfj93v3n'
username='nb78932lkjlskjfdb7g8'/>
</credentials>
</iq>
]]></example>
<p>For TURN, the server might construct time-limited credentials as described in &turn-rest;.</p>
<p>There MAY be multiple <service/> 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>
<p>If the server cannot obtain credentials at the service, it returns an appropriate stanza error, such as ¬found;, &remoteserver;, &timeout;, or ¬authorized;.</p>
</section2>
</section1>
<section1 topic='Extended Information' anchor='extended'>
<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 <value/> child of a distinct <field/> element, with the entire set of fields contained within an <x/> element of type "result" qualified by the 'jabber:x:data' namespace (see &xep0004;); this <x/> element SHOULD be a child of the <service/> element qualified by the 'urn:xmpp:extdisco:2' namespace &NSNOTE;. Thus the IQ result SHOULD be of the following form:</p>
<code><![CDATA[
<iq type='result'>
<services xmlns='urn:xmpp:extdisco:2'>
<service>
<x type='result' xmlns='jabber:x:data'>
<field var='[var-name]' label='[optional]'>
<value>[var-value]</value>
</field>
[ ... ]
</x>
</service>
</services>
</iq>]]></code>
<p>Note: A <field/> element MAY contain more than one <value/> child if appropriate.</p>
<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 <field/> element whose 'var' attribute has a value of "FORM_TYPE" and whose 'type' attribute has a value of "hidden".</p>
<p>Note: Although &xep0128; specifies that an XMPP entity MUST NOT supply extended information about associated children communicated via the 'http://jabber.org/protocol/disco#info' namespace, that rule does not apply to External Service Discovery since services external to the XMPP network cannot communicate via XMPP.</p>
</section1>
<section1 topic='Determining Support' anchor='disco'>
<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>
<example caption="Service Discovery Information Request"><![CDATA[
<iq from='[email protected]/orchard'
id='ix61z3m9'
to='montague.lit'
type='get'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
]]></example>
<example caption="Service Discovery Information Response"><![CDATA[
<iq from='montague.lit'
id='ix61z3m9'
to='[email protected]/orchard'
type='result'>
<query xmlns='http://jabber.org/protocol/disco#info'>
<feature var='urn:xmpp:extdisco:2'/>
</query>
</iq>
]]></example>
</section1>
<section1 topic='Internationalization Considerations' anchor='i18n'>
<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>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<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>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<section2 topic='Protocol Namespaces' anchor='registrar-ns'>
<p>This specification defines the following XML namespace:</p>
<ul>
<li>urn:xmpp:extdisco:2</li>
</ul>
<p>Upon advancement of this specification from a status of Experimental to a status of Draft, the ®ISTRAR; shall add the foregoing namespace to the registry located at &NAMESPACES;, as described in Section 4 of &xep0053;.</p>
</section2>
<section2 topic='Protocol Versioning' anchor='registrar-versioning'>
&NSVER;
</section2>
<section2 topic='External Service Types Registry' anchor='registrar-services'>
<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>
<section3 topic='Process' anchor='registrar-methods-process'>
®PROCESS;
<code><![CDATA[
<service>
<name>the XML character data of the service type</name>
<desc>a natural-language description of the service type</desc>
<doc>the document that best defines the service type</doc>
</service>
]]></code>
<p>The registrant can register more than one service type at a time, each contained in a separate <service/> element.</p>
</section3>
<section3 topic='Registration' anchor='registrar-methods-init'>
<code><![CDATA[
<service>
<name>stun</name>
<desc>a server that provides Session Traversal Utilities for NAT (STUN)</desc>
<doc>RFC 5389</doc>
</service>
<service>
<name>turn</name>
<desc>a server that provides Traversal Using Relays around NAT (TURN)</desc>
<doc>RFC 5766</doc>
</service>
]]></code>
</section3>
</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='urn:xmpp:extdisco:2'
xmlns='urn:xmpp:extdisco:2'
elementFormDefault='qualified'>
<xs:import
namespace='jabber:x:data'
schemaLocation='http://www.xmpp.org/schemas/x-data.xsd'/>
<xs:element name='services'>
<xs:complexType>
<xs:sequence minOccurs='0' maxOccurs='unbounded'>
<xs:element ref='service'/>
</xs:sequence>
<xs:attribute name='type' type='xs:NCName' use='optional'/>
</xs:complexType>
</xs:element>
<xs:element name='credentials'>
<xs:complexType>
<xs:sequence>
<xs:element ref='service' minOccurs='0' maxOccurs='unbounded'/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name='service'>
<xs:complexType>
<xs:sequence xmlns:xdata='jabber:x:data'>
<xs:element ref='xdata:x' minOccurs='0'/>
</xs:sequence>
<xs:attribute name='action' use='optional' default='add'>
<xs:simpleType>
<xs:restriction base='xs:NCName'>
<xs:enumeration value='add'/>
<xs:enumeration value='delete'/>
<xs:enumeration value='modify'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name='expires' type='xs:dateTime' use='optional'/>
<xs:attribute name='host' type='xs:string' use='required'/>
<xs:attribute name='name' type='xs:string' use='optional'/>
<xs:attribute name='password' type='xs:string' use='optional'/>
<xs:attribute name='port' type='xs:unsignedShort' use='optional'/>
<xs:attribute name='restricted' type='xs:boolean' use='optional'/>
<xs:attribute name='transport' type='xs:NCName' use='optional'/>
<xs:attribute name='type' type='xs:NCName' use='required'/>
<xs:attribute name='username' type='xs:string' use='optional'/>
</xs:complexType>
</xs:element>
</xs:schema>
]]></code>
</section1>
<section1 topic='Acknowledgements' anchor='ack'>
<p>Thanks to Philipp Hancke, Justin Karneges, Evgeniy Khramtsov, and Unnikrishnan Vikrama Panicker for their feedback.</p>
</section1>
</xep>