Add recommendation regarding multiple messages to distinct recipients; removed numerical recommendations since they are a matter of implementation or deployment.
A key factor in the reliability and security of network infrastructure is its resilience in the face of denial of service attacks (see &rfc4732;). Although the existing network of servers and clients that communicate via the Extensible Messaging and Presence Protocol (XMPP; see &rfc3920;) has not yet been subject to such attacks, that is no cause for complacency. Therefore this document specifies a set of best practices that XMPP server implementations and deployments can follow in order to reduce the likelihood of denial of service attacks on the Jabber network.
+A key factor in the reliability and security of network infrastructure is its resilience in the face of denial of service attacks (see &rfc4732;). Although the existing network of servers and clients that communicate via the Extensible Messaging and Presence Protocol (XMPP; see &rfc3920;) has not yet been subject to such attacks, that is no cause for complacency. Therefore this document specifies a set of best practices that server implementations and deployments can follow in order to reduce the likelihood of denial of service attacks on the Jabber network.
RFC 4732 defines denial of service as follows:
@@ -50,7 +56,7 @@Limiting the number of connections that a server will accept from a given IP address at any one time. Such a limit may help to prevent automated processes from exhausting the server's resources (such as available ports or XML parser processing resources).
Limiting the number of connection attempts (via the TCP binding specified in RFC 3920 or via the &xep0124;) that a server will accept from a given IP address in a given time period. Such a limit may help to prevent automated processes from exhausting the server's resources (such as available ports or XML parser processing capacity).
Limiting the number of authentication attempts for a given Jabber ID in a given time period. While such a limit may seem beneficial, in fact it might result in locking out the legitimate owner of a Jabber ID if a malicious entity attempts a large number of illegitimate authentication attempts for the Jabber ID; therefore such a limit is not recommended and it is instead recommended to limit the number of connections and connection attemps on a per-IP basis.
Limiting the number of authentication attempts for a given Jabber ID in a given time period. While such a limit may seem beneficial, in fact it might result in locking out the legitimate owner of a Jabber ID if a malicious entity attempts a large number of illegitimate authentication attempts for the Jabber ID; therefore such a limit is not recommended and it is instead recommended to limit the number of connections and connection attempts on a per-IP basis.
Disallowing unauthenticated connections from clients and from peer servers; as mentioned below, this is required by RFC 3920.
Limiting the number of XMPP resource identifiers allowed to an account at any one time. This may help to prevent a rogue account from creating an unlimited number of sessions and therefore exhausting the resources of the server's session manager.
Limiting the absolute size in bytes of XML stanzas accepted by the server, or of particular aspects of an XML stanza (e.g., attribute values, element names, XML character data). Limits on particular aspects of an XML stanza are probably not needed, as long as it is possible to limit the absolute size of each XML stanza, since such a limit may help to prevent exhaustion of server resources (e.g., XML parser processing capacity).
Limiting the number of bytes or XML stanzas that a server will accept over a given TCP connection or for a given JabberID in a given time period. Such a limit, which helps to prevent rogue accounts or hijacked clients from flooding the server, is common in existing XMPP server implementations and often goes by the name "karma".
Limiting the number of of XML stanzas that a connected client may send to different recipients in a given time period. Such a limit may help to prevent automated processes (e.g., bots) from sending unsolicited bulk communications (known in the instant messaging domain as "spim").
Limiting or prohibiting the sending of certain stanzas based on payload, type, or other appropriate features.
Restricting access to services (such as multi-user chat and publish-subscribe) that enable traffic amplification.
More strictly limiting the proposed restrictions depending on connection type, authentication type, or user class.
The following recommendations are presented roughly in order of interaction (e.g., recommendations related to the number of TCP connections or connection attempts are presented before recommendations related to authentication, which are presented before recommendations related to XML stanza handling).
A server implementation SHOULD enable a server administrator to limit the number of connections that it will from a given IP address at any one time.
A server implementation SHOULD enable a server administrator to limit the number of connections that it will accept from a given IP address at any one time.
If an entity attempts to connect but the maximum number of connections has been reached, the receiving server MUST NOT allow the new connection to proceed. There are no XMPP errors associated with this behavior, since it occurs at the binding (TCP or HTTP) level before an XML stream is initiated.
A server implementation SHOULD enable a server administrator to limit the number of connection attempts that it will from a given IP address in a given time period (e.g., one hour).
A server implementation SHOULD enable a server administrator to limit the number of connection attempts that it will accept from a given IP address in a given time period (e.g., one hour).
If an entity attempts to connect but the maximum number of connections has been reached, the receiving server MUST NOT allow the new connection to proceed. There are no XMPP errors associated with this behavior, since it occurs at the binding (TCP or HTTP) level before an XML stream is initiated.
In accordance with RFC 3920, a server MUST NOT process XML stanzas from clients that have not provided appropriate authentication credentials, and MUST NOT process XML stanzas from peer servers whose identity it has not either authenticated via SASL or verified via server dialback.
+In accordance with RFC 3920, a server MUST NOT process XML stanzas from clients that have not provided appropriate authentication credentials, and MUST NOT process XML stanzas from peer servers whose identity it has not either authenticated via SASL (see &rfc4422;) or verified via server dialback.
A server implementation MUST enable a server administrator to limit the number of resources it will allow an account to bind at any one time. The allowable range for simultaneous resources MAY vary by server implementation. It is RECOMMENDED for a deployment to set the maximum number of connected resources to a number less than 20.
+A server implementation SHOULD enable a server administrator to limit the number of resources it will allow an account to bind at any one time.
If a connected client attempts to bind a resource but has already reached the configured number of allowable resources, the receiving server MUST return a ¬allowed; stanza error, which in turn SHOULD include an application-specific error condition of <resource-limit-exceeded/>, as shown in the following example:
A server implementation MUST enable a server administrator to limit the size of stanzas it will accept from a connected client or peer server. It is RECOMMENDED for a deployment to set the upper limit on stanza size to a number in the range of 20 kilobytes and 200 kilobytes.
+A server implementation SHOULD enable a server administrator to limit the size of stanzas it will accept from a connected client or peer server.
If a connected client or peer server sends a stanza that violates the upper limit, the receiving server SHOULD NOT process the stanza and instead SHOULD return a ¬allowed; stanza error, which in turn SHOULD include an application-specific error condition of <stanza-too-big/>, as shown in the following example:
Note: In the case of a stanza size limit, the server SHOULD NOT include the original stanza.
+Note: In the case of a stanza size limit, the server SHOULD NOT include the original payload in the error stanza.
Alternatively (e.g., if the sender has sent an egregiously large stanza), the server MAY instead return a <policy-violation/> stream error:
A server implementation SHOULD enable a server administrator to limit the number of XML stanzas that a connected client may send to distinct recipients within a given time period.
+If a connected client sends too many stanzas to distinct recipients in a given time period, the receiving server SHOULD NOT process the stanza and instead SHOULD return a &unexpected; stanza error, which in turn SHOULD include an application-specific error condition of <too-many-stanzas/>, as shown in the following example:
+A server implementation MUST enable a server administrator to limit the amount of bandwidth it will allow a connected client or peer server to use in a given time period.
-Bandwidth limits in existing XMPP servers can be somewhat complex, since they dynamically respond to usage patterns, take into account temporary traffic bursts, enable the server administrator to modify recovery times and penalty lengths, etc. An example of low average bandwidth limits would be 1k-2k per second, of medium limits 4k-6k per second, of high limits 8k-10k per second. For details, see documentation for existing implementations.
+A server implementation SHOULD enable a server administrator to limit the amount of bandwidth it will allow a connected client or peer server to use in a given time period.
+Bandwidth limits in existing XMPP server implementations (often called "karma") can be somewhat complex, since they dynamically respond to usage patterns, take into account temporary traffic bursts, enable the server administrator to modify recovery times and penalty lengths, etc. An example of low average bandwidth limits would be 1k-2k per second, of medium limits 4k-6k per second, of high limits 8k-10k per second. For details, see documentation for existing implementations.
A server implementation SHOULD enable a server administrator to limit the types of stanzas (based on payload etc.) it will allow a connected client send over an active connection. Possible restrictions include:
@@ -135,11 +154,9 @@Such limits and restrictions are a matter of deployment policy, and no recommendations are provided herein.
An implementation of a service that enables traffic amplification (e.g., multi-user chat or publish-subscribe) SHOULD enable an administrator of that service to limit (based on JabberID or other characteristics) what entities may send information through the service.
-Such restrictions are a matter of deployment policy, and no recommendations are provided herein (however, see XEP-0045 regarding methods of banning users from multi-user chat rooms and XEP-0060 regarding methods for prohibiting users from interacting with publish-subscribe nodes).
+An implementation of a service that enables traffic amplification (e.g., multi-user chat or publish-subscribe) SHOULD enable an administrator of that service to limit (based on JabberID or other characteristics) what entities may send information through the service. (See XEP-0045 regarding methods of banning users from multi-user chat rooms and XEP-0060 regarding methods for prohibiting users from interacting with publish-subscribe nodes.)
Special thanks to Chris Mullins for calling attention to the need for a specification detailing best practices such as those recommended herein. Thanks also to Thiago Camargo, Bruce Campbell, Gustavo Felisberto, Justin Karneges, Pedro Melo, and Michael Vorner for their suggestions.
+Special thanks to Chris Mullins for calling attention to the need for a specification detailing best practices such as those recommended herein. Thanks also to Thiago Camargo, Bruce Campbell, Gustavo Felisberto, Justin Karneges, Pedro Melo, Kevin Smith, and Michael Vorner for their suggestions.