idnits 2.17.1 draft-ietf-xmpp-core-20.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** Looks like you're using RFC 2026 boilerplate. This must be updated to follow RFC 3978/3979, as updated by RFC 4748. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- == No 'Intended status' indicated for this document; assuming Proposed Standard Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- == There are 1 instance of lines with non-RFC2606-compliant FQDNs in the document. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the RFC 3978 Section 5.4 Copyright Line does not match the current year == The document seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). -- The exact meaning of the all-uppercase expression 'NOT REQUIRED' is not defined in RFC 2119. If it is intended as a requirements expression, it should be rewritten using one of the combinations defined in RFC 2119; otherwise it should not be all-uppercase. -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (November 20, 2003) is 7463 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '43' on line 380 -- Looks like a reference, but probably isn't: '3' on line 1198 ** Obsolete normative reference: RFC 2234 (ref. 'ABNF') (Obsoleted by RFC 4234) ** Obsolete normative reference: RFC 3548 (ref. 'BASE64') (Obsoleted by RFC 4648) ** Obsolete normative reference: RFC 2078 (ref. 'GSS-API') (Obsoleted by RFC 2743) ** Obsolete normative reference: RFC 2818 (ref. 'HTTP-TLS') (Obsoleted by RFC 9110) ** Downref: Normative reference to an Informational RFC: RFC 2779 (ref. 'IMP-REQS') ** Obsolete normative reference: RFC 3066 (ref. 'LANGTAGS') (Obsoleted by RFC 4646, RFC 4647) ** Obsolete normative reference: RFC 3490 (ref. 'IDNA') (Obsoleted by RFC 5890, RFC 5891) ** Obsolete normative reference: RFC 3491 (ref. 'NAMEPREP') (Obsoleted by RFC 5891) ** Obsolete normative reference: RFC 2222 (ref. 'SASL') (Obsoleted by RFC 4422, RFC 4752) ** Obsolete normative reference: RFC 3454 (ref. 'STRINGPREP') (Obsoleted by RFC 7564) ** Obsolete normative reference: RFC 793 (ref. 'TCP') (Obsoleted by RFC 9293) ** Obsolete normative reference: RFC 2246 (ref. 'TLS') (Obsoleted by RFC 4346) -- Possible downref: Non-RFC (?) normative reference: ref. 'UCS2' ** Obsolete normative reference: RFC 2279 (ref. 'UTF-8') (Obsoleted by RFC 3629) -- Possible downref: Non-RFC (?) normative reference: ref. 'XML' -- Possible downref: Non-RFC (?) normative reference: ref. 'XML-NAMES' -- Obsolete informational reference (is this intentional?): RFC 2535 (ref. 'DNSSEC') (Obsoleted by RFC 4033, RFC 4034, RFC 4035) -- Obsolete informational reference (is this intentional?): RFC 2616 (ref. 'HTTP') (Obsoleted by RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7234, RFC 7235) -- Obsolete informational reference (is this intentional?): RFC 2060 (ref. 'IMAP') (Obsoleted by RFC 3501) -- Obsolete informational reference (is this intentional?): RFC 2396 (ref. 'URI') (Obsoleted by RFC 3986) == Outdated reference: A later version (-22) exists of draft-ietf-xmpp-im-19 Summary: 14 errors (**), 0 flaws (~~), 5 warnings (==), 13 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 XMPP Working Group P. Saint-Andre (ed.) 2 Internet-Draft Jabber Software Foundation 3 Expires: May 20, 2004 November 20, 2003 5 Extensible Messaging and Presence Protocol (XMPP): Core 6 draft-ietf-xmpp-core-20 8 Status of this Memo 10 This document is an Internet-Draft and is in full conformance with 11 all provisions of Section 10 of RFC2026. 13 Internet-Drafts are working documents of the Internet Engineering 14 Task Force (IETF), its areas, and its working groups. Note that other 15 groups may also distribute working documents as Internet-Drafts. 17 Internet-Drafts are draft documents valid for a maximum of six months 18 and may be updated, replaced, or obsoleted by other documents at any 19 time. It is inappropriate to use Internet-Drafts as reference 20 material or to cite them other than as "work in progress." 22 The list of current Internet-Drafts can be accessed at http:// 23 www.ietf.org/ietf/1id-abstracts.txt. 25 The list of Internet-Draft Shadow Directories can be accessed at 26 http://www.ietf.org/shadow.html. 28 This Internet-Draft will expire on May 20, 2004. 30 Copyright Notice 32 Copyright (C) The Internet Society (2003). All Rights Reserved. 34 Abstract 36 This memo defines the core features of the Extensible Messaging and 37 Presence Protocol (XMPP), a protocol for streaming Extensible Markup 38 Language (XML) elements in order to exchange structured information 39 in close to real time between any two network endpoints. While XMPP 40 provides a generalized, extensible framework for exchanging XML data, 41 it is used mainly for the purpose of building instant messaging and 42 presence applications that meet the requirements of RFC 2779. 44 Table of Contents 46 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 47 2. Generalized Architecture . . . . . . . . . . . . . . . . . . . 4 48 3. Addressing Scheme . . . . . . . . . . . . . . . . . . . . . . 6 49 4. XML Streams . . . . . . . . . . . . . . . . . . . . . . . . . 8 50 5. Use of TLS . . . . . . . . . . . . . . . . . . . . . . . . . . 18 51 6. Use of SASL . . . . . . . . . . . . . . . . . . . . . . . . . 26 52 7. Resource Binding . . . . . . . . . . . . . . . . . . . . . . . 36 53 8. Server Dialback . . . . . . . . . . . . . . . . . . . . . . . 39 54 9. XML Stanzas . . . . . . . . . . . . . . . . . . . . . . . . . 45 55 10. Server Rules for Handling XML Stanzas . . . . . . . . . . . . 54 56 11. XML Usage within XMPP . . . . . . . . . . . . . . . . . . . . 57 57 12. Core Compliance Requirements . . . . . . . . . . . . . . . . . 59 58 13. Internationalization Considerations . . . . . . . . . . . . . 61 59 14. Security Considerations . . . . . . . . . . . . . . . . . . . 61 60 15. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 65 61 Normative References . . . . . . . . . . . . . . . . . . . . . 68 62 Informative References . . . . . . . . . . . . . . . . . . . . 70 63 Author's Address . . . . . . . . . . . . . . . . . . . . . . . 71 64 A. Nodeprep . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 65 B. Resourceprep . . . . . . . . . . . . . . . . . . . . . . . . . 73 66 C. XML Schemas . . . . . . . . . . . . . . . . . . . . . . . . . 75 67 D. Differences Between Core Jabber Protocol and XMPP . . . . . . 82 68 E. Revision History . . . . . . . . . . . . . . . . . . . . . . . 84 69 Intellectual Property and Copyright Statements . . . . . . . . 92 71 1. Introduction 73 1.1 Overview 75 The Extensible Messaging and Presence Protocol (XMPP) is an open XML 76 [XML] protocol for near-real-time messaging, presence, and 77 request-response services. The basic syntax and semantics were 78 developed originally within the Jabber open-source community, mainly 79 in 1999. In 2002, the XMPP WG was chartered with developing an 80 adaptation of the Jabber protocol that would be suitable as an IETF 81 instant messaging (IM) and presence technology. As a result of work 82 by the XMPP WG, the current memo defines the core features of XMPP; 83 Extensible Messaging and Presence Protocol (XMPP): Instant Messaging 84 and Presence [XMPP-IM] defines the extensions required to provide the 85 instant messaging and presence functionality defined in RFC 2779 86 [IMP-REQS]. 88 1.2 Terminology 90 The capitalized key words "MUST", "MUST NOT", "REQUIRED", "SHALL", 91 "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and 92 "OPTIONAL" in this document are to be interpreted as described in RFC 93 2119 [TERMS]. 95 1.3 Discussion Venue 97 The authors welcome discussion and comments related to the topics 98 presented in this document. The preferred forum is the 99 mailing list, for which archives and subscription 100 information are available at . 103 1.4 Intellectual Property Notice 105 This document is in full compliance with all provisions of Section 10 106 of RFC 2026. Parts of this specification use the term "jabber" for 107 identifying namespaces and other protocol syntax. Jabber[tm] is a 108 registered trademark of Jabber, Inc. Jabber, Inc. grants permission 109 to the IETF for use of the Jabber trademark in association with this 110 specification and its successors, if any. 112 1.5 Contributors 114 Most of the core aspects of the Extensible Messaging and Presence 115 Protocol were developed originally within the Jabber open-source 116 community in 1999. This community was founded by Jeremie Miller, who 117 released source code for the initial version of the jabberd server in 118 January 1999. Major early contributors to the base protocol also 119 included Ryan Eatmon, Peter Millard, Thomas Muldowney, and Dave 120 Smith. Work by the XMPP Working Group has concentrated especially on 121 security and internationalization; in these areas, protocols for the 122 use of TLS and SASL were originally contributed by Rob Norris, and 123 stringprep profiles were originally contributed by Joe Hildebrand. 124 The error code syntax was suggested by Lisa Dusseault. 126 1.6 Acknowledgements 128 Thanks are due to a number of individuals in addition to the 129 contributors listed. Although it is difficult to provide a complete 130 list, the following individuals were particularly helpful in defining 131 the protocols or in commenting on the specifications in this memo: 132 Thomas Charron, Richard Dobson, Sam Hartman, Schuyler Heath, Jonathan 133 Hogg, Craig Kaes, Jacek Konieczny, Alexey Melnikov, Keith Minkler, 134 Julian Missig, Pete Resnick, Marshall Rose, Alexey Shchepin, 135 Jean-Louis Seguineau, Iain Shigeoka, and David Waite. Thanks also to 136 members of the XMPP Working Group and the IETF community for comments 137 and feedback provided throughout the life of this memo. 139 2. Generalized Architecture 141 2.1 Overview 143 Although XMPP is not wedded to any specific network architecture, to 144 date it usually has been implemented via a typical client-server 145 architecture, wherein a client utilizing XMPP accesses a server over 146 a TCP [TCP] socket. 148 The following diagram provides a high-level overview of this 149 architecture (where "-" represents communications that use XMPP and 150 "=" represents communications that use any other protocol). 152 C1 - S1 - S2 - C3 153 / \ 154 C2 - G1 = FN1 = FC1 156 The symbols are as follows: 158 o C1, C2, C3 -- XMPP clients 160 o S1, S2 -- XMPP servers 162 o G1 -- A gateway that translates between XMPP and the protocol(s) 163 used on a foreign (non-XMPP) messaging network 165 o FN1 -- A foreign messaging network 166 o FC1 -- A client on a foreign messaging network 168 2.2 Server 170 A server acts as an intelligent abstraction layer for XMPP 171 communications. Its primary responsibilities are: 173 o to manage connections from or sessions for other entities, in the 174 form of XML streams (Section 4) to and from authorized clients, 175 servers, and other entities 177 o to route appropriately-addressed XML stanzas (Section 9) among 178 such entities over XML streams 180 Most XMPP-compliant servers also assume responsibility for the 181 storage of data that is used by clients (e.g., contact lists for 182 users of XMPP-based instant messaging and presence applications); in 183 this case, the XML data is processed directly by the server itself on 184 behalf of the client and is not routed to another entity. 186 2.3 Client 188 Most clients connect directly to a server over a [TCP] socket and use 189 XMPP to take full advantage of the functionality provided by a server 190 and any associated services. Although there is no necessary coupling 191 of an XML stream to a TCP socket (e.g., a client could connect via 192 HTTP [HTTP] polling or some other mechanism), this specification 193 defines a binding of XMPP to TCP only. Multiple resources (e.g., 194 devices or locations) MAY connect simultaneously to a server on 195 behalf of each authorized client, with each resource differentiated 196 by the resource identifier of an XMPP address (e.g., vs. ) as defined under Addressing Scheme 198 (Section 3). The RECOMMENDED port for connections between a client 199 and a server is 5222, as registered with the IANA (see Port Numbers 200 (Section 15.9)). 202 2.4 Gateway 204 A gateway is a special-purpose server-side service whose primary 205 function is to translate XMPP into the protocol used by a foreign 206 (non-XMPP) messaging system, as well as to translate the return data 207 back into XMPP. Examples are gateways to Internet Relay Chat (IRC), 208 Short Message Service (SMS), SIMPLE, SMTP, and legacy instant 209 messaging networks such as AIM, ICQ, MSN Messenger, and Yahoo! 210 Instant Messenger. Communications between gateways and servers, and 211 between gateways and the foreign messaging system, are not defined in 212 this document. 214 2.5 Network 216 Because each server is identified by a network address and because 217 server-to-server communications are a straightforward extension of 218 the client-to-server protocol, in practice the system consists of a 219 network of servers that inter-communicate. Thus user-a@domain1 is 220 able to exchange messages, presence, and other information with 221 user-b@domain2. This pattern is familiar from messaging protocols 222 (such as SMTP) that make use of network addressing standards. 223 Communications between any two servers are OPTIONAL. If enabled, 224 such communications SHOULD occur over XML streams that are bound to 225 [TCP] sockets. The RECOMMENDED port for connections between servers 226 is 5269, as registered with the IANA (see Port Numbers (Section 227 15.9)). 229 3. Addressing Scheme 231 3.1 Overview 233 An entity is anything that can be considered a network endpoint 234 (i.e., an ID on the network) and that can communicate using XMPP. 235 All such entities are uniquely addressable in a form that is 236 consistent with RFC 2396 [URI]. For historical reasons, the address 237 of an XMPP entity is called a Jabber Identifier or JID. A valid JID 238 contains a set of ordered elements formed of a domain identifier, 239 node identifier, and resource identifier. The syntax is defined below 240 using Augmented Backus-Naur Form as defined in RFC 2234 [ABNF], where 241 the "node", "domain", and "resource" identifiers are as specified in 242 the following sections: 244 [ node "@" ] domain [ "/" resource ] 246 Each allowable portion of a JID (node identifier, domain identifier, 247 and resource identifier) MUST NOT be more than 1023 bytes in length, 248 resulting in a maximum total size (including the '@' and '/' 249 separators) of 3071 bytes. 251 All JIDs are based on the foregoing structure. The most common use 252 of this structure is to identify an instant messaging user, the 253 server to which the user connects, and the user's active session or 254 connection (e.g., a specific client) in the form of . However, node types other than clients are possible; for 256 example, a specific chat room offered by a multi-user chat service 257 could be addressed as (where "room" is the name of the 258 chat room and "service" is the hostname of the multi-user chat 259 service) and a specific occupant of such a room could be addressed as 260 (where "nick" is the occupant's room nickname). 261 Many other JID types are possible (e.g., could be a 262 server-side script or service). 264 3.2 Domain Identifier 266 The domain identifier is the primary identifier and is the only 267 REQUIRED element of a JID (a mere domain identifier is a valid JID). 268 It usually represents the network gateway or "primary" server to 269 which other entities connect for XML routing and data management 270 capabilities. However, the entity referenced by a domain identifier 271 is not always a server, and may be a service that is addressed as a 272 subdomain of a server and that provides functionality above and 273 beyond the capabilities of a server (e.g., a multi-user chat service, 274 a user directory, or a gateway to a foreign messaging system). 276 The domain identifier for every server or service that will 277 communicate over a network SHOULD be a Fully Qualified Domain Name. 278 A domain identifier MUST be an "internationalized domain name" as 279 defined in [IDNA], to which the Nameprep [NAMEPREP] profile of 280 stringprep [STRINGPREP] can be applied without failing. Before 281 comparing two domain identifiers, a server MUST (and a client SHOULD) 282 first apply the Nameprep profile to the labels (as defined in [IDNA]) 283 that make up each identifier. 285 3.3 Node Identifier 287 The node identifier is an optional secondary identifier placed before 288 the domain identifier and separated from the latter by the '@' 289 character. It usually represents the entity requesting and using 290 network access provided by the server or gateway (i.e., a client), 291 although it can also represent other kinds of entities (e.g., a chat 292 room associated with a multi-user chat service). The entity 293 represented by a node identifier is addressed within the context of a 294 specific domain; within instant messaging and presence applications 295 of XMPP this address is called a "bare JID" and is of the form 296 . 298 A node identifier MUST be formatted such that the Nodeprep (Appendix 299 A) profile of [STRINGPREP] can be applied to it without failing. 300 Before comparing two node identifiers, a server MUST (and a client 301 SHOULD) first apply the Nodeprep profile to each identifier. 303 3.4 Resource Identifier 305 The resource identifier is an optional tertiary identifier placed 306 after the domain identifier and separated from the latter by the '/' 307 character. A resource identifier may modify either a 308 or mere address. It usually represents a specific session, 309 connection (e.g., a device or location), or object (e.g., a 310 participant in a multi-user chat room) belonging to the entity 311 associated with a node identifier. A resource identifier is opaque 312 to both servers and other clients, and is typically defined by a 313 client implementation when it provides the information necessary to 314 complete Resource Binding (Section 7) (although it may be generated 315 by a server on behalf of a client). An entity MAY maintain multiple 316 resources simultaneously, with each resource differentiated by a 317 distinct resource identifier. 319 A resource identifier MUST be formatted such that the Resourceprep 320 (Appendix B) profile of [STRINGPREP] can be applied to it without 321 failing. Before comparing two resource identifiers, a server MUST 322 (and a client SHOULD) first apply the Resourceprep profile to each 323 identifier. 325 3.5 Determination of Addresses 327 After SASL negotiation (Section 6) and, if appropriate, Resource 328 Binding (Section 7), the receiving entity for a stream MUST determine 329 the initiating entity's JID. 331 For server-to-server communications, the initiating entity's JID 332 SHOULD be the authorization identity, derived from the authentication 333 identity as defined by the Simple Authentication and Security Layer 334 (SASL) specification [SASL] if no authorization identity was 335 specified during SASL negotiation (Section 6). 337 For client-to-server communications, the "bare JID" () 338 SHOULD be the authorization identity, derived from the authentication 339 identity as defined in [SASL] if no authorization identity was 340 specified during SASL negotiation (Section 6); the resource 341 identifier portion of the "full JID" () SHOULD 342 be the resource identifier negotiated by the client and server during 343 Resource Binding (Section 7). 345 The receiving entity MUST ensure that the resulting JID (including 346 node identifier, domain identifier, resource identifier, and 347 separator characters) conforms to the rules and formats defined 348 earlier in this section; to meet this restriction, the receiving 349 entity may need to replace the JID sent by the initiating entity with 350 the canonicalized JID as determined by the receiving entity. 352 4. XML Streams 354 4.1 Overview 356 Two fundamental concepts make possible the rapid, asynchronous 357 exchange of relatively small payloads of structured information 358 between presence-aware entities: XML streams and XML stanzas. These 359 terms are defined as follows: 361 Definition of XML Stream: An XML stream is a container for the 362 exchange of XML elements between any two entities over a network. 363 An XML stream is negotiated from an initiating entity (usually a 364 client or server) to a receiving entity (usually a server), 365 normally over a [TCP] socket, and corresponds to the initiating 366 entity's "session" with the receiving entity. The start of the 367 XML stream is denoted unambiguously by an opening XML tag 368 (with appropriate attributes and namespace declarations), while 369 the end of the XML stream is denoted unambiguously by a closing 370 XML tag. An XML stream is unidirectional; in order to 371 enable bidirectional information exchange, the initiating entity 372 and receiving entity MUST negotiate one stream in each direction 373 (the "initial stream" and the "response stream"), normally over 374 the same TCP connection. 376 Definition of XML Stanza: An XML stanza is a discrete semantic unit 377 of structured information that is sent from one entity to another 378 over an XML stream. An XML stanza exists at the direct child 379 level of the root element and is said to be 380 well-balanced if it matches production [43] content of [XML]). 381 The start of any XML stanza is denoted unambiguously by the 382 element start tag at depth=1 of the XML stream (e.g., ), 383 and the end of any XML stanza is denoted unambiguously by the 384 corresponding close tag at depth=1 (e.g., ). An XML 385 stanza MAY contain child elements (with accompanying attributes, 386 elements, and CDATA) as necessary in order to convey the desired 387 information. The only defined XML stanzas are , 388 , and as defined under XML Stanzas (Section 9); 389 an XML element sent for the purpose of Transport Layer Security 390 (TLS) negotiation (Section 5), Simple Authentication and Security 391 Layer (SASL) negotiation (Section 6), or server dialback (Section 392 8) is not considered to be an XML stanza. 394 Consider the example of a client's session with a server. In order 395 to connect to a server, a client MUST initiate an XML stream by 396 sending an opening tag to the server, optionally preceded by 397 a text declaration specifying the XML version and the character 398 encoding supported (see Inclusion of Text Declaration (Section 11.4); 399 see also Character Encoding (Section 11.5)). Subject to local 400 policies and service provisioning, the server SHOULD then reply with 401 a second XML stream back to the client, again optionally preceded by 402 a text declaration. Once the client has completed SASL negotiation 403 (Section 6), the client MAY send an unbounded number of XML stanzas 404 over the stream to any recipient on the network. When the client 405 desires to close the stream, it simply sends a closing tag 406 to the server (alternatively, the stream may be closed by the 407 server), after which both the client and server SHOULD close the 408 underlying TCP connection as well. 410 Those who are accustomed to thinking of XML in a document-centric 411 manner may wish to view a client's session with a server as 412 consisting of two open-ended XML documents: one from the client to 413 the server and one from the server to the client. From this 414 perspective, the root element can be considered the 415 document entity for each "document", and the two "documents" are 416 built up through the accumulation of XML stanzas sent over the two 417 XML streams. However, this perspective is a convenience only, and 418 XMPP does not deal in documents but in XML streams and XML stanzas. 420 In essence, then, an XML stream acts as an envelope for all the XML 421 stanzas sent during a session. We can represent this in a simplistic 422 fashion as follows: 424 |--------------------| 425 | | 426 |--------------------| 427 | | 428 | | 429 | | 430 |--------------------| 431 | | 432 | | 433 | | 434 |--------------------| 435 | | 436 | | 437 | | 438 |--------------------| 439 | ... | 440 |--------------------| 441 | | 442 |--------------------| 444 4.2 Stream Attributes 446 The attributes of the stream element are as follows: 448 o to -- The 'to' attribute SHOULD be used only in the XML stream 449 header from the initiating entity to the receiving entity, and 450 MUST be set to a hostname serviced by the receiving entity. There 451 SHOULD be no 'to' attribute set in the XML stream header by which 452 the receiving entity replies to the initiating entity; however, if 453 a 'to' attribute is included, it SHOULD be silently ignored by the 454 initiating entity. 456 o from -- The 'from' attribute SHOULD be used only in the XML stream 457 header from the receiving entity to the initiating entity, and 458 MUST be set to a hostname serviced by the receiving entity that is 459 granting access to the initiating entity. There SHOULD be no 460 'from' attribute on the XML stream header sent from the initiating 461 entity to the receiving entity; however, if a 'from' attribute is 462 included, it SHOULD be silently ignored by the receiving entity. 464 o id -- The 'id' attribute SHOULD be used only in the XML stream 465 header from the receiving entity to the initiating entity. This 466 attribute is a unique identifier created by the receiving entity 467 to function as a session key for the initiating entity's streams 468 with the receiving entity, and MUST be unique within the receiving 469 application (normally a server). There SHOULD be no 'id' 470 attribute on the XML stream header sent from the initiating entity 471 to the receiving entity; however, if an 'id' attribute is 472 included, it SHOULD be silently ignored by the receiving entity. 474 o xml:lang -- An 'xml:lang' attribute (as defined in Section 2.12 of 475 [XML]) SHOULD be included by the initiating entity on the header 476 for the initial stream to specify the default language of any 477 human-readable XML character data it sends over that stream. If 478 the attribute is included, the receiving entity SHOULD remember 479 that value as the default for both the initial stream and the 480 response stream; if the attribute is not included, the receiving 481 entity SHOULD use a configurable default value for both streams, 482 which it MUST communicate in the header for the response stream. 483 For all stanzas sent over the initial stream, if the initiating 484 entity does not include an 'xml:lang' attribute, the receiving 485 entity SHOULD apply the default value; if the initiating entity 486 does include an 'xml:lang' attribute, the receiving entity MUST 487 NOT modify or delete it (see also xml:lang (Section 9.1.5)). The 488 value of the 'xml:lang' attribute MUST be an NMTOKEN (as defined 489 in Section 2.3 of [XML]) and MUST conform to the format defined in 490 RFC 3066 [LANGTAGS]. 492 o version -- The presence of the version attribute set to a value of 493 "1.0" signals support for the stream-related protocols (including 494 stream features) defined in this specification. Detailed rules 495 regarding generation and handling of this attribute are defined 496 below. 498 We can summarize as follows: 500 | initiating to receiving | receiving to initiating 502 ---------+---------------------------+----------------------- 503 to | hostname of receiver | silently ignored 504 from | silently ignored | hostname of receiver 505 id | silently ignored | session key 506 xml:lang | default language | default language 507 version | signals XMPP 1.0 support | signals XMPP 1.0 support 509 4.2.1 Version Support 511 The following rules apply to the generation and handling of the 512 'version' attribute: 514 1. If the initiating entity complies with the stream-related 515 protocols defined herein (including Use of TLS (Section 5), Use 516 of SASL (Section 6), and Stream Errors (Section 4.6)), it MUST 517 include the 'version' attribute in the XML stream header it sends 518 to the receiving entity, and it MUST set the value of the 519 'version' attribute to "1.0". 521 2. If the initiating entity includes the 'version' attribute set to 522 a value of "1.0" in its stream header and the receiving entity 523 supports XMPP 1.0, the receiving entity MUST reciprocate by 524 including the 'version' attribute set to a value of "1.0" in its 525 stream header response. 527 3. If the initiating entity does not include the 'version' attribute 528 in its stream header, the receiving entity still SHOULD include 529 the 'version' attribute set to a value of "1.0" in its stream 530 header response. 532 4. If the initiating entity includes the 'version' attribute set to 533 a value other than "1.0", the receiving entity SHOULD include the 534 'version' attribute set to a value of "1.0" in its stream header 535 response, but MAY at its discretion generate an 536 stream error and terminate the XML stream 537 and underlying TCP connection. 539 5. If the receiving entity includes the 'version' attribute set to a 540 value other than "1.0" in its stream header response, the 541 initiating entity SHOULD generate an 542 stream error and terminate the XML stream and underlying TCP 543 connection. 545 4.3 Namespace Declarations 547 The stream element MUST possess both a streams namespace declaration 548 and a default namespace declaration (as "namespace declaration" is 549 defined in the XML namespaces specification [XML-NAMES]). For 550 detailed information regarding the streams namespace and default 551 namespace, see Namespace Names and Prefixes (Section 11.2). 553 4.4 Stream Features 555 If the initiating entity includes the 'version' attribute set to a 556 value of "1.0" in the initial stream header, the receiving entity 557 MUST send a child element (prefixed by the streams 558 namespace prefix) to the initiating entity in order to announce any 559 stream-level features that can be negotiated (or capabilities that 560 otherwise need to be advertised). Currently this is used only to 561 advertise Use of TLS (Section 5), Use of SASL (Section 6), and 562 Resource Binding (Section 7) as defined herein, and for Session 563 Establishment as defined in [XMPP-IM]; however, the stream features 564 functionality could be used to advertise other negotiable features in 565 the future. If an entity does not understand or support some 566 features, it SHOULD silently ignore them. 568 4.5 Stream Security 570 When negotiating XML streams in XMPP 1.0, TLS SHOULD be used as 571 defined under Use of TLS (Section 5) and SASL MUST be used as defined 572 under Use of SASL (Section 6). If the initiating entity attempts to 573 send an XML Stanza (Section 9) before the stream has been 574 authenticated, the receiving entity SHOULD return a 575 stream error to the initiating entity and then terminate both the XML 576 stream and the underlying TCP connection. 578 4.6 Stream Errors 580 The root stream element MAY contain an child element that is 581 prefixed by the streams namespace prefix. The error child MUST be 582 sent by a compliant entity (usually a server rather than a client) if 583 it perceives that a stream-level error has occurred. 585 4.6.1 Rules 587 The following rules apply to stream-level errors: 589 o It is assumed that all stream-level errors are unrecoverable; 590 therefore, if an error occurs at the level of the stream, the 591 entity that detects the error MUST send a stream error to the 592 other entity, send a closing tag, and terminate the 593 underlying TCP connection. 595 o If the error occurs while the stream is being set up, the 596 receiving entity MUST still send the opening tag, include 597 the element as a child of the stream element, send the 598 closing tag, and terminate the underlying TCP 599 connection. In this case, if the initiating entity provides an 600 unknown host in the 'to' attribute (or provides no 'to' attribute 601 at all), the server SHOULD provide the server's authoritative 602 hostname in the 'from' attribute of the stream header sent before 603 termination. 605 4.6.2 Syntax 607 The syntax for stream errors is as follows: 609 610 611 612 OPTIONAL descriptive text 613 614 [OPTIONAL application-specific condition element] 615 617 The element: 619 o MUST contain a child element corresponding to one of the defined 620 stanza error conditions defined below; this element MUST be 621 qualified by the 'urn:ietf:params:xml:ns:xmpp-streams' namespace 623 o MAY contain a child containing CDATA that describes the 624 error in more detail; this element MUST be qualified by the 625 'urn:ietf:params:xml:ns:xmpp-streams' namespace and SHOULD possess 626 an 'xml:lang' attribute 628 o MAY contain a child element for an application-specific error 629 condition; this element MUST be qualified by an 630 application-defined namespace, and its structure is defined by 631 that namespace 633 The element is OPTIONAL. If included, it SHOULD be used only 634 to provide descriptive or diagnostic information that supplements the 635 meaning of a defined condition or application-specific condition. It 636 SHOULD NOT be interpreted programmatically by an application. It 637 SHOULD NOT be used as the error message presented to a user, but MAY 638 be shown in addition to the error message associated with the 639 included condition element (or elements). 641 4.6.3 Defined Conditions 642 The following stream-level error conditions are defined: 644 o -- the entity has sent XML that cannot be processed; 645 this error MAY be used rather than more specific XML-related 646 errors such as , , 647 , , and 648 , although the more specific errors are 649 preferred. 651 o -- the entity has sent a namespace prefix 652 that is unsupported, or has sent no namespace prefix on an element 653 that requires such a prefix (see XML Namespace Names and Prefixes 654 (Section 11.2)). 656 o -- the server is closing the active stream for this 657 entity because a new stream has been initiated that conflicts with 658 the existing stream. 660 o -- the entity has not generated any traffic 661 over the stream for some period of time (configurable according to 662 a local service policy). 664 o -- the value of the 'to' attribute provided by the 665 initiating entity in the stream header corresponds to a hostname 666 that is no longer hosted by the server. 668 o -- the value of the 'to' attribute provided by the 669 initiating entity in the stream header does not correspond to a 670 hostname that is hosted by the server. 672 o -- a stanza sent between two servers lacks 673 a 'to' or 'from' attribute (or the attribute has no value). 675 o -- the server has experienced a 676 misconfiguration or an otherwise-undefined internal error that 677 prevents it from servicing the stream. 679 o -- the JID or hostname provided in a 'from' 680 address does not match an authorized JID or validated domain 681 negotiated between servers via SASL or dialback, or between a 682 client and a server via authentication and resource authorization. 684 o -- the stream ID or dialback ID is invalid or does 685 not match an ID previously provided. 687 o -- the streams namespace name is something 688 other than "http://etherx.jabber.org/streams" or the dialback 689 namespace name is something other than "jabber:server:dialback" 690 (see XML Namespace Names and Prefixes (Section 11.2)). 692 o -- the entity has sent invalid XML over the stream 693 to a server that performs validation (see Validation (Section 694 11.3)). 696 o -- the entity has attempted to send data before 697 the stream has been authenticated, or otherwise is not authorized 698 to perform an action related to stream negotiation; the receiving 699 entity MUST NOT process the offending stanza before sending the 700 stream error. 702 o -- the entity has violated some local service 703 policy; the server MAY choose to specify the policy in the 704 element. 706 o -- the server is unable to properly 707 connect to a remote resource that is required for authentication 708 or authorization. 710 o -- the server lacks the system resources 711 necessary to service the stream. 713 o -- the entity has attempted to send restricted 714 XML features such as a comment, processing instruction, DTD, 715 entity reference, or unescaped character (see Restrictions 716 (Section 11.1)). 718 o -- the server will not provide service to the 719 initiating entity but is redirecting traffic to another host; the 720 server SHOULD specify the alternate hostname or IP address in the 721 CDATA of the element. 723 o -- the server is being shut down and all active 724 streams are being closed. 726 o -- the error condition is not one of those 727 defined by the other conditions in this list; this error condition 728 SHOULD be used only in conjunction with an application-specific 729 condition. 731 o -- the initiating entity has encoded the 732 stream in an encoding that is not supported by the server (see 733 Character Encoding (Section 11.5)). 735 o -- the initiating entity has sent a 736 first-level child of the stream that is not supported by the 737 server. 739 o -- the value of the 'version' attribute 740 provided by the initiating entity in the stream header specifies a 741 version of XMPP that is not supported by the server; the server 742 MAY specify the version(s) it supports in the element. 744 o -- the initiating entity has sent XML that 745 is not well-formed as defined by [XML]. 747 4.6.4 Application-Specific Conditions 749 As noted, an application MAY provide application-specific stream 750 error information by including a properly-namespaced child in the 751 error element. The application-specific element SHOULD supplement or 752 further qualify a defined element. Thus the element will 753 contain two or three child elements: 755 756 758 759 Some special application diagnostic information! 760 761 762 763 765 4.7 Simplified Stream Examples 767 This section contains two simplified examples of a stream-based 768 "session" of a client on a server (where the "C" lines are sent from 769 the client to the server, and the "S" lines are sent from the server 770 to the client); these examples are included for the purpose of 771 illustrating the concepts introduced thus far. 773 A basic "session": 775 C: 776 781 S: 782 788 ... encryption, authentication, and resource binding ... 789 C: 792 C: Art thou not Romeo, and a Montague? 793 C: 794 S: 797 S: Neither, fair saint, if either thee dislike. 798 S: 799 C: 800 S: 802 A "session" gone bad: 804 C: 805 810 S: 811 817 ... encryption, authentication, and resource binding ... 818 C: 819 Bad XML, no closing body tag! 820 821 S: 822 824 825 S: 827 5. Use of TLS 829 5.1 Overview 831 XMPP includes a method for securing the stream from tampering and 832 eavesdropping. This channel encryption method makes use of the 833 Transport Layer Security (TLS) protocol [TLS], along with a 834 "STARTTLS" extension that is modelled after similar extensions for 835 the IMAP [IMAP], POP3 [POP3], and ACAP [ACAP] protocols as described 836 in RFC 2595 [USINGTLS]. The namespace name for the STARTTLS 837 extension is 'urn:ietf:params:xml:ns:xmpp-tls'. 839 An administrator of a given domain MAY require the use of TLS for 840 client-to-server communications, server-to-server communications, or 841 both. Clients SHOULD use TLS to secure the streams prior to 842 attempting to complete SASL negotiation (Section 6), and servers 843 SHOULD use TLS between two domains for the purpose of securing 844 server-to-server communications. 846 The following rules apply: 848 1. An initiating entity that complies with this specification MUST 849 include the 'version' attribute set to a value of "1.0" in the 850 initial stream header. 852 2. If the TLS negotiation occurs between two servers, 853 communications MUST NOT proceed until the Domain Name System 854 (DNS) hostnames asserted by the servers have been resolved (see 855 Server-to-Server Communications (Section 14.3)). 857 3. When a receiving entity that complies with this specification 858 receives an initial stream header that includes the 'version' 859 attribute set to a value of "1.0", after sending a stream header 860 in reply (including the version flag) it MUST include a 861 element (qualified by the 862 'urn:ietf:params:xml:ns:xmpp-tls' namespace) along with the list 863 of other stream features it supports. 865 4. If the initiating entity chooses to use TLS, TLS negotiation 866 MUST be completed before proceeding to SASL negotiation; this 867 order of negotiation is required in order to help safeguard 868 authentication information sent during SASL negotiation, as well 869 as to make it possible to base the use of the SASL EXTERNAL 870 mechanism on a certificate provided during prior TLS 871 negotiation. 873 5. During TLS negotiation, an entity MUST NOT send any white space 874 characters (matching production [3] content of [XML]) within the 875 root stream element as separators between elements (any white 876 space characters shown in the TLS examples below are included 877 for the sake of readability only); this prohibition helps to 878 ensure proper security layer byte precision. 880 6. The receiving entity MUST consider the TLS negotiation to have 881 begun immediately after sending the closing ">" character of the 882 element. The initiating entity MUST consider the TLS 883 negotiation to have begun immediately after receiving the 884 closing ">" character of the element from the 885 receiving entity. 887 7. The initiating entity MUST validate the certificate presented by 888 the receiving entity; there are two cases: 890 8. 892 Case 1 -- The initiating entity has been configured with a set 893 of trusted root certificates: Normal certificate validation 894 processing is appropriate, and SHOULD follow the rules 895 defined for HTTP over TLS [HTTP-TLS]. The trusted roots may 896 be either a well-known public set or a manually configured 897 Root CA (e.g., an organization's own Certificate Authority or 898 a self-signed Root CA for the service as defined under High 899 Security (Section 14.1)). This case is RECOMMENDED. 901 Case 2 -- The initiating entity has been configured with the 902 receiving entity's self-signed service certificate: Simple 903 comparison of public keys is appropriate. This case is NOT 904 RECOMMENDED (see High Security (Section 14.1) for details). 906 9. If the above methods fail, the certificate SHOULD be presented 907 to a human (e.g., an end user or server administrator) for 908 approval; if presented, the receiver MUST deliver the entire 909 certificate chain to the human, who SHOULD be given the option 910 to store the Root CA certificate (not the service or End Entity 911 certificate) and to not be queried again regarding acceptance of 912 the certificate for some reasonable period of time. Note well 913 that certificates MUST be checked against the hostname as 914 provided by the initiating entity (e.g., a user), not the 915 hostname as resolved via the Domain Name System; e.g., if a user 916 typed "example.com" but a DNS SRV [SRV] lookup returned 917 "im.example.com", the certificate MUST be checked as 918 "example.com". 920 10. If the TLS negotiation is successful, the receiving entity MUST 921 discard any knowledge obtained in an insecure manner from the 922 initiating entity before TLS takes effect. 924 11. If the TLS negotiation is successful, the initiating entity MUST 925 discard any knowledge obtained in an insecure manner from the 926 receiving entity before TLS takes effect. 928 12. If the TLS negotiation is successful, the receiving entity MUST 929 NOT offer the STARTTLS extension to the initiating entity along 930 with the other stream features that are offered when the stream 931 is restarted. 933 13. If the TLS negotiation is successful, the initiating entity MUST 934 continue with SASL negotiation. 936 14. If the TLS negotiation results in failure, the receiving entity 937 MUST terminate both the XML stream and the underlying TCP 938 connection. 940 15. See Mandatory-to-Implement Technologies (Section 14.6) regarding 941 mechanisms that MUST be supported. 943 5.2 Narrative 945 When an initiating entity secures a stream with a receiving entity, 946 the steps involved are as follows: 948 1. The initiating entity opens a TCP connection and initiates the 949 stream by sending the opening XML stream header to the receiving 950 entity, including the 'version' attribute set to a value of 951 "1.0". 953 2. The receiving entity responds by opening a TCP connection and 954 sending an XML stream header to the initiating entity, including 955 the 'version' attribute set to a value of "1.0". 957 3. The receiving entity offers the STARTTLS extension to the 958 initiating entity by including it with the list of other 959 supported stream features (if TLS is required for interaction 960 with the receiving entity, it SHOULD signal that fact by 961 including a element as a child of the 962 element). 964 4. The initiating entity issues the STARTTLS command (i.e., a 965 element qualified by the 966 'urn:ietf:params:xml:ns:xmpp-tls' namespace) to instruct the 967 receiving entity that it wishes to begin a TLS negotiation to 968 secure the stream. 970 5. The receiving entity MUST reply with either a element 971 or a element qualified by the 972 'urn:ietf:params:xml:ns:xmpp-tls' namespace. If the failure case 973 occurs, the receiving entity MUST terminate both the XML stream 974 and the underlying TCP connection. If the proceed case occurs, 975 the entities MUST attempt to complete the TLS negotiation over 976 the TCP connection and MUST NOT send any further XML data until 977 the TLS negotiation is complete. 979 6. The initiating entity and receiving entity attempt to complete a 980 TLS negotiation in accordance with [TLS]. 982 7. If the TLS negotiation is unsuccessful, the receiving entity MUST 983 terminate the TCP connection (it is not necessary to send a 984 closing tag first, since the receiving entity and 985 initiating entity MUST consider the original stream to be closed 986 upon sending or receiving the element). If the TLS 987 negotiation is successful, the initiating entity MUST initiate a 988 new stream by sending an opening XML stream header to the 989 receiving entity. 991 8. Upon receiving the new stream header from the initiating entity, 992 the receiving entity MUST respond by sending a new XML stream 993 header to the initiating entity along with the available features 994 (but NOT including the STARTTLS feature). 996 5.3 Client-to-Server Example 998 The following example shows the data flow for a client securing a 999 stream using STARTTLS (note: the alternate steps shown below are 1000 provided to illustrate the protocol for failure cases; they are not 1001 exhaustive and would not necessarily be triggered by the data sent in 1002 the example). 1004 Step 1: Client initiates stream to server: 1006 1012 Step 2: Server responds by sending a stream tag to client: 1014 1021 Step 3: Server sends the STARTTLS extension to client along with 1022 authentication mechanisms and any other stream features: 1024 1025 1026 1027 1028 1029 DIGEST-MD5 1030 PLAIN 1031 1032 1034 Step 4: Client sends the STARTTLS command to server: 1036 1038 Step 5: Server informs client to proceed: 1040 1042 Step 5 (alt): Server informs client that TLS negotiation has failed 1043 and closes both stream and TCP connection: 1045 1046 1048 Step 6: Client and server attempt to complete TLS negotiation over 1049 the existing TCP connection. 1051 Step 7: If TLS negotiation is successful, client initiates a new 1052 stream to server: 1054 1060 Step 7 (alt): If TLS negotiation is unsuccessful, Server2 closes TCP 1061 connection. 1063 Step 8: Server responds by sending a stream header to client along 1064 with any available stream features: 1066 1072 1073 1074 DIGEST-MD5 1075 PLAIN 1076 EXTERNAL 1077 1078 1080 Step 9: Client continues with SASL negotiation (Section 6). 1082 5.4 Server-to-Server Example 1084 The following example shows the data flow for two servers securing a 1085 stream using STARTTLS (note: the alternate steps shown below are 1086 provided to illustrate the protocol for failure cases; they are not 1087 exhaustive and would not necessarily be triggered by the data sent in 1088 the example). 1090 Step 1: Server1 initiates stream to Server2: 1092 1098 Step 2: Server2 responds by sending a stream tag to Server1: 1100 1107 Step 3: Server2 sends the STARTTLS extension to Server1 along with 1108 authentication mechanisms and any other stream features: 1110 1111 1112 1113 1114 1115 DIGEST-MD5 1116 KERBEROS_V4 1118 1119 1121 Step 4: Server1 sends the STARTTLS command to Server2: 1123 1125 Step 5: Server2 informs Server1 to proceed: 1127 1129 Step 5 (alt): Server2 informs Server1 that TLS negotiation has failed 1130 and closes stream: 1132 1133 1135 Step 6: Server1 and Server2 attempt to complete TLS negotiation via 1136 TCP. 1138 Step 7: If TLS negotiation is successful, Server1 initiates a new 1139 stream to Server2: 1141 1147 Step 7 (alt): If TLS negotiation is unsuccessful, server closes TCP 1148 connection. 1150 Step 8: Server2 responds by sending a stream header to Server1 along 1151 with any available stream features: 1153 1159 1160 1161 DIGEST-MD5 1162 KERBEROS_V4 1163 EXTERNAL 1164 1165 1166 Step 9: Server1 continues with SASL negotiation (Section 6). 1168 6. Use of SASL 1170 6.1 Overview 1172 XMPP includes a method for authenticating a stream by means of an 1173 XMPP-specific profile of the Simple Authentication and Security Layer 1174 (SASL) protocol [SASL]. SASL provides a generalized method for 1175 adding authentication support to connection-based protocols, and XMPP 1176 uses a generic XML namespace profile for SASL that conforms to the 1177 profiling requirements of [SASL]. 1179 The following rules apply: 1181 1. If the SASL negotiation occurs between two servers, 1182 communications MUST NOT proceed until the Domain Name System 1183 (DNS) hostnames asserted by the servers have been resolved (see 1184 Server-to-Server Communications (Section 14.3)). 1186 2. If the initiating entity is capable of SASL negotiation, it MUST 1187 include the 'version' attribute set to a value of "1.0" in the 1188 initial stream header. 1190 3. If the receiving entity is capable of SASL negotiation, it MUST 1191 send one or more authentication mechanisms within a element qualified by the 'urn:ietf:params:xml:ns:xmpp-sasl' 1193 namespace in reply to the opening stream tag received from the 1194 initiating entity (if the opening stream tag included the 1195 'version' attribute set to a value of "1.0"). 1197 4. During SASL negotiation, an entity MUST NOT send any white space 1198 characters (matching production [3] content of [XML]) within the 1199 root stream element as separators between elements (any white 1200 space characters shown in the SASL examples below are included 1201 for the sake of readability only); this prohibition helps to 1202 ensure proper security layer byte precision. 1204 5. Any character data contained within the XML elements used during 1205 SASL negotiation MUST be encoded using base64, where the 1206 encoding adheres to the definition in Section 3 of RFC 3548 1207 [BASE64]. 1209 6. If provision of a "simple username" is supported by the selected 1210 SASL mechanism (e.g., this is supported by the DIGEST-MD5 and 1211 CRAM-MD5 mechanisms but not by the EXTERNAL and GSSAPI 1212 mechanisms), during authentication the initiating entity SHOULD 1213 provide its sending domain (in the case of server-to-server 1214 communications) or registered account name (in the case of 1215 client-to-server communications) as the simple username. 1217 7. If the initiating entity wishes to act on behalf of another 1218 entity and the selected SASL mechanism supports transmission of 1219 an authorization identity, the initiating entity MUST provide an 1220 authorization identity during SASL negotiation. If the 1221 initiating entity does not wish to act on behalf of another 1222 entity, it MUST NOT provide an authorization identity. As 1223 specified in [SASL], the initiating entity MUST NOT provide an 1224 authorization identity unless the authorization identity is 1225 different from the default authorization identity derived from 1226 the authentication identity as described in [SASL]. If 1227 provided, the value of the authorization identity MUST be of the 1228 form (i.e., a domain identifier only) for servers and 1229 of the form (i.e., node identifier and domain 1230 identifier) for clients. 1232 8. Upon successful SASL negotiation that involves negotiation of a 1233 security layer, the receiving entity MUST discard any knowledge 1234 obtained from the initiating entity which was not obtained from 1235 the SASL negotiation itself. 1237 9. Upon successful SASL negotiation that involves negotiation of a 1238 security layer, the initiating entity MUST discard any knowledge 1239 obtained from the receiving entity which was not obtained from 1240 the SASL negotiation itself. 1242 10. See Mandatory-to-Implement Technologies (Section 14.6) regarding 1243 mechanisms that MUST be supported. 1245 6.2 Narrative 1247 When an initiating entity authenticates with a receiving entity, the 1248 steps involved are as follows: 1250 1. The initiating entity requests SASL authentication by including 1251 the 'version' attribute in the opening XML stream header sent to 1252 the receiving entity, with the value set to "1.0". 1254 2. After sending an XML stream header in reply, the receiving entity 1255 sends a list of available SASL authentication mechanisms; each of 1256 these is a element included as a child within a 1257 container element qualified by the 1258 'urn:ietf:params:xml:ns:xmpp-sasl' namespace, which in turn is a 1259 child of a element in the streams namespace. If Use 1260 of TLS (Section 5) needs to be established before a particular 1261 authentication mechanism may be used, the receiving entity MUST 1262 NOT provide that mechanism in the list of available SASL 1263 authentication mechanisms prior to TLS negotiation. If the 1264 initiating entity presents a valid certificate during prior TLS 1265 negotiation, the receiving entity SHOULD offer the SASL EXTERNAL 1266 mechanism to the initiating entity during SASL negotiation (refer 1267 to [SASL]), although the EXTERNAL mechanism MAY be offered under 1268 other circumstances as well. 1270 3. The initiating entity selects a mechanism by sending an 1271 element qualified by the 'urn:ietf:params:xml:ns:xmpp-sasl' 1272 namespace to the receiving entity and including an appropriate 1273 value for the 'mechanism' attribute; this element MAY contain 1274 character data (in SASL terminology, the "initial response") if 1275 the mechanism supports or requires it. If the initiating entity 1276 selects the EXTERNAL mechanism for authentication and presented a 1277 certificate during prior TLS negotiation, the authentication 1278 credentials SHOULD be taken from that certificate. 1280 4. If necessary, the receiving entity challenges the initiating 1281 entity by sending a element qualified by the 1282 'urn:ietf:params:xml:ns:xmpp-sasl' namespace to the initiating 1283 entity; this element MAY contain character data (which MUST be 1284 computed in accordance with the definition of the SASL mechanism 1285 chosen by the initiating entity). 1287 5. The initiating entity responds to the challenge by sending a 1288 element qualified by the 1289 'urn:ietf:params:xml:ns:xmpp-sasl' namespace to the receiving 1290 entity; this element MAY contain character data (which MUST be 1291 computed in accordance with the definition of the SASL mechanism 1292 chosen by the initiating entity). 1294 6. If necessary, the receiving entity sends more challenges and the 1295 initiating entity sends more responses. 1297 This series of challenge/response pairs continues until one of three 1298 things happens: 1300 1. The initiating entity aborts the handshake by sending an 1301 element qualified by the 'urn:ietf:params:xml:ns:xmpp-sasl' 1302 namespace to the receiving entity. Upon receiving an 1303 element, the receiving entity SHOULD allow a configurable but 1304 reasonable number of retries (at least 2), after which it MUST 1305 terminate the TCP connection; this allows the initiating entity 1306 (e.g., an end-user client) to tolerate incorrectly-provided 1307 credentials (e.g., a mistyped password) without being forced to 1308 reconnect. 1310 2. The receiving entity reports failure of the handshake by sending 1311 a element qualified by the 1312 'urn:ietf:params:xml:ns:xmpp-sasl' namespace to the initiating 1313 entity (the particular cause of failure SHOULD be communicated in 1314 an appropriate child element of the element as defined 1315 under SASL Errors (Section 6.4)). If the failure case occurs, 1316 the receiving entity SHOULD allow a configurable but reasonable 1317 number of retries (at least 2), after which it MUST terminate the 1318 TCP connection; this allows the initiating entity (e.g., an 1319 end-user client) to tolerate incorrectly-provided credentials 1320 (e.g., a mistyped password) without being forced to reconnect. 1322 3. The receiving entity reports success of the handshake by sending 1323 a element qualified by the 1324 'urn:ietf:params:xml:ns:xmpp-sasl' namespace to the initiating 1325 entity; this element MAY contain character data (in SASL 1326 terminology, "additional data with success") if required by the 1327 chosen SASL mechanism. Upon receiving the element, 1328 the initiating entity MUST initiate a new stream by sending an 1329 opening XML stream header to the receiving entity (it is not 1330 necessary to send a closing tag first, since the 1331 receiving entity and initiating entity MUST consider the original 1332 stream to be closed upon sending or receiving the 1333 element). Upon receiving the new stream header from the 1334 initiating entity, the receiving entity MUST respond by sending a 1335 new XML stream header to the initiating entity, along with any 1336 available features (but NOT including the STARTTLS feature) or an 1337 empty element (to signify that no additional features 1338 are available); any such additional features not defined herein 1339 MUST be defined by the relevant extension to XMPP. 1341 6.3 SASL Definition 1343 The profiling requirements of [SASL] require that the following 1344 information be supplied by a protocol definition: 1346 service name: "xmpp" 1348 initiation sequence: After the initiating entity provides an opening 1349 XML stream header and the receiving entity replies in kind, the 1350 receiving entity provides a list of acceptable authentication 1351 methods. The initiating entity chooses one method from the list 1352 and sends it to the receiving entity as the value of the 1353 'mechanism' attribute possessed by an element, optionally 1354 including an initial response to avoid a round trip. 1356 exchange sequence: Challenges and responses are carried through the 1357 exchange of elements from receiving entity to 1358 initiating entity and elements from initiating entity 1359 to receiving entity. The receiving entity reports failure by 1360 sending a element and success by sending a 1361 element; the initiating entity aborts the exchange by sending an 1362 element. Upon successful negotiation, both sides 1363 consider the original XML stream to be closed and new stream 1364 headers are sent by both entities. 1366 security layer negotiation: The security layer takes effect 1367 immediately after sending the closing ">" character of the 1368 element for the receiving entity, and immediately after 1369 receiving the closing ">" character of the element for 1370 the initiating entity. The order of layers is first [TCP], then 1371 [TLS], then [SASL], then XMPP. 1373 use of the authorization identity: The authorization identity may be 1374 used by xmpp to denote the of a client or the 1375 sending of a server. 1377 6.4 SASL Errors 1379 The following SASL-related error conditions are defined: 1381 o -- The receiving entity acknowledges an 1382 element sent by the initiating entity; sent in reply to the 1383 element. 1385 o -- The data provided by the initiating 1386 entity could not be processed because the [BASE64] encoding is 1387 incorrect (e.g., because the encoding does not adhere to the the 1388 definition in Section 3 of [BASE64]); sent in reply to a 1389 element or an element with initial challenge 1390 data. 1392 o -- The authzid provided by the initiating 1393 entity is invalid, either because it is incorrectly formatted or 1394 because the initiating entity does not have permissions to 1395 authorize that ID; sent in reply to a element or an 1396 element with initial challenge data. 1398 o -- The initiating entity did not provide a 1399 mechanism or requested a mechanism that is not supported by the 1400 receiving entity; sent in reply to an element. 1402 o -- The mechanism requested by the initiating 1403 entity is weaker than server policy permits for that initiating 1404 entity; sent in reply to a element or an 1405 element with initial challenge data. 1407 o -- The authentication failed because the 1408 initiating entity did not provide valid credentials (this includes 1409 but is not limited to the case of an unknown username); sent in 1410 reply to a element or an element with initial 1411 challenge data. 1413 o -- The authentication failed because of 1414 a temporary error condition within the receiving entity; sent in 1415 reply to an element or element. 1417 6.5 Client-to-Server Example 1419 The following example shows the data flow for a client authenticating 1420 with a server using SASL, normally after successful TLS negotiation 1421 (note: the alternate steps shown below are provided to illustrate the 1422 protocol for failure cases; they are not exhaustive and would not 1423 necessarily be triggered by the data sent in the example). 1425 Step 1: Client initiates stream to server: 1427 1433 Step 2: Server responds with a stream tag sent to client: 1435 1442 Step 3: Server informs client of available authentication mechanisms: 1444 1445 1446 DIGEST-MD5 1447 PLAIN 1448 1449 1450 Step 4: Client selects an authentication mechanism: 1452 1455 Step 5: Server sends a [BASE64] encoded challenge to client: 1457 1458 cmVhbG09InNvbWVyZWFsbSIsbm9uY2U9Ik9BNk1HOXRFUUdtMmhoIixxb3A9ImF1dGgi 1459 LGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNzCg== 1460 1462 The decoded challenge is: 1464 realm="somerealm",nonce="OA6MG9tEQGm2hh",\ 1465 qop="auth",charset=utf-8,algorithm=md5-sess 1467 Step 5 (alt): Server returns error to client: 1469 1470 1471 1472 1474 Step 6: Client sends a [BASE64] encoded response to the challenge: 1476 1477 dXNlcm5hbWU9InNvbWVub2RlIixyZWFsbT0ic29tZXJlYWxtIixub25jZT0i 1478 T0E2TUc5dEVRR20yaGgiLGNub25jZT0iT0E2TUhYaDZWcVRyUmsiLG5jPTAw 1479 MDAwMDAxLHFvcD1hdXRoLGRpZ2VzdC11cmk9InhtcHAvZXhhbXBsZS5jb20i 1480 LHJlc3BvbnNlPWQzODhkYWQ5MGQ0YmJkNzYwYTE1MjMyMWYyMTQzYWY3LGNo 1481 YXJzZXQ9dXRmLTgK 1482 1484 The decoded response is: 1486 username="somenode",realm="somerealm",\ 1487 nonce="OA6MG9tEQGm2hh",cnonce="OA6MHXh6VqTrRk",\ 1488 nc=00000001,qop=auth,digest-uri="xmpp/example.com",\ 1489 response=d388dad90d4bbd760a152321f2143af7,charset=utf-8 1491 Step 7: Server sends another [BASE64] encoded challenge to client: 1493 1494 cnNwYXV0aD1lYTQwZjYwMzM1YzQyN2I1NTI3Yjg0ZGJhYmNkZmZmZAo= 1495 1497 The decoded challenge is: 1499 rspauth=ea40f60335c427b5527b84dbabcdfffd 1501 Step 7 (alt): Server returns error to client: 1503 1504 1505 1506 1508 Step 8: Client responds to the challenge: 1510 1512 Step 9: Server informs client of successful authentication: 1514 1516 Step 9 (alt): Server informs client of failed authentication: 1518 1519 1520 1521 1523 Step 10: Client initiates a new stream to server: 1525 1531 Step 11: Server responds by sending a stream header to client along 1532 with any additional features (or an empty features element): 1534 1540 1541 1542 1543 1545 6.6 Server-to-Server Example 1547 The following example shows the data flow for a server authenticating 1548 with another server using SASL, normally after successful TLS 1549 negotiation (note: the alternate steps shown below are provided to 1550 illustrate the protocol for failure cases; they are not exhaustive 1551 and would not necessarily be triggered by the data sent in the 1552 example). 1554 Step 1: Server1 initiates stream to Server2: 1556 1562 Step 2: Server2 responds with a stream tag sent to Server1: 1564 1571 Step 3: Server2 informs Server1 of available authentication 1572 mechanisms: 1574 1575 1576 DIGEST-MD5 1577 KERBEROS_V4 1578 1579 1581 Step 4: Server1 selects an authentication mechanism: 1583 1586 Step 5: Server2 sends a [BASE64] encoded challenge to Server1: 1588 1589 dXNlcm5hbWU9InNvbWVkb21haW4iLHJlYWxtPSJzb21lcmVhbG0iLG5vbmNl 1590 PSJPQTZNRzl0RVFHbTJoaCIscW9wPSJhdXRoIixjaGFyc2V0PXV0Zi04LGFs 1591 Z29yaXRobT1tZDUtc2Vzcwo= 1592 1593 The decoded challenge is: 1595 username="somedomain",realm="somerealm",\ 1596 nonce="OA6MG9tEQGm2hh",qop="auth",\ 1597 charset=utf-8,algorithm=md5-sess 1599 Step 5 (alt): Server2 returns error to Server1: 1601 1602 1603 1604 1606 Step 6: Server1 sends a [BASE64] encoded response to the challenge: 1608 1609 dXNlcm5hbWU9InNvbWVkb21haW4iLHJlYWxtPSJzb21lcmVhbG0iLG5vbmNl 1610 PSJPQTZNRzl0RVFHbTJoaCIsY25vbmNlPSJPQTZNSFhoNlZxVHJSayIsbmM9 1611 MDAwMDAwMDEscW9wPWF1dGgsZGlnZXN0LXVyaT0ieG1wcC9leGFtcGxlLmNv 1612 bSIscmVzcG9uc2U9ZDM4OGRhZDkwZDRiYmQ3NjBhMTUyMzIxZjIxNDNhZjcs 1613 Y2hhcnNldD11dGYtOAo= 1614 1616 The decoded response is: 1618 username="somedomain",realm="somerealm",\ 1619 nonce="OA6MG9tEQGm2hh",cnonce="OA6MHXh6VqTrRk",\ 1620 nc=00000001,qop=auth,digest-uri="xmpp/example.com",\ 1621 response=d388dad90d4bbd760a152321f2143af7,charset=utf-8 1623 Step 7: Server2 sends another [BASE64] encoded challenge to Server1: 1625 1626 cnNwYXV0aD1lYTQwZjYwMzM1YzQyN2I1NTI3Yjg0ZGJhYmNkZmZmZAo= 1627 1629 The decoded challenge is: 1631 rspauth=ea40f60335c427b5527b84dbabcdfffd 1633 Step 7 (alt): Server2 returns error to Server1: 1635 1636 1637 1638 1639 Step 8: Server1 responds to the challenge: 1641 1643 Step 8 (alt): Server1 aborts negotiation: 1645 1647 Step 9: Server2 informs Server1 of successful authentication: 1649 1651 Step 9 (alt): Server2 informs Server1 of failed authentication: 1653 1654 1655 1656 1658 Step 10: Server1 initiates a new stream to Server2: 1660 1666 Step 11: Server2 responds by sending a stream header to Server1 along 1667 with any additional features (or an empty features element): 1669 1675 1677 7. Resource Binding 1679 After SASL negotiation (Section 6) with the receiving entity, the 1680 initiating entity MAY want or need to bind a specific resource to 1681 that stream. In general this applies only to clients: in order to 1682 conform to the addressing format (Section 3) and stanza delivery 1683 rules (Section 10) specified herein, there MUST be a resource 1684 identifier associated with the of the client (which is 1685 either generated by the server or provided by the client 1686 application); this ensures that the address for use over that stream 1687 is a "full JID" of the form . 1689 Upon receiving a success indication within the SASL negotiation, the 1690 client MUST send a new stream header to the server, to which the 1691 server MUST respond with a stream header as well as a list of 1692 available stream features. Specifically, if the server requires the 1693 client to bind a resource to the stream after successful SASL 1694 negotiation, it MUST include an empty element qualified by 1695 the 'urn:ietf:params:xml:ns:xmpp-bind' namespace in the stream 1696 features list it presents to the client upon sending the header for 1697 the response stream sent after successful SASL negotiation (but not 1698 before): 1700 Server advertises resource binding feature to client: 1702 1708 1709 1710 1712 Upon being so informed that resource binding is required, the client 1713 MUST bind a resource to the stream by sending to the server an IQ 1714 stanza of type "set" (see IQ Semantics (Section 9.2.3)) containing 1715 data qualified by the 'urn:ietf:params:xml:ns:xmpp-bind' namespace. 1717 If the client wishes to allow the server to generate the resource 1718 identifier on its behalf, it sends an IQ stanza of type "set" that 1719 contains an empty element: 1721 Client asks server to bind a resource: 1723 1724 1725 1727 A server that supports resource binding MUST be able to generate a 1728 resource identifier on behalf of a client. A resource identifier 1729 generated by the server MUST be unique for that . 1731 If the client wishes to specify the resource identifier, it sends an 1732 IQ stanza of type "set" that contains the desired resource identifier 1733 as the CDATA of a element that is a child of the 1734 element: 1736 Client binds a resource: 1738 1739 1740 someresource 1741 1742 1744 Once the server has generated a resource identifier for the client or 1745 accepted the resource identifier provided by the client, it MUST 1746 return an IQ stanza of type "result" to the client, which MUST 1747 include a child element that specifies the full JID for the 1748 client as determined by the server: 1750 Server informs client of successful resource binding: 1752 1753 1754 somenode@somedomain/someresource 1755 1756 1758 A server is NOT REQUIRED to accept the resource identifier provided 1759 by the client, and MAY override it with a resource identifier that 1760 the server generates; in this case, the server SHOULD NOT return a 1761 stanza error (e.g., ) to the client but instead SHOULD 1762 communicate the generated resource identifier to the client in the IQ 1763 result as shown above. 1765 When a client supplies a resource identifier, the following stanza 1766 error conditions are possible (see Stanza Errors (Section 9.3)): 1768 o The provided resource identifier cannot be processed by the server 1769 in accordance with Resourceprep (Appendix B). 1771 o The client is not allowed to bind a resource to the stream (e.g., 1772 because the client has reached a limit on the number of bound 1773 resources allowed). 1775 o The provided resource identifier is already in use but the server 1776 does not allow binding of multiple resources with the same 1777 identifier. 1779 The protocol for these error conditions is shown below. 1781 Resource identifier cannot be processed: 1783 1784 1785 someresource 1786 1787 1788 1789 1790 1792 Client is not allowed to bind a resource: 1794 1795 1796 someresource 1797 1798 1799 1800 1801 1803 Resource identifier is in use: 1805 1806 1807 someresource 1808 1809 1810 1811 1812 1814 8. Server Dialback 1816 8.1 Overview 1818 The Jabber protocols from which XMPP was adapted include a "server 1819 dialback" method for protecting against domain spoofing, thus making 1820 it more difficult to spoof XML stanzas (see Server-to-Server 1821 Communications (Section 14.3) regarding this method's security 1822 characteristics). Server dialback also makes it easier to deploy 1823 systems in which outbound messages and inbound messages are handled 1824 by different machines for the same domain. The server dialback 1825 method is made possible by the existence of the Domain Name System 1826 (DNS), since one server can (normally) discover the authoritative 1827 server for a given domain. 1829 Because dialback depends on DNS, inter-domain communications MUST NOT 1830 proceed until the Domain Name System (DNS) hostnames asserted by the 1831 servers have been resolved (see Server-to-Server Communications 1832 (Section 14.3)). 1834 The method for generating and verifying the keys used in server 1835 dialback MUST take into account the hostnames being used, the random 1836 ID generated for the stream, and a secret known by the authoritative 1837 server's network. 1839 Any error that occurs during dialback negotiation MUST be considered 1840 a stream error, resulting in termination of the stream and of the 1841 underlying TCP connection. The possible error conditions are 1842 specified in the protocol description below. 1844 The following terminology applies: 1846 o Originating Server -- the server that is attempting to establish a 1847 connection between two domains. 1849 o Receiving Server -- the server that is trying to authenticate that 1850 Originating Server represents the domain which it claims to be. 1852 o Authoritative Server -- the server that answers to the DNS 1853 hostname asserted by Originating Server; for basic environments 1854 this will be Originating Server, but it could be a separate 1855 machine in Originating Server's network. 1857 8.2 Order of Events 1859 The following is a brief summary of the order of events in dialback: 1861 1. Originating Server establishes a connection to Receiving Server. 1863 2. Originating Server sends a 'key' value over the connection to 1864 Receiving Server. 1866 3. Receiving Server establishes a connection to Authoritative 1867 Server. 1869 4. Receiving Server sends the same 'key' value to Authoritative 1870 Server. 1872 5. Authoritative Server replies that key is valid or invalid. 1874 6. Receiving Server informs Originating Server whether it is 1875 authenticated or not. 1877 We can represent this flow of events graphically as follows: 1879 Originating Receiving 1880 Server Server 1881 ----------- --------- 1882 | | 1883 | establish connection | 1884 | ----------------------> | 1885 | | 1886 | send stream header | 1887 | ----------------------> | 1888 | | 1889 | send stream header | 1890 | <---------------------- | 1891 | | Authoritative 1892 | send dialback key | Server 1893 | ----------------------> | ------------- 1894 | | | 1895 | establish connection | 1896 | ----------------------> | 1897 | | 1898 | send stream header | 1899 | ----------------------> | 1900 | | 1901 | send stream header | 1902 | <---------------------- | 1903 | | 1904 | send verify request | 1905 | ----------------------> | 1906 | | 1907 | send verify response | 1908 | <---------------------- | 1909 | 1910 | report dialback result | 1911 | <---------------------- | 1912 | | 1914 8.3 Protocol 1916 The detailed protocol interaction between the servers is as follows: 1918 1. Originating Server establishes TCP connection to Receiving 1919 Server. 1921 2. Originating Server sends a stream header to Receiving Server: 1923 1928 Note: The 'to' and 'from' attributes are NOT REQUIRED on the 1929 root stream element. The inclusion of the xmlns:db namespace 1930 declaration with the name shown indicates to Receiving Server 1931 that Originating Server supports dialback. If the namespace 1932 name is incorrect, then Receiving Server MUST generate an 1933 stream error condition and terminate both 1934 the XML stream and the underlying TCP connection. 1936 3. Receiving Server SHOULD send a stream header back to Originating 1937 Server, including a unique ID for this interaction: 1939 1945 Note: The 'to' and 'from' attributes are NOT REQUIRED on the 1946 root stream element. If the namespace name is incorrect, then 1947 Originating Server MUST generate an stream 1948 error condition and terminate both the XML stream and the 1949 underlying TCP connection. Note well that Receiving Server is 1950 NOT REQUIRED to reply and MAY silently terminate the XML stream 1951 and underlying TCP connection depending on security policies in 1952 place; however, if Receiving Server desires to proceed, it MUST 1953 sent a stream header back to Originating Server. 1955 4. Originating Server sends a dialback key to Receiving Server: 1957 1960 98AF014EDC0... 1961 1963 Note: This key is not examined by Receiving Server, since 1964 Receiving Server does not keep information about Originating 1965 Server between sessions. The key generated by Originating 1966 Server MUST be based in part on the value of the ID provided by 1967 Receiving Server in the previous step, and in part on a secret 1968 shared by Originating Server and Authoritative Server. If the 1969 value of the 'to' address does not match a hostname recognized 1970 by Receiving Server, then Receiving Server MUST generate a 1971 stream error condition and terminate both the 1972 XML stream and the underlying TCP connection. If the value of 1973 the 'from' address matches a domain with which Receiving Server 1974 already has an established connection, then Receiving Server 1975 MUST maintain the existing connection until it validates whether 1976 the new connection is legitimate; additionally, Receiving Server 1977 MAY choose to generate a stream error 1978 condition for the new connection and then terminate both the XML 1979 stream and the underlying TCP connection related to the new 1980 request. 1982 5. Receiving Server establishes a TCP connection back to the domain 1983 name asserted by Originating Server, as a result of which it 1984 connects to Authoritative Server. (Note: As an optimization, an 1985 implementation MAY reuse an existing trusted connection here 1986 rather than opening a new TCP connection.) 1988 6. Receiving Server sends Authoritative Server a stream header: 1990 1995 Note: The 'to' and 'from' attributes are NOT REQUIRED on the 1996 root stream element. If the namespace name is incorrect, then 1997 Authoritative Server MUST generate an 1998 stream error condition and terminate both the XML stream and the 1999 underlying TCP connection. 2001 7. Authoritative Server sends Receiving Server a stream header: 2003 2009 Note: If the namespace name is incorrect, then Receiving Server 2010 MUST generate an stream error condition and 2011 terminate both the XML stream and the underlying TCP connection 2012 between it and Authoritative Server. If a stream error occurs 2013 between Receiving Server and Authoritative Server, then 2014 Receiving Server MUST generate a 2015 stream error condition and terminate both the XML stream and the 2016 underlying TCP connection between it and Originating Server. 2018 8. Receiving Server sends Authoritative Server a stanza requesting 2019 that Authoritative Server verify a key: 2021 2025 98AF014EDC0... 2026 2028 Note: Passed here are the hostnames, the original identifier 2029 from Receiving Server's stream header to Originating Server in 2030 Step 3, and the key that Originating Server sent to Receiving 2031 Server in Step 4. Based on this information as well as shared 2032 secret information within the Authoritative Server's network, 2033 the key is verified. Any verifiable method MAY be used to 2034 generate the key. If the value of the 'to' address does not 2035 match a hostname recognized by Authoritative Server, then 2036 Authoritative Server MUST generate a stream 2037 error condition and terminate both the XML stream and the 2038 underlying TCP connection. If the value of the 'from' address 2039 does not match the hostname represented by Receiving Server when 2040 opening the TCP connection (or any validated domain), then 2041 Authoritative Server MUST generate an stream 2042 error condition and terminate both the XML stream and the 2043 underlying TCP connection. 2045 9. Authoritative Server sends a stanza back to Receiving Server 2046 verifying whether the key was valid or invalid: 2048 2054 or 2056 2062 Note: If the ID does not match that provided by Receiving Server 2063 in Step 3, then Receiving Server MUST generate an 2064 stream error condition and terminate both the XML stream and the 2065 underlying TCP connection. If the value of the 'to' address 2066 does not match a hostname recognized by Receiving Server, then 2067 Receiving Server MUST generate a stream error 2068 condition and terminate both the XML stream and the underlying 2069 TCP connection. If the value of the 'from' address does not 2070 match the hostname represented by Originating Server when 2071 opening the TCP connection (or any validated domain), then 2072 Receiving Server MUST generate an stream error 2073 condition and terminate both the XML stream and the underlying 2074 TCP connection. After returning the verification to Receiving 2075 Server, Authoritative Server SHOULD terminate the stream between 2076 them. 2078 10. Receiving Server informs Originating Server of the result: 2080 2085 Note: At this point the connection has either been validated via 2086 a type='valid', or reported as invalid. If the connection is 2087 invalid, then Receiving Server MUST terminate both the XML 2088 stream and the underlying TCP connection. If the connection is 2089 validated, data can be sent by Originating Server and read by 2090 Receiving Server; before that, all data stanzas sent to 2091 Receiving Server SHOULD be silently dropped. 2093 Even if dialback negotiation is successful, a server MUST verify that 2094 all XML stanzas received from the other server include a 'from' 2095 attribute and a 'to' attribute; if a stanza does not meet this 2096 restriction, the server that receives the stanza MUST generate an 2097 stream error condition and terminate both the 2098 XML stream and the underlying TCP connection. Furthermore, a server 2099 MUST verify that the 'from' attribute of stanzas received from the 2100 other server includes a validated domain for the stream; if a stanza 2101 does not meet this restriction, the server that receives the stanza 2102 MUST generate an stream error condition and terminate 2103 both the XML stream and the underlying TCP connection. Both of these 2104 checks help to prevent spoofing related to particular stanzas. 2106 9. XML Stanzas 2108 After TLS negotiation (Section 5) if desired, SASL negotiation 2109 (Section 6), and Resource Binding (Section 7) if necessary, XML 2110 stanzas can be sent over the streams. Three kinds of XML stanza are 2111 defined for the 'jabber:client' and 'jabber:server' namespaces: 2112 , , and . In addition, there are five 2113 common attributes for these kinds of stanza. These common 2114 attributes, as well as the basic semantics of the three stanza kinds, 2115 are defined herein; more detailed information regarding the syntax of 2116 XML stanzas in relation to instant messaging and presence 2117 applications is provided in [XMPP-IM]. 2119 9.1 Common Attributes 2121 The following five attributes are common to message, presence, and IQ 2122 stanzas: 2124 9.1.1 to 2126 The 'to' attribute specifies the JID of the intended recipient for 2127 the stanza. 2129 In the 'jabber:client' namespace, a stanza SHOULD possess a 'to' 2130 attribute, although a stanza sent from a client to a server for 2131 handling by that server (e.g., presence sent to the server for 2132 broadcasting to other entities) SHOULD NOT possess a 'to' attribute. 2134 In the 'jabber:server' namespace, a stanza MUST possess a 'to' 2135 attribute; if a server receives a stanza that does not meet this 2136 restriction, it MUST generate an stream error 2137 condition and terminate both the XML stream and the underlying TCP 2138 connection with the offending server. 2140 If the value of the 'to' attribute is invalid or cannot be contacted, 2141 the entity discovering that fact (usually the sender's or recipient's 2142 server) MUST return an appropriate error to the sender, setting the 2143 'from' attribute of the error stanza to the value provided in the 2144 'to' attribute of the offending stanza. 2146 9.1.2 from 2148 The 'from' attribute specifies the JID of the sender. 2150 When a server receives an XML stanza within the context of an 2151 authenticated stream qualified by the 'jabber:client' namespace, it 2152 MUST do one of the following: 2154 1. validate that the value of the 'from' attribute provided by the 2155 client is that of an authorized resource for the associated 2156 entity 2158 2. add a 'from' address to the stanza whose value is the full JID 2159 () determined by the server for the 2160 connected resource that generated the stanza (see Determination 2161 of Addresses (Section 3.5)) 2163 If a client attempts to send an XML stanza for which the value of the 2164 'from' attribute does not match one of the connected resources for 2165 that entity, the server SHOULD return an stream error 2166 to the client. If a client attempts to send an XML stanza over a 2167 stream that is not yet authenticated, the server SHOULD return a 2168 stream error to the client. If generated, both of 2169 these conditions MUST result in closing of the stream and termination 2170 of the underlying TCP connection; this helps to prevent a denial of 2171 service attack launched from a rogue client. 2173 In the 'jabber:server' namespace, a stanza MUST possess a 'from' 2174 attribute; if a server receives a stanza that does not meet this 2175 restriction, it MUST generate an stream error 2176 condition. Furthermore, the domain identifier portion of the JID 2177 contained in the 'from' attribute MUST match the hostname (or any 2178 validated domain) of the sending server as communicated in the SASL 2179 negotiation or dialback negotiation; if a server receives a stanza 2180 that does not meet this restriction, it MUST generate an 2181 stream error condition. Both of these conditions 2182 MUST result in closing of the stream and termination of the 2183 underlying TCP connection; this helps to prevent a denial of service 2184 attack launched from a rogue server. 2186 9.1.3 id 2188 The optional 'id' attribute MAY be used by a sending entity for 2189 internal tracking of stanzas that it sends and receives (especially 2190 for tracking the request-response interaction inherent in the 2191 semantics of IQ stanzas). The value of the 'id' attribute is NOT 2192 REQUIRED to be unique either globally, within a domain, or within a 2193 stream. The semantics of IQ stanzas impose additional restrictions; 2194 see IQ Semantics (Section 9.2.3). 2196 9.1.4 type 2198 The 'type' attribute specifies detailed information about the purpose 2199 or context of the message, presence, or IQ stanza. The particular 2200 allowable values for the 'type' attribute vary depending on whether 2201 the stanza is a message, presence, or IQ; the values for message and 2202 presence stanzas are specific to instant messaging and presence 2203 applications and therefore are defined in [XMPP-IM], whereas the 2204 values for IQ stanzas specify the role of an IQ stanza in a 2205 structured request-response "conversation" and thus are defined under 2206 IQ Semantics (Section 9.2.3) below. The only 'type' value common to 2207 all three stanzas is "error", for which see Stanza Errors (Section 2208 9.3). 2210 9.1.5 xml:lang 2212 A stanza SHOULD possess an 'xml:lang' attribute (as defined in 2213 Section 2.12 of [XML]) if the stanza contains XML character data that 2214 is intended to be presented to a human user (as explained in RFC 2277 2215 [CHARSET], "internationalization is for humans"). The value of the 2216 'xml:lang' attribute specifies the default language of any such 2217 human-readable XML character data, which MAY be overridden by the 2218 'xml:lang' attribute of a specific child element. If a stanza does 2219 not possess an 'xml:lang' attribute, an implementation MUST assume 2220 that the default language is that specified for the stream as defined 2221 under Stream Attributes (Section 4.2) above. The value of the 2222 'xml:lang' attribute MUST be an NMTOKEN and MUST conform to the 2223 format defined in RFC 3066 [LANGTAGS]. 2225 9.2 Basic Semantics 2227 9.2.1 Message Semantics 2229 The stanza kind can be seen as a "push" mechanism whereby 2230 one entity pushes information to another entity, similar to the 2231 communications that occur in a system such as email. All message 2232 stanzas SHOULD possess a 'to' attribute that specifies the intended 2233 recipient of the message; upon receiving such a stanza, a server 2234 SHOULD route or deliver it to the intended recipient (see Server 2235 Rules for Handling XML Stanzas (Section 10) for general routing and 2236 delivery rules related to XML stanzas). 2238 9.2.2 Presence Semantics 2240 The element can be seen as a basic broadcast or 2241 "publish-subscribe" mechanism, whereby multiple entities receive 2242 information (in this case, presence information) about an entity to 2243 which they have subscribed. In general, a publishing entity SHOULD 2244 send a presence stanza with no 'to' attribute, in which case the 2245 server to which the entity is connected SHOULD broadcast or multiplex 2246 that stanza to all subscribing entities. However, a publishing 2247 entity MAY also send a presence stanza with a 'to' attribute, in 2248 which case the server SHOULD route or deliver that stanza to the 2249 intended recipient. See Server Rules for Handling XML Stanzas 2250 (Section 10) for general routing and delivery rules related to XML 2251 stanzas, and [XMPP-IM] for presence-specific rules in the context of 2252 an instant messaging and presence application. 2254 9.2.3 IQ Semantics 2256 Info/Query, or IQ, is a request-response mechanism, similar in some 2257 ways to [HTTP]. The semantics of IQ enable an entity to make a 2258 request of, and receive a response from, another entity. The data 2259 content of the request and response is defined by the namespace 2260 declaration of a direct child element of the IQ element, and the 2261 interaction is tracked by the requesting entity through use of the 2262 'id' attribute. Thus IQ interactions follow a common pattern of 2263 structured data exchange such as get/result or set/result (although 2264 an error may be returned in reply to a request if appropriate): 2266 Requesting Responding 2267 Entity Entity 2268 ---------- ---------- 2269 | | 2270 | | 2271 | ------------------------> | 2272 | | 2273 | | 2274 | <------------------------ | 2275 | | 2276 | | 2277 | ------------------------> | 2278 | | 2279 | | 2280 | <------------------------ | 2281 | | 2283 In order to enforce these semantics, the following rules apply: 2285 1. The 'id' attribute is REQUIRED for IQ stanzas. 2287 2. The 'type' attribute is REQUIRED for IQ stanzas. The value MUST 2288 be one of the following: 2290 3. 2292 * get -- The stanza is a request for information or 2293 requirements. 2295 * set -- The stanza provides required data, sets new values, or 2296 replaces existing values. 2298 * result -- The stanza is a response to a successful get or set 2299 request. 2301 * error -- An error has occurred regarding processing or 2302 delivery of a previously-sent get or set (see Stanza Errors 2303 (Section 9.3)). 2305 4. An entity that receives an IQ request of type "get" or "set" MUST 2306 reply with an IQ response of type "result" or "error" (which 2307 response MUST preserve the 'id' attribute of the request). 2309 5. An entity that receives a stanza of type "result" or "error" MUST 2310 NOT respond to the stanza by sending a further IQ response of 2311 type "result" or "error"; however, as shown above, the requesting 2312 entity MAY send another request (e.g., an IQ of type "set" in 2313 order to provide required information discovered through a get/ 2314 result pair). 2316 6. An IQ stanza of type "get" or "set" MUST contain one and only one 2317 child element (properly-namespaced as defined in [XMPP-IM]) that 2318 specifies the semantics of the particular request or response. 2320 7. An IQ stanza of type "result" MUST include zero or one child 2321 elements. 2323 8. An IQ stanza of type "error" SHOULD include the child element 2324 contained in the associated "get" or "set" and MUST include an 2325 child; for details, see Stanza Errors (Section 9.3). 2327 9.3 Stanza Errors 2329 Stanza-related errors are handled in a manner similar to stream 2330 errors (Section 4.6). However, stanza errors are not unrecoverable, 2331 as stream errors are; therefore error stanzas include hints regarding 2332 actions that the original sender can take in order to remedy the 2333 error. 2335 9.3.1 Rules 2337 The following rules apply to stanza-related errors: 2339 o The receiving or processing entity that detects an error condition 2340 in relation to a stanza MUST return to the sending entity a stanza 2341 of the same kind (message, presence, or IQ) whose 'type' attribute 2342 is set to a value of "error" (such a stanza is called an "error 2343 stanza" herein). 2345 o The entity that generates an error stanza SHOULD (but is NOT 2346 REQUIRED to) include the original XML sent so that the sender can 2347 inspect and if necessary correct the XML before attempting to 2348 resend. 2350 o An error stanza MUST contain an child element. 2352 o An child MUST NOT be included if the 'type' attribute has 2353 a value other than "error" (or if there is no 'type' attribute). 2355 o An entity that receives an error stanza MUST NOT respond to the 2356 stanza with a further error stanza; this helps to prevent looping. 2358 9.3.2 Syntax 2360 The syntax for stanza-related errors is as follows: 2362 2363 [RECOMMENDED to include sender XML here] 2364 2365 2366 2367 OPTIONAL descriptive text 2368 2369 [OPTIONAL application-specific condition element] 2370 2371 2373 The stanza-name is one of message, presence, or iq. 2375 The value of the element's 'type' attribute MUST be one of 2376 the following: 2378 o cancel -- do not retry (the error is unrecoverable) 2380 o continue -- proceed (the condition was only a warning) 2382 o modify -- retry after changing the data sent 2384 o auth -- retry after providing credentials 2386 o wait -- retry after waiting (the error is temporary) 2388 The element: 2390 o MUST contain a child element corresponding to one of the defined 2391 stanza error conditions specified below; this element MUST be 2392 qualified by the 'urn:ietf:params:xml:ns:xmpp-stanzas' namespace. 2394 o MAY contain a child containing CDATA that describes the 2395 error in more detail; this element MUST be qualified by the 2396 'urn:ietf:params:xml:ns:xmpp-stanzas' namespace and SHOULD possess 2397 an 'xml:lang' attribute. 2399 o MAY contain a child element for an application-specific error 2400 condition; this element MUST be qualified by an 2401 application-defined namespace, and its structure is defined by 2402 that namespace. 2404 The element is OPTIONAL. If included, it SHOULD be used only 2405 to provide descriptive or diagnostic information that supplements the 2406 meaning of a defined condition or application-specific condition. It 2407 SHOULD NOT be interpreted programmatically by an application. It 2408 SHOULD NOT be used as the error message presented to a user, but MAY 2409 be shown in addition to the error message associated with the 2410 included condition element (or elements). 2412 Finally, to maintain backward compatibility, the schema (specified in 2413 [XMPP-IM]) allows the optional inclusion of a 'code' attribute on the 2414 -- the sender has sent XML that is malformed or 2422 that cannot be processed (e.g., an IQ stanza that includes an 2423 unrecognized value of the 'type' attribute); the associated error 2424 type SHOULD be "modify". 2426 o -- access cannot be granted because an existing 2427 resource or session exists with the same name or address; the 2428 associated error type SHOULD be "cancel". 2430 o -- the feature requested is not 2431 implemented by the recipient or server and therefore cannot be 2432 processed; the associated error type SHOULD be "cancel". 2434 o -- the requesting entity does not possess the 2435 required permissions to perform the action; the associated error 2436 type SHOULD be "auth". 2438 o -- the recipient or server can no longer be contacted at 2439 this address (the error stanza MAY contain a new address in the 2440 CDATA of the element); the associated error type SHOULD be 2441 "modify". 2443 o -- the server could not process the 2444 stanza because of a misconfiguration or an otherwise-undefined 2445 internal server error; the associated error type SHOULD be "wait". 2447 o -- the addressed JID or item requested cannot be 2448 found; the associated error type SHOULD be "cancel". 2450 o -- the value of the 'to' attribute in the 2451 sender's stanza does not adhere to the syntax defined in 2452 Addressing Scheme (Section 3); the associated error type SHOULD be 2453 "modify". 2455 o -- the recipient or server understands the 2456 request but is refusing to process it because it does not meet 2457 criteria defined by the recipient or server (e.g., a local policy 2458 regarding acceptable words in messages); the associated error type 2459 SHOULD be "cancel". 2461 o -- the recipient or server does not allow any 2462 entity to perform the action; the associated error type SHOULD be 2463 "cancel". 2465 o -- the requesting entity is not authorized to 2466 access the requested service because payment is required; the 2467 associated error type SHOULD be "auth". 2469 o -- the intended recipient is temporarily 2470 unavailable; the associated error type SHOULD be "wait" (note: an 2471 application MUST NOT return this error if doing so would provide 2472 information about the intended recipient's network availability to 2473 an entity that is not authorized to know such information). 2475 o -- the recipient or server is redirecting requests for 2476 this information to another entity, usually temporarily (the error 2477 stanza MAY contain a new address in the CDATA of the 2478 element); the associated error type SHOULD be "modify". 2480 o -- the requesting entity is not 2481 authorized to access the requested service because registration is 2482 required; the associated error type SHOULD be "auth". 2484 o -- a remote server or service specified 2485 as part or all of the JID of the intended recipient does not 2486 exist; the associated error type SHOULD be "cancel". 2488 o -- a remote server or service specified 2489 as part or all of the JID of the intended recipient could not be 2490 contacted within a reasonable amount of time; the associated error 2491 type SHOULD be "wait". 2493 o -- the server or recipient lacks the system 2494 resources necessary to service the request; the associated error 2495 type SHOULD be "wait". 2497 o -- the server or recipient does not 2498 currently provide the requested service; the associated error type 2499 SHOULD be "cancel". 2501 o -- the requesting entity is not 2502 authorized to access the requested service because a subscription 2503 is required; the associated error type SHOULD be "auth". 2505 o -- the error condition is not one of those 2506 defined by the other conditions in this list; any error type may 2507 be associated with this condition, and it SHOULD be used only in 2508 conjunction with an application-specific condition. 2510 o -- the recipient or server understood the 2511 request but was not expecting it at this time (e.g., the request 2512 was out of order); the associated error type SHOULD be "wait". 2514 9.3.4 Application-Specific Conditions 2516 As noted, an application MAY provide application-specific stanza 2517 error information by including a properly-namespaced child in the 2518 error element. The application-specific element SHOULD supplement or 2519 further qualify a defined element. Thus the element will 2520 contain two or three child elements: 2522 2523 2524 2525 2526 2527 2529 2530 2531 2533 2535 Some special application diagnostic information... 2536 2537 2538 2539 2541 10. Server Rules for Handling XML Stanzas 2543 Compliant server implementations MUST ensure in-order processing of 2544 XML stanzas between any two entities. 2546 Beyond the requirement for in-order processing, each server 2547 implementation will contain its own "delivery tree" for handling 2548 stanzas it receives. Such a tree determines whether a stanza needs 2549 to be routed to another domain, processed internally, or delivered to 2550 a resource associated with a connected node. The following rules 2551 apply: 2553 10.1 No 'to' Address 2555 If the stanza possesses no 'to' attribute, the server SHOULD process 2556 it on behalf of the entity that sent it. Because all stanzas 2557 received from other servers MUST possess a 'to' attribute, this rule 2558 applies only to stanzas received from a registered entity (such as a 2559 client) that is connected to the server. If the server receives a 2560 presence stanza with no 'to' attribute, the server SHOULD broadcast 2561 it to the entities that are subscribed to the sending entity's 2562 presence, if applicable (the semantics of presence broadcast for 2563 instant messaging and presence applications are defined in 2564 [XMPP-IM]). If the server receives an IQ stanza of type "get" or 2565 "set" with no 'to' attribute and it understands the namespace that 2566 qualifies the content of the stanza, it MUST either process the 2567 stanza on behalf of sending entity (where the meaning of "process" is 2568 determined by the semantics of the qualifying namespace) or return an 2569 error to the sending entity. 2571 10.2 Foreign Domain 2573 If the hostname of the domain identifier portion of the JID contained 2574 in the 'to' attribute does not match one of the configured hostnames 2575 of the server itself or a subdomain thereof, the server SHOULD route 2576 the stanza to the foreign domain (subject to local service 2577 provisioning and security policies regarding inter-domain 2578 communication). There are two possible cases: 2580 A server-to-server stream already exists between the two domains: The 2581 sender's server routes the stanza to the authoritative server for 2582 the foreign domain over the existing stream 2584 There exists no server-to-server stream between the two domains: The 2585 sender's server (1) resolves the hostname of the foreign domain 2586 (as defined under Server-to-Server Communications (Section 14.3)), 2587 (2) negotiates a server-to-server stream between the two domains 2588 (as defined under Use of TLS (Section 5) and Use of SASL (Section 2589 6)), and (3) routes the stanza to the authoritative server for the 2590 foreign domain over the newly-established stream 2592 If routing to the recipient's server is unsuccessful, the sender's 2593 server MUST return an error to the sender; if the recipient's server 2594 can be contacted but delivery by the recipient's server to the 2595 recipient is unsuccessful, the recipient's server MUST return an 2596 error to the sender by way of the sender's server. 2598 10.3 Subdomain 2600 If the hostname of the domain identifier portion of the JID contained 2601 in the 'to' attribute matches a subdomain of one of the configured 2602 hostnames of the server itself, the server MUST either process the 2603 stanza itself or route the stanza to a specialized service that is 2604 responsible for that subdomain (if the subdomain is configured), or 2605 return an error to the sender (if the subdomain is not configured). 2607 10.4 Mere Domain or Specific Resource 2609 If the hostname of the domain identifier portion of the JID contained 2610 in the 'to' attribute matches a configured hostname of the server 2611 itself and the JID contained in the 'to' attribute is of the form 2612 or , the server (or a defined resource 2613 thereof) MUST either process the stanza as appropriate for the stanza 2614 kind or return an error stanza to the sender. 2616 10.5 Node in Same Domain 2618 If the hostname of the domain identifier portion of the JID contained 2619 in the 'to' attribute matches a configured hostname of the server 2620 itself and the JID contained in the 'to' attribute is of the form 2621 or , the server SHOULD deliver 2622 the stanza to the intended recipient of the stanza as represented by 2623 the JID contained in the 'to' attribute. The following rules apply: 2625 1. If the JID contains a resource identifier (i.e., is of the form 2626 ) and there is an available resource that 2627 matches the full JID, the recipient's server SHOULD deliver the 2628 stanza to the stream or session that exactly matches the resource 2629 identifier. 2631 2. If the JID contains a resource identifier and there is no 2632 available resource that matches the full JID, the recipient's 2633 server SHOULD return to the sender a 2634 stanza error. 2636 3. If the JID is of the form and there is at least one 2637 available resource available for the node, the recipient's server 2638 MUST deliver the stanza to at least one of the available 2639 resources, according to application-specific rules (a set of 2640 delivery rules for instant messaging and presence applications is 2641 defined in [XMPP-IM]). 2643 11. XML Usage within XMPP 2645 11.1 Restrictions 2647 XMPP is a simplified and specialized protocol for streaming XML 2648 elements in order to exchange structured information in close to real 2649 time. Because XMPP does not require the parsing of arbitrary and 2650 complete XML documents, there is no requirement that XMPP needs to 2651 support the full feature set of [XML]. In particular, the following 2652 restrictions apply. 2654 With regard to XML generation, an XMPP implementation MUST NOT inject 2655 into an XML stream any of the following: 2657 o comments (as defined in Section 2.5 of [XML]) 2659 o processing instructions (Section 2.6 therein) 2661 o internal or external DTD subsets (Section 2.8 therein) 2663 o internal or external entity references (Section 4.2 therein) with 2664 the exception of predefined entities (Section 4.6 therein) 2666 o character data or attribute values containing unescaped characters 2667 that map to the predefined entities (Section 4.6 therein); such 2668 characters MUST be escaped 2670 With regard to XML processing, if an XMPP implementation receives 2671 such restricted XML data, it MUST ignore the data. 2673 11.2 XML Namespace Names and Prefixes 2675 XML Namespaces [XML-NAMES] are used within all XMPP-compliant XML to 2676 create strict boundaries of data ownership. The basic function of 2677 namespaces is to separate different vocabularies of XML elements that 2678 are structurally mixed together. Ensuring that XMPP-compliant XML is 2679 namespace-aware enables any allowable XML to be structurally mixed 2680 with any data element within XMPP. Rules for XML namespace names and 2681 prefixes are defined in the following subsections. 2683 11.2.1 Streams Namespace 2685 A streams namespace declaration is REQUIRED in all XML stream 2686 headers. The name of the streams namespace MUST be 'http:// 2687 etherx.jabber.org/streams'. The element names of the 2688 element and its and children MUST be qualified 2689 by the streams namespace prefix in all instances. An implementation 2690 SHOULD generate only the 'stream:' prefix for these elements, and for 2691 historical reasons MAY accept only the 'stream:' prefix. 2693 11.2.2 Default Namespace 2695 A default namespace declaration is REQUIRED and is used in all XML 2696 streams in order to define the allowable first-level children of the 2697 root stream element. This namespace declaration MUST be the same for 2698 the initial stream and the response stream so that both streams are 2699 qualified consistently. The default namespace declaration applies to 2700 the stream and all stanzas sent within a stream (unless explicitly 2701 qualified by another namespace, or by the prefix of the streams 2702 namespace or the dialback namespace). 2704 A server implementation MUST support the following two default 2705 namespaces (for historical reasons, some implementations MAY support 2706 only these two default namespaces): 2708 o jabber:client -- this default namespace is declared when the 2709 stream is used for communications between a client and a server 2711 o jabber:server -- this default namespace is declared when the 2712 stream is used for communications between two servers 2714 A client implementation MUST support the 'jabber:client' default 2715 namespace, and for historical reasons MAY support only that default 2716 namespace. 2718 An implementation MUST NOT generate namespace prefixes for elements 2719 in the default namespace if the default namespace is 'jabber:client' 2720 or 'jabber:server'. An implementation SHOULD NOT generate namespace 2721 prefixes for elements qualified by content (as opposed to stream) 2722 namespaces other than 'jabber:client' and 'jabber:server'. 2724 Note: The 'jabber:client' and 'jabber:server' namespaces are nearly 2725 identical but are used in different contexts (client-to-server 2726 communications for 'jabber:client' and server-to-server 2727 communications for 'jabber:server'). The only difference between the 2728 two is that the 'to' and 'from' attributes are OPTIONAL on stanzas 2729 sent within 'jabber:client', whereas they are REQUIRED on stanzas 2730 sent within 'jabber:server'. If a compliant implementation accepts a 2731 stream that is qualified by the 'jabber:client' or 'jabber:server' 2732 namespace, it MUST support the common attributes (Section 9.1) and 2733 basic semantics (Section 9.2) of all three core stanza kinds 2734 (message, presence, and IQ). 2736 11.2.3 Dialback Namespace 2738 A dialback namespace declaration is REQUIRED for all elements used in 2739 server dialback (Section 8). The name of the dialback namespace MUST 2740 be 'jabber:server:dialback'. All elements qualified by this 2741 namespace MUST be prefixed. An implementation SHOULD generate only 2742 the 'db:' prefix for such elements and MAY accept only the 'db:' 2743 prefix. 2745 11.3 Validation 2747 Except as noted with regard to 'to' and 'from' addresses for stanzas 2748 within the 'jabber:server' namespace, a server is not responsible for 2749 validating the XML elements forwarded to a client or another server; 2750 an implementation MAY choose to provide only validated data elements 2751 but is NOT REQUIRED to do so (although an implementation MUST NOT 2752 accept XML that is not well-formed). Clients SHOULD NOT rely on the 2753 ability to send data which does not conform to the schemas, and 2754 SHOULD ignore any non-conformant elements or attributes on the 2755 incoming XML stream. Validation of XML streams and stanzas is NOT 2756 REQUIRED or recommended, and schemas are included herein for 2757 descriptive purposes only. 2759 11.4 Inclusion of Text Declaration 2761 Implementations SHOULD send a text declaration before sending a 2762 stream header. Applications MUST follow the rules in [XML] regarding 2763 the circumstances under which a text declaration is included. 2765 11.5 Character Encoding 2767 Implementations MUST support the UTF-8 (RFC 2279 [UTF-8]) 2768 transformation of Universal Character Set (ISO/IEC 10646-1 [UCS2]) 2769 characters, as required by RFC 2277 [CHARSET]. Implementations MUST 2770 NOT attempt to use any other encoding. 2772 12. Core Compliance Requirements 2774 This section summarizes the specific aspects of the Extensible 2775 Messaging and Presence Protocol that MUST be supported by servers and 2776 clients in order to be considered compliant implementations, as well 2777 as additional protocol aspects that SHOULD be supported. For 2778 compliance purposes, we draw a distinction between core protocols 2779 (which MUST be supported by any server or client, regardless of the 2780 specific application) and instant messaging protocols (which MUST be 2781 supported only by instant messaging and presence applications built 2782 on top of the core protocols). Compliance requirements that apply to 2783 all servers and clients are specified in this section; compliance 2784 requirements for instant messaging servers and clients are specified 2785 in the corresponding section of [XMPP-IM]. 2787 12.1 Servers 2789 In addition to all defined requirements with regard to security, XML 2790 usage, and internationalization, a server MUST support the following 2791 core protocols in order to be considered compliant: 2793 o Application of the [NAMEPREP], Nodeprep (Appendix A), and 2794 Resourceprep (Appendix B) profiles of [STRINGPREP] to addresses 2795 (including ensuring that domain identifiers are internationalized 2796 domain names as defined in [IDNA]) 2798 o XML streams (Section 4), including Use of TLS (Section 5), Use of 2799 SASL (Section 6), and Resource Binding (Section 7) 2801 o The basic semantics of the three defined stanza kinds (i.e., 2802 , , and ) as specified in stanza 2803 semantics (Section 9.2) 2805 o Generation (and, where appropriate, handling) of error syntax and 2806 semantics related to streams, TLS, SASL, and XML stanzas 2808 In addition, a server SHOULD support the following core protocol: 2810 o Server dialback (Section 8) 2812 12.2 Clients 2814 A client MUST support the following core protocols in order to be 2815 considered compliant: 2817 o XML streams (Section 4), including Use of TLS (Section 5), Use of 2818 SASL (Section 6), and Resource Binding (Section 7) 2820 o The basic semantics of the three defined stanza kinds (i.e., 2821 , , and ) as specified in stanza 2822 semantics (Section 9.2) 2824 o Handling (and, where appropriate, generation) of error syntax and 2825 semantics related to streams, TLS, SASL, and XML stanzas 2827 In addition, a client SHOULD support the following core protocols: 2829 o Generation of addresses to which the [NAMEPREP], Nodeprep 2830 (Appendix A), and Resourceprep (Appendix B) profiles of 2831 [STRINGPREP] can be applied without failing 2833 13. Internationalization Considerations 2835 XML streams MUST be encoded in UTF-8 as specified under Character 2836 Encoding (Section 11.5). As specified under Stream Attributes 2837 (Section 4.2), an XML stream SHOULD include an 'xml:lang' attribute 2838 that is treated as the default language for any XML character data 2839 sent over the stream that is intended to be presented to a human 2840 user. As specified under xml:lang (Section 9.1.5), an XML stanza 2841 SHOULD include an 'xml:lang' attribute if the stanza contains XML 2842 character data that is intended to be presented to a human user. A 2843 server SHOULD apply the default 'xml:lang' attribute to stanzas it 2844 routes or delivers on behalf of connected entities, and MUST NOT 2845 modify or delete 'xml:lang' attributes from stanzas it receives from 2846 other entities. 2848 14. Security Considerations 2850 14.1 High Security 2852 For the purposes of XMPP communications (client-to-server and 2853 server-to-server), the term "high security" refers to the use of 2854 security technologies that provide both mutual authentication and 2855 integrity-checking; in particular, when using certificate-based 2856 authentication to provide high security, a chain-of-trust SHOULD be 2857 established out-of-band, although a shared certificate authority 2858 signing certificates could allow a previously unknown certificate to 2859 establish trust in-band. 2861 Standalone, self-signed service certificates SHOULD NOT be used; 2862 rather, an entity that wishes to generate a self-signed service 2863 certificate SHOULD first generate a self-signed Root CA certificate 2864 and then generate a signed service certificate. Entities that 2865 communicate with the service SHOULD be configured with the Root CA 2866 certificate rather than the service certificate; this avoids problems 2867 associated with simple comparison of service certificates. If a 2868 self-signed service certificate is used, an entity SHOULD NOT trust 2869 it if it is changed to another self-signed certificate or a 2870 certificate signed by an unrecognized authority. 2872 Implementations MUST support high security. Service provisioning 2873 SHOULD use high security, subject to local security policies. 2875 14.2 Client-to-Server Communications 2877 A compliant implementation MUST support both TLS and SASL for 2878 connections to a server. 2880 The TLS protocol for encrypting XML streams (defined under Use of TLS 2881 (Section 5)) provides a reliable mechanism for helping to ensure the 2882 confidentiality and data integrity of data exchanged between two 2883 entities. 2885 The SASL protocol for authenticating XML streams (defined under Use 2886 of SASL (Section 6)) provides a reliable mechanism for validating 2887 that a client connecting to a server is who it claims to be. 2889 Client-to-server communications MUST NOT proceed until the DNS 2890 hostname asserted by the server has been resolved. Such resolutions 2891 SHOULD first attempt to resolve the hostname using an [SRV] Service 2892 of "xmpp-client" and Proto of "tcp", resulting in resource records 2893 such as "_xmpp-client._tcp.example.com." (the use of the string 2894 "xmpp-client" for the service identifier is consistent with the IANA 2895 registration). If the SRV lookup fails, the fallback is a normal 2896 IPv4/IPv6 address record resolution to determine the IP address, 2897 using the "xmpp-client" port of 5222 registered with the IANA. 2899 The IP address and method of access of clients MUST NOT be made 2900 available by a server, nor are any connections other than the 2901 original server connection required. This helps to protect the 2902 client's server from direct attack or identification by third 2903 parties. 2905 14.3 Server-to-Server Communications 2907 A compliant implementation MUST support both TLS and SASL for 2908 inter-domain communications. For historical reasons, a compliant 2909 implementation SHOULD also support Server Dialback (Section 8). 2911 Because service provisioning is a matter of policy, it is OPTIONAL 2912 for any given domain to communicate with other domains, and 2913 server-to-server communications MAY be disabled by the administrator 2914 of any given deployment. If a particular domain enables inter-domain 2915 communications, it SHOULD enable high security. 2917 Administrators may want to require use of SASL for server-to-server 2918 communications in order to ensure both authentication and 2919 confidentiality (e.g., on an organization's private network). 2920 Compliant implementations SHOULD support SASL for this purpose. 2922 Inter-domain connections MUST NOT proceed until the DNS hostnames 2923 asserted by the servers have been resolved. Such resolutions MUST 2924 first attempt to resolve the hostname using an [SRV] Service of 2925 "xmpp-server" and Proto of "tcp", resulting in resource records such 2926 as "_xmpp-server._tcp.example.com." (the use of the string 2927 "xmpp-server" for the service identifier is consistent with the IANA 2928 registration; note well that the "xmpp-server" service identifier 2929 supersedes the earlier use of a "jabber" service identifier, since 2930 the earlier usage did not conform to [SRV]; implementations desiring 2931 to be backward compatible should continue to look for or answer to 2932 the "jabber" service identifier as well). If the SRV lookup fails, 2933 the fallback is a normal IPv4/IPv6 address record resolution to 2934 determine the IP address, using the "xmpp-server" port of 5269 2935 registered with the IANA. 2937 Server dialback helps protect against domain spoofing, thus making it 2938 more difficult to spoof XML stanzas. It is not a mechanism for 2939 authenticating, securing, or encrypting streams between servers as is 2940 done via SASL and TLS. Furthermore, it is susceptible to DNS 2941 poisoning attacks unless DNSSec [DNSSEC] is used, and even if the DNS 2942 information is accurate, dialback cannot protect from attacks where 2943 the attacker is capable of hijacking the IP address of the remote 2944 domain. Domains requiring robust security SHOULD use TLS and SASL. 2945 If SASL is used for server-to-server authentication, dialback SHOULD 2946 NOT be used since it is unnecessary. 2948 14.4 Order of Layers 2950 The order of layers in which protocols MUST be stacked is as follows: 2952 1. TCP 2954 2. TLS 2956 3. SASL 2958 4. XMPP 2960 The rationale for this order is that [TCP] is the base connection 2961 layer used by all of the protocols stacked on top of TCP, [TLS] is 2962 often provided at the operating system layer, [SASL] is often 2963 provided at the application layer, and XMPP is the application 2964 itself. 2966 14.5 Lack of SASL Channel Binding to TLS 2968 The SASL framework does not provide a mechanism to bind SASL 2969 authentication to a security layer providing confidentiality and 2970 integrity protection that was negotiated at a lower layer. This lack 2971 of a "channel binding" prevents SASL from being able to verify that 2972 the source and destination end points to which the lower layer's 2973 security is bound are equivalent to the end points that SASL is 2974 authenticating. If the end points are not identical, the lower 2975 layer's security cannot be trusted to protect data transmitted 2976 between the SASL authenticated entities. In such a situation, a SASL 2977 security layer should be negotiated which effectively ignores the 2978 presence of the lower layer security. 2980 14.6 Mandatory-to-Implement Technologies 2982 At a minimum, all implementations MUST support the following 2983 mechanisms: 2985 for authentication: the SASL DIGEST-MD5 mechanism 2987 for confidentiality: TLS (using the TLS_RSA_WITH_3DES_EDE_CBC_SHA 2988 cipher) 2990 for both: TLS plus SASL EXTERNAL(using the 2991 TLS_RSA_WITH_3DES_EDE_CBC_SHA cipher supporting client-side 2992 certificates) 2994 14.7 Firewalls 2996 Communications using XMPP normally occur over [TCP] sockets on port 2997 5222 (client-to-server) or port 5269 (server-to-server), as 2998 registered with the IANA (see IANA Considerations (Section 15)). Use 2999 of these well-known ports allows administrators to easily enable or 3000 disable XMPP activity through existing and commonly-deployed 3001 firewalls. 3003 14.8 Use of base64 in SASL 3005 Both the client and the server MUST verify any [BASE64] data received 3006 during SASL negotiation. An implementation MUST reject (not ignore) 3007 any characters that are not explicitly allowed by the base64 3008 alphabet; this helps to guard against creation of a covert channel 3009 that could be used to "leak" information. An implementation MUST NOT 3010 break on invalid input and MUST reject any sequence of base64 3011 characters containing the pad ('=') character if that character is 3012 included as something other than the last character of the data (e.g. 3013 "=AAA" or "BBBB=CCC"); this helps to guard against buffer overflow 3014 attacks and other attacks on the implementation. Base encoding 3015 visually hides otherwise easily recognized information, such as 3016 passwords, but does not provide any computational confidentiality. 3017 Base 64 encoding MUST follow the definition in Section 3 of RFC 3548 3018 [BASE64]. 3020 14.9 Stringprep Profiles 3022 XMPP makes use of the [NAMEPREP] profile of [STRINGPREP] for 3023 processing of domain identifiers; for security considerations related 3024 to Nameprep, refer to the appropriate section of [NAMEPREP]. 3026 In addition, XMPP defines two profiles of [STRINGPREP]: Nodeprep 3027 (Appendix A) for node identifiers and Resourceprep (Appendix B) for 3028 resource identifiers. 3030 The Unicode and ISO/IEC 10646 repertoires have many characters that 3031 look similar. In many cases, users of security protocols might do 3032 visual matching, such as when comparing the names of trusted third 3033 parties. Because it is impossible to map similar-looking characters 3034 without a great deal of context such as knowing the fonts used, 3035 stringprep does nothing to map similar-looking characters together 3036 nor to prohibit some characters because they look like others. 3038 A node identifier can be employed as one part of an entity's address 3039 in XMPP. One common usage is as the username of an instant messaging 3040 user; another is as the name of a multi-user chat room; and many 3041 other kinds of entities could use node identifiers as part of their 3042 addresses. The security of such services could be compromised based 3043 on different interpretations of the internationalized node 3044 identifier; for example, a user entering a single internationalized 3045 node identifier could access another user's account information, or a 3046 user could gain access to an otherwise restricted chat room or 3047 service. 3049 A resource identifier can be employed as one part of an entity's 3050 address in XMPP. One common usage is as the name for an instant 3051 messaging user's active session; another is as the nickname of a user 3052 in a multi-user chat room; and many other kinds of entities could use 3053 resource identifiers as part of their addresses. The security of 3054 such services could be compromised based on different interpretations 3055 of the internationalized resource identifier; for example, a user 3056 could attempt to initiate multiple sessions with the same name, or a 3057 user could send a message to someone other than the intended 3058 recipient in a multi-user chat room. 3060 15. IANA Considerations 3062 15.1 XML Namespace Name for TLS Data 3064 A URN sub-namespace for TLS-related data in the Extensible Messaging 3065 and Presence Protocol (XMPP) is defined as follows. (This namespace 3066 name adheres to the format defined in The IETF XML Registry 3067 [XML-REG].) 3068 URI: urn:ietf:params:xml:ns:xmpp-tls 3070 Specification: XXXX 3072 Description: This is the XML namespace name for TLS-related data in 3073 the Extensible Messaging and Presence Protocol (XMPP) as defined 3074 by XXXX. 3076 Registrant Contact: IETF, XMPP Working Group, 3078 15.2 XML Namespace Name for SASL Data 3080 A URN sub-namespace for SASL-related data in the Extensible Messaging 3081 and Presence Protocol (XMPP) is defined as follows. (This namespace 3082 name adheres to the format defined in [XML-REG].) 3084 URI: urn:ietf:params:xml:ns:xmpp-sasl 3086 Specification: XXXX 3088 Description: This is the XML namespace name for SASL-related data in 3089 the Extensible Messaging and Presence Protocol (XMPP) as defined 3090 by XXXX. 3092 Registrant Contact: IETF, XMPP Working Group, 3094 15.3 XML Namespace Name for Stream Errors 3096 A URN sub-namespace for stream-related error data in the Extensible 3097 Messaging and Presence Protocol (XMPP) is defined as follows. (This 3098 namespace name adheres to the format defined in [XML-REG].) 3100 URI: urn:ietf:params:xml:ns:xmpp-streams 3102 Specification: XXXX 3104 Description: This is the XML namespace name for stream-related error 3105 data in the Extensible Messaging and Presence Protocol (XMPP) as 3106 defined by XXXX. 3108 Registrant Contact: IETF, XMPP Working Group, 3110 15.4 XML Namespace Name for Resource Binding 3112 A URN sub-namespace for resource binding in the Extensible Messaging 3113 and Presence Protocol (XMPP) is defined as follows. (This namespace 3114 name adheres to the format defined in [XML-REG].) 3116 URI: urn:ietf:params:xml:ns:xmpp-bind 3118 Specification: XXXX 3120 Description: This is the XML namespace name for resource binding in 3121 the Extensible Messaging and Presence Protocol (XMPP) as defined 3122 by XXXX. 3124 Registrant Contact: IETF, XMPP Working Group, 3126 15.5 XML Namespace Name for Stanza Errors 3128 A URN sub-namespace for stanza-related error data in the Extensible 3129 Messaging and Presence Protocol (XMPP) is defined as follows. (This 3130 namespace name adheres to the format defined in [XML-REG].) 3132 URI: urn:ietf:params:xml:ns:xmpp-stanzas 3134 Specification: XXXX 3136 Description: This is the XML namespace name for stanza-related error 3137 data in the Extensible Messaging and Presence Protocol (XMPP) as 3138 defined by XXXX. 3140 Registrant Contact: IETF, XMPP Working Group, 3142 15.6 Nodeprep Profile of Stringprep 3144 The Nodeprep profile of stringprep is defined under Nodeprep 3145 (Appendix A). The IANA registers Nodeprep in the stringprep profile 3146 registry. 3148 Name of this profile: 3150 Nodeprep 3152 RFC in which the profile is defined: 3154 XXXX 3156 Indicator whether or not this is the newest version of the profile: 3158 This is the first version of Nodeprep 3160 15.7 Resourceprep Profile of Stringprep 3162 The Resourceprep profile of stringprep is defined under Resourceprep 3163 (Appendix B). The IANA registers Resourceprep in the stringprep 3164 profile registry. 3166 Name of this profile: 3168 Resourceprep 3170 RFC in which the profile is defined: 3172 XXXX 3174 Indicator whether or not this is the newest version of the profile: 3176 This is the first version of Resourceprep 3178 15.8 GSSAPI Service Name 3180 The IANA registers "xmpp" as a GSSAPI [GSS-API] service name, as 3181 defined under SASL Definition (Section 6.3). 3183 15.9 Port Numbers 3185 The IANA currently registers "jabber-client" and "jabber-server" as 3186 keywords for [TCP] ports 5222 and 5269 respectively. The IANA shall 3187 change these registrations to "xmpp-client" and "xmpp-server" 3188 respectively. 3190 These ports SHOULD be used for client-to-server and server-to-server 3191 communications respectively, but their use is NOT REQUIRED. 3193 Normative References 3195 [ABNF] Crocker, D. and P. Overell, "Augmented BNF for Syntax 3196 Specifications: ABNF", RFC 2234, November 1997. 3198 [BASE64] Josefsson, S., "The Base16, Base32, and Base64 Data 3199 Encodings", RFC 3548, July 2003. 3201 [CHARSET] Alvestrand, H., "IETF Policy on Character Sets and 3202 Languages", BCP 18, RFC 2277, January 1998. 3204 [GSS-API] Linn, J., "Generic Security Service Application Program 3205 Interface, Version 2", RFC 2078, January 1997. 3207 [HTTP-TLS] 3208 Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 3210 [IMP-REQS] 3211 Day, M., Aggarwal, S. and J. Vincent, "Instant Messaging / 3212 Presence Protocol Requirements", RFC 2779, February 2000. 3214 [LANGTAGS] 3215 Alvestrand, H., "Tags for the Identification of 3216 Languages", BCP 47, RFC 3066, January 2001. 3218 [IDNA] Faltstrom, P., Hoffman, P. and A. Costello, 3219 "Internationalizing Domain Names in Applications (IDNA)", 3220 RFC 3490, March 2003. 3222 [NAMEPREP] 3223 Hoffman, P. and M. Blanchet, "Nameprep: A Stringprep 3224 Profile for Internationalized Domain Names (IDN)", RFC 3225 3491, March 2003. 3227 [SASL] Myers, J., "Simple Authentication and Security Layer 3228 (SASL)", RFC 2222, October 1997. 3230 [SRV] Gulbrandsen, A., Vixie, P. and L. Esibov, "A DNS RR for 3231 specifying the location of services (DNS SRV)", RFC 2782, 3232 February 2000. 3234 [STRINGPREP] 3235 Hoffman, P. and M. Blanchet, "Preparation of 3236 Internationalized Strings ("STRINGPREP")", RFC 3454, 3237 December 2002. 3239 [TCP] Postel, J., "Transmission Control Protocol", STD 7, RFC 3240 793, September 1981. 3242 [TERMS] Bradner, S., "Key words for use in RFCs to Indicate 3243 Requirement Levels", BCP 14, RFC 2119, March 1997. 3245 [TLS] Dierks, T., Allen, C., Treese, W., Karlton, P., Freier, A. 3246 and P. Kocher, "The TLS Protocol Version 1.0", RFC 2246, 3247 January 1999. 3249 [UCS2] International Organization for Standardization, 3250 "Information Technology - Universal Multiple-octet coded 3251 Character Set (UCS) - Amendment 2: UCS Transformation 3252 Format 8 (UTF-8)", ISO Standard 10646-1 Addendum 2, 3253 October 1996. 3255 [UTF-8] Yergeau, F., "UTF-8, a transformation format of ISO 3256 10646", RFC 2279, January 1998. 3258 [XML] Bray, T., Paoli, J., Sperberg-McQueen, C. and E. Maler, 3259 "Extensible Markup Language (XML) 1.0 (2nd ed)", W3C 3260 REC-xml, October 2000, . 3262 [XML-NAMES] 3263 Bray, T., Hollander, D. and A. Layman, "Namespaces in 3264 XML", W3C REC-xml-names, January 1999, . 3267 Informative References 3269 [ACAP] Newman, C. and J. Myers, "ACAP -- Application 3270 Configuration Access Protocol", RFC 2244, November 1997. 3272 [DNSSEC] Eastlake, D., "Domain Name System Security Extensions", 3273 RFC 2535, March 1999. 3275 [HTTP] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 3276 Masinter, L., Leach, P. and T. Berners-Lee, "Hypertext 3277 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 3279 [IMAP] Crispin, M., "Internet Message Access Protocol - Version 3280 4rev1", RFC 2060, December 1996. 3282 [JSF] Jabber Software Foundation, "Jabber Software Foundation", 3283 . 3285 [POP3] Myers, J. and M. Rose, "Post Office Protocol - Version 3", 3286 STD 53, RFC 1939, May 1996. 3288 [URI] Berners-Lee, T., Fielding, R. and L. Masinter, "Uniform 3289 Resource Identifiers (URI): Generic Syntax", RFC 2396, 3290 August 1998. 3292 [USINGTLS] 3293 Newman, C., "Using TLS with IMAP, POP3 and ACAP", RFC 3294 2595, June 1999. 3296 [XML-REG] Mealling, M., "The IETF XML Registry", 3297 draft-mealling-iana-xmlns-registry-05 (work in progress), 3298 June 2003. 3300 [XMPP-IM] Saint-Andre, P., "Extensible Messaging and Presence 3301 Protocol (XMPP): Instant Messaging and Presence", 3302 draft-ietf-xmpp-im-19 (work in progress), November 2003. 3304 Author's Address 3306 Peter Saint-Andre 3307 Jabber Software Foundation 3309 EMail: stpeter@jabber.org 3311 Appendix A. Nodeprep 3313 A.1 Introduction 3315 This appendix defines the "Nodeprep" profile of [STRINGPREP]. As 3316 such, it specifies processing rules that will enable users to enter 3317 internationalized node identifiers in the Extensible Messaging and 3318 Presence Protocol (XMPP) and have the highest chance of getting the 3319 content of the strings correct. (An XMPP node identifier is the 3320 optional portion of an XMPP address that precedes a domain identifier 3321 and the '@' separator; it is often but not exclusively associated 3322 with an instant messaging username.) These processing rules are 3323 intended only for XMPP node identifiers and are not intended for 3324 arbitrary text or any other aspect of an XMPP address. 3326 This profile defines the following, as required by [STRINGPREP]: 3328 o The intended applicability of the profile: internationalized node 3329 identifiers within XMPP 3331 o The character repertoire that is the input and output to 3332 stringprep: Unicode 3.2, specified in Section 2 of this Appendix 3334 o The mappings used: specified in Section 3 3336 o The Unicode normalization used: specified in Section 4 3338 o The characters that are prohibited as output: specified in Section 3339 5 3341 o Bidirectional character handling: specified in Section 6 3343 A.2 Character Repertoire 3345 This profile uses Unicode 3.2 with the list of unassigned code points 3346 being Table A.1, both defined in Appendix A of [STRINGPREP]. 3348 A.3 Mapping 3350 This profile specifies mapping using the following tables from 3351 [STRINGPREP]: 3353 Table B.1 3355 Table B.2 3357 A.4 Normalization 3359 This profile specifies using Unicode normalization form KC, as 3360 described in [STRINGPREP]. 3362 A.5 Prohibited Output 3364 This profile specifies prohibiting use of the following tables from 3365 [STRINGPREP]. 3367 Table C.1.1 3369 Table C.1.2 3371 Table C.2.1 3373 Table C.2.2 3375 Table C.3 3377 Table C.4 3379 Table C.5 3381 Table C.6 3383 Table C.7 3385 Table C.8 3387 Table C.9 3389 In addition, the following Unicode characters are also prohibited: 3391 #x22 (") 3393 #x26 (&) 3395 #x27 (') 3397 #x2F (/) 3399 #x3A (:) 3401 #x3C (<) 3403 #x3E (>) 3405 #x40 (@) 3407 A.6 Bidirectional Characters 3409 This profile specifies checking bidirectional strings as described in 3410 Section 6 of [STRINGPREP]. 3412 Appendix B. Resourceprep 3414 B.1 Introduction 3416 This appendix defines the "Resourceprep" profile of [STRINGPREP]. As 3417 such, it specifies processing rules that will enable users to enter 3418 internationalized resource identifiers in the Extensible Messaging 3419 and Presence Protocol (XMPP) and have the highest chance of getting 3420 the content of the strings correct. (An XMPP resource identifier is 3421 the optional portion of an XMPP address that follows a domain 3422 identifier and the '/' separator; it is often but not exclusively 3423 associated with an instant messaging session name.) These processing 3424 rules are intended only for XMPP resource identifiers and are not 3425 intended for arbitrary text or any other aspect of an XMPP address. 3427 This profile defines the following, as required by [STRINGPREP]: 3429 o The intended applicability of the profile: internationalized 3430 resource identifiers within XMPP 3432 o The character repertoire that is the input and output to 3433 stringprep: Unicode 3.2, specified in Section 2 of this Appendix 3435 o The mappings used: specified in Section 3 3437 o The Unicode normalization used: specified in Section 4 3438 o The characters that are prohibited as output: specified in Section 3439 5 3441 o Bidirectional character handling: specified in Section 6 3443 B.2 Character Repertoire 3445 This profile uses Unicode 3.2 with the list of unassigned code points 3446 being Table A.1, both defined in Appendix A of [STRINGPREP]. 3448 B.3 Mapping 3450 This profile specifies mapping using the following tables from 3451 [STRINGPREP]: 3453 Table B.1 3455 B.4 Normalization 3457 This profile specifies using Unicode normalization form KC, as 3458 described in [STRINGPREP]. 3460 B.5 Prohibited Output 3462 This profile specifies prohibiting use of the following tables from 3463 [STRINGPREP]. 3465 Table C.1.2 3467 Table C.2.1 3469 Table C.2.2 3471 Table C.3 3473 Table C.4 3475 Table C.5 3477 Table C.6 3479 Table C.7 3481 Table C.8 3482 Table C.9 3484 B.6 Bidirectional Characters 3486 This profile specifies checking bidirectional strings as described in 3487 Section 6 of [STRINGPREP]. 3489 Appendix C. XML Schemas 3491 The following XML schemas are descriptive, not normative. For 3492 schemas defining the 'jabber:client' and 'jabber:server' namespaces, 3493 refer to [XMPP-IM]. 3495 C.1 Streams namespace 3497 3499 3505 3508 3509 3510 3511 3512 3513 3516 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3536 3537 3538 3540 3541 3542 3543 3545 3549 3550 3551 3553 3555 C.2 Stream error namespace 3557 3559 3566 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3594 3595 3596 3597 3598 3600 3601 3602 3603 3604 3606 3608 C.3 TLS namespace 3610 3612 3618 3619 3620 3621 3625 3626 3627 3629 3630 3631 3633 3634 3635 3636 3637 3639 3641 C.4 SASL namespace 3643 3645 3651 3652 3653 3654 3655 3656 3657 3659 3661 3662 3663 3666 3667 3669 3670 3671 3672 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3688 3689 3690 3691 3692 3693 3694 3696 3697 3698 3699 3700 3702 3704 C.5 Resource binding namespace 3706 3707 3713 3714 3715 3716 3717 3718 3719 3720 3722 3723 3725 3727 C.6 Dialback namespace 3729 3731 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3776 3778 C.7 Stanza error namespace 3780 3782 3789 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3814 3815 3816 3817 3818 3820 3821 3822 3823 3824 3826 3828 Appendix D. Differences Between Core Jabber Protocol and XMPP 3830 This section is non-normative. 3832 XMPP has been adapted from the protocols originally developed in the 3833 Jabber open-source community, which can be thought of as "XMPP 0.9". 3834 Because there exists a large installed base of Jabber implementations 3835 and deployments, it may be helpful to specify the key differences 3836 between Jabber and XMPP in order to expedite and encourage upgrades 3837 of those implementations and deployments to XMPP. This section 3838 summarizes the core differences, while the corresponding section of 3839 [XMPP-IM] summarizes the differences that relate specifically to 3840 instant messaging and presence applications. 3842 D.1 Channel Encryption 3844 It is common practice in the Jabber community to use SSL for channel 3845 encryption on ports other than 5222 and 5269 (the convention is to 3846 use ports 5223 and 5270). XMPP uses TLS over the IANA-registered 3847 ports for channel encryption, as defined under Use of TLS (Section 5) 3848 herein. 3850 D.2 Authentication 3852 The client-server authentication protocol developed in the Jabber 3853 community uses a basic IQ interaction qualified by the 3854 'jabber:iq:auth' namespace (documentation of this protocol is 3855 contained in "JEP-0078: Non-SASL Authentication", published by the 3856 Jabber Software Foundation [JSF]). XMPP uses SASL for 3857 authentication, as defined under Use of SASL (Section 6) herein. 3859 The Jabber community does not currently possess an authentication 3860 protocol for server-to-server communications, only the Server 3861 Dialback (Section 8) protocol to prevent server spoofing. XMPP 3862 augments Server Dialback with a true server-to-server authentication 3863 protocol, as defined under Use of SASL (Section 6) herein. 3865 D.3 Resource Binding 3867 Resource binding in the Jabber community is handled via the 3868 'jabber:iq:auth' namespace that is also used for client 3869 authentication with a server. XMPP defines a dedicated namespace for 3870 resource binding as well as the ability for a server to generate a 3871 resource identifier on behalf of a client, as defined under Resource 3872 Binding (Section 7). 3874 D.4 JID Processing 3876 JID processing was somewhat loosely defined by the Jabber community 3877 (documentation of forbidden characters and case handling is contained 3878 in "JEP-0029: Definition of Jabber Identifiers", published by the 3879 Jabber Software Foundation [JSF]). XMPP specifies the use of 3880 [NAMEPREP] for domain identifiers and supplements Nameprep with two 3881 additional [STRINGPREP] profiles for JID processing: Nodeprep 3882 (Appendix A) for node identifiers and Resourceprep (Appendix B) for 3883 resource identifiers . 3885 D.5 Error Handling 3887 Stream-related errors are handled in the Jabber community via simple 3888 CDATA text in a element. In XMPP, stream-related 3889 errors are handled via an extensible mechanism defined under Stream 3890 Errors (Section 4.6) herein. 3892 Stanza-related errors are handled in the Jabber community via 3893 HTTP-style error codes. In XMPP, stanza-related errors are handled 3894 via an extensible mechanism defined under Stanza Errors (Section 9.3) 3895 herein. (Documentation of a mapping between Jabber and XMPP error 3896 handling mechanisms is contained in "JEP-0086: Legacy Errors", 3897 published by the Jabber Software Foundation [JSF].) 3899 D.6 Internationalization 3901 Although use of UTF-8 has always been standard practice within the 3902 Jabber community, the community did not define mechanisms for 3903 specifying the language of human-readable text provided in CDATA 3904 sections. XMPP specifies the use of the 'xml:lang' attribute in such 3905 contexts, as defined under Stream Attributes (Section 4.2) and 3906 xml:lang (Section 9.1.5) herein. 3908 D.7 Stream Version Attribute 3910 The Jabber community does not include a 'version' attribute in stream 3911 headers. XMPP specifies inclusion of that attribute, with a value of 3912 '1.0', as a way to signal support for the stream features 3913 (authentication, encryption, etc.) defined under Version Support 3914 (Section 4.2.1) herein. 3916 Appendix E. Revision History 3918 Note to RFC Editor: please remove this entire appendix, and the 3919 corresponding entries in the table of contents, prior to publication. 3921 E.1 Changes from draft-ietf-xmpp-core-19 3923 o Fixed several typographical errors. 3925 o Restricted values of 'type' attribute for IQ stanzas to those 3926 defined in the schema (i.e., changed SHOULD to MUST) to ensure 3927 consistency with text in XMPP IM. 3929 o Added reference to RFC 3548. 3931 o Replaced RFC 2222 reference with reference to 3932 draft-ietf-sasl-rfc2222bis. 3934 o Further clarified role and usage of user names in SASL mechanisms. 3936 o Added mention of 'code' attribute on error element. 3938 o Clarified several sentences in the dialback narrative. 3940 o Clarified use of stringprep profiles and added reference to RFC 3941 3490. 3943 o Added security consideration regarding lack of SASL channel 3944 binding to TLS per discussion at IETF 58 meeting. 3946 o Adjusted formatting to conform to RFC Editor requirements. 3948 E.2 Changes from draft-ietf-xmpp-core-18 3950 o Added the 'xml:lang' attribute to the root element per 3951 previous consensus and list discussion. 3953 o Changed "jabber-server" and "jabber-client" service names to 3954 "xmpp-server" and "xmpp-client". 3956 o Added the , , and stanza 3957 errors. 3959 o Changed dataype of stream error and of 3960 and stanza errors to xs:string so that these elements 3961 may contain programmatic information. 3963 o Removed and SASL errors. 3965 o Removed references to RFC 952 and RFC 1123 (domain name format is 3966 handled by reference to Nameprep). 3968 o Changed address record resolution text so that it is not specific 3969 to IPv4. 3971 o Clarified text in appendices regarding scope of Nodeprep and 3972 Resourceprep. 3974 o Removed requirement that receiving entity terminate the TCP 3975 connection upon receiving an element from or sending a 3976 element to the initiating entity during SASL 3977 negotiation. 3979 o Removed recommendation that TLS and SASL security layer should not 3980 both be used simultaneously. 3982 o Added subsection to Security Considerations regarding use of 3983 base64 in SASL. 3985 o Specified rules regarding inclusion of username in SASL 3986 negotiation. 3988 o Adjusted content related to SASL authorization identities, since 3989 the previous text did not track SASL. 3991 o Added section on resource binding to compensate for changes to 3992 SASL authorization identity text. 3994 o Specified ABNF for JIDs. 3996 o Checked all references. 3998 o Completed a thorough proofreading and consistency check of the 3999 entire text. 4001 E.3 Changes from draft-ietf-xmpp-core-17 4003 o Specified that UTF-8 is the only allowable encoding. 4005 o Added stream errors for , , 4006 and , as well as a error for 4007 generic XML error conditions. 4009 o Folded Nodeprep and Resourceprep profiles into this document. 4011 o Moved most delivery handling rules from XMPP IM to XMPP Core. 4013 o Moved detailed stanza syntax descriptions from XMPP Core to XMPP 4014 IM. 4016 o Moved stanza schemas from XMPP Core to XMPP IM. 4018 E.4 Changes from draft-ietf-xmpp-core-16 4020 o Added and stream errors. 4022 o Changed the datatype for the and 4023 stream errors from 'xs:string' to 'empty'. 4025 o Further clarified server handling of the basic stanza kinds. 4027 o Further clarified character encoding rules per list discussion. 4029 o Specified meaning of version='1.0' flag in stream headers. 4031 o Added stream closure to SASL failure cases in order to mirror 4032 handling of TLS failures. 4034 o Added section on compliance requirements for server and client 4035 implementations. 4037 o Added non-normative section on differences between Jabber usage 4038 and XMPP specifications. 4040 E.5 Changes from draft-ietf-xmpp-core-15 4042 o Added and stream errors. 4044 o Added SASL error and clarified error. 4046 o Made 'id' required for IQ stanzas. 4048 E.6 Changes from draft-ietf-xmpp-core-14 4050 o Added SRV lookup for client-to-server communications. 4052 o Changed server SRV record to conform to RFC 2782; specifically, 4053 the service identifier was changed from 'jabber' to 4054 'jabber-server'. 4056 E.7 Changes from draft-ietf-xmpp-core-13 4058 o Clarified stream restart after successful TLS and SASL 4059 negotiation. 4061 o Clarified requirement for resolution of DNS hostnames. 4063 o Clarified text regarding namespaces. 4065 o Clarified examples regarding empty element. 4067 o Added several more SASL error conditions. 4069 o Changed stream error to and 4070 added to schema. 4072 o Made small editorial changes and fixed several schema errors. 4074 E.8 Changes from draft-ietf-xmpp-core-12 4076 o Moved server dialback to a separate section; clarified its 4077 security characteristics and its role in the protocol. 4079 o Adjusted error handling syntax and semantics per list discussion. 4081 o Further clarified length of node identifiers and total length of 4082 JIDs. 4084 o Documented message type='normal'. 4086 o Corrected several small errors in the TLS and SASL sections. 4088 o Corrected several errors in the schemas. 4090 E.9 Changes from draft-ietf-xmpp-core-11 4091 o Corrected several small errors in the TLS and SASL sections. 4093 o Made small editorial changes and fixed several schema errors. 4095 E.10 Changes from draft-ietf-xmpp-core-10 4097 o Adjusted TLS content regarding certificate validation process. 4099 o Specified that stanza error extensions for specific applications 4100 are to be properly namespaced children of the relevant descriptive 4101 element. 4103 o Clarified rules for inclusion of the 'id' attribute. 4105 o Specified that the 'xml:lang' attribute SHOULD be included (per 4106 list discussion). 4108 o Made small editorial changes and fixed several schema errors. 4110 E.11 Changes from draft-ietf-xmpp-core-09 4112 o Fixed several dialback error conditions. 4114 o Cleaned up rules regarding TLS and certificate processing based on 4115 off-list feedback. 4117 o Changed and elements to 4118 . 4120 o Added or modified several stream and stanza error conditions. 4122 o Specified only one child allowed for IQ, or two if type="error". 4124 o Fixed several errors in the schemas. 4126 E.12 Changes from draft-ietf-xmpp-core-08 4128 o Incorporated list discussion regarding addressing, SASL, TLS, TCP, 4129 dialback, namespaces, extensibility, and the meaning of 'ignore' 4130 for routers and recipients. 4132 o Specified dialback error conditions. 4134 o Made small editorial changes to address RFC Editor requirements. 4136 E.13 Changes from draft-ietf-xmpp-core-07 4138 o Made several small editorial changes. 4140 E.14 Changes from draft-ietf-xmpp-core-06 4142 o Added text regarding certificate validation in TLS negotiation per 4143 list discussion. 4145 o Clarified nature of XML restrictions per discussion with W3C, and 4146 moved XML Restrictions subsection under "XML Usage within XMPP". 4148 o Further clarified that XML streams are unidirectional. 4150 o Changed stream error and stanza error namespace names to conform 4151 to the format defined in The IETF XML Registry. 4153 o Removed note to RFC Editor regarding provisional namespace names. 4155 E.15 Changes from draft-ietf-xmpp-core-05 4157 o Added as a stream error condition. 4159 o Adjusted security considerations per discussion at IETF 56 and on 4160 list. 4162 E.16 Changes from draft-ietf-xmpp-core-04 4164 o Added server-to-server examples for TLS and SASL. 4166 o Changed error syntax, rules, and examples based on list 4167 discussion. 4169 o Added schemas for the TLS, stream error, and stanza error 4170 namespaces. 4172 o Added note to RFC Editor regarding provisional namespace names. 4174 o Made numerous small editorial changes and clarified text 4175 throughout. 4177 E.17 Changes from draft-ietf-xmpp-core-03 4178 o Clarified rules and procedures for TLS and SASL. 4180 o Amplified stream error code syntax per list discussion. 4182 o Made numerous small editorial changes. 4184 E.18 Changes from draft-ietf-xmpp-core-02 4186 o Added dialback schema. 4188 o Removed all DTDs since schemas provide more complete definitions. 4190 o Added stream error codes. 4192 o Clarified error code "philosophy". 4194 E.19 Changes from draft-ietf-xmpp-core-01 4196 o Updated the addressing restrictions per list discussion and added 4197 references to the new Nodeprep and Resourceprep profiles. 4199 o Corrected error in Use of SASL regarding 'version' attribute. 4201 o Made numerous small editorial changes. 4203 E.20 Changes from draft-ietf-xmpp-core-00 4205 o Added information about TLS from list discussion. 4207 o Clarified meaning of "ignore" based on list discussion. 4209 o Clarified information about Universal Character Set data and 4210 character encodings. 4212 o Provided base64-decoded information for examples. 4214 o Fixed several errors in the schemas. 4216 o Made numerous small editorial fixes. 4218 E.21 Changes from draft-miller-xmpp-core-02 4220 o Brought Use of SASL section into line with discussion on list and 4221 at IETF 55 meeting. 4223 o Added information about the optional 'xml:lang' attribute per 4224 discussion on list and at IETF 55 meeting. 4226 o Specified that validation is neither required nor recommended, and 4227 that the formal definitions (DTDs and schemas) are included for 4228 descriptive purposes only. 4230 o Specified that the response to an IQ stanza of type "get" or "set" 4231 must be an IQ stanza of type "result" or "error". 4233 o Specified that compliant server implementations must process 4234 stanzas in order. 4236 o Specified that for historical reasons some server implementations 4237 may accept 'stream:' as the only valid namespace prefix on the 4238 root stream element. 4240 o Clarified the difference between 'jabber:client' and 4241 'jabber:server' namespaces, namely, that 'to' and 'from' 4242 attributes are required on all stanzas in the latter but not the 4243 former. 4245 o Fixed typo in Step 9 of the dialback protocol (changed db:result 4246 to db:verify). 4248 o Removed references to TLS pending list discussion. 4250 o Removed the non-normative appendix on OpenPGP usage pending its 4251 inclusion in a separate I-D. 4253 o Simplified the architecture diagram, removed most references to 4254 services, and removed references to the 'jabber:component:*' 4255 namespaces. 4257 o Noted that XMPP activity respects firewall administration 4258 policies. 4260 o Further specified the scope and uniqueness of the 'id' attribute 4261 in all stanza kinds and the element in message stanzas. 4263 o Nomenclature changes: (1) from "chunks" to "stanzas"; (2) from 4264 "host" to "server" and from "node" to "client" (except with regard 4265 to definition of the addressing scheme). 4267 Intellectual Property Statement 4269 The IETF takes no position regarding the validity or scope of any 4270 intellectual property or other rights that might be claimed to 4271 pertain to the implementation or use of the technology described in 4272 this document or the extent to which any license under such rights 4273 might or might not be available; neither does it represent that it 4274 has made any effort to identify any such rights. Information on the 4275 IETF's procedures with respect to rights in standards-track and 4276 standards-related documentation can be found in BCP-11. Copies of 4277 claims of rights made available for publication and any assurances of 4278 licenses to be made available, or the result of an attempt made to 4279 obtain a general license or permission for the use of such 4280 proprietary rights by implementors or users of this specification can 4281 be obtained from the IETF Secretariat. 4283 The IETF invites any interested party to bring to its attention any 4284 copyrights, patents or patent applications, or other proprietary 4285 rights which may cover technology that may be required to practice 4286 this standard. Please address the information to the IETF Executive 4287 Director. 4289 Full Copyright Statement 4291 Copyright (C) The Internet Society (2003). All Rights Reserved. 4293 This document and translations of it may be copied and furnished to 4294 others, and derivative works that comment on or otherwise explain it 4295 or assist in its implementation may be prepared, copied, published 4296 and distributed, in whole or in part, without restriction of any 4297 kind, provided that the above copyright notice and this paragraph are 4298 included on all such copies and derivative works. However, this 4299 document itself may not be modified in any way, such as by removing 4300 the copyright notice or references to the Internet Society or other 4301 Internet organizations, except as needed for the purpose of 4302 developing Internet standards in which case the procedures for 4303 copyrights defined in the Internet Standards process must be 4304 followed, or as required to translate it into languages other than 4305 English. 4307 The limited permissions granted above are perpetual and will not be 4308 revoked by the Internet Society or its successors or assignees. 4310 This document and the information contained herein is provided on an 4311 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING 4312 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING 4313 BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION 4314 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF 4315 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 4317 Acknowledgment 4319 Funding for the RFC Editor function is currently provided by the 4320 Internet Society.