XMPP翻译:RFC 3920[10](Chapter14-15)

本篇翻译了XMPP核心协议RFC 3920的第十四和十五章。

内容提要

Security Considerations //安全性考虑

    1. High Security
    2. Certificate Validation
    3. Client-to-Server Communications
    4. Server-to-Server Communications
    5. Order of Layers
    6. Lack of SASL Channel Binding to TLS
    7. Mandatory-to-Implement Technologies
    8. Firewalls
    9. Use of base64 in SASL
    10. Stringprep Profiles

IANA Considerations //IANA考虑

  1. XML Namespace Name for TLS Data
  2. XML Namespace Name for SASL Data
  3. XML Namespace Name for Stream Errors
  4. XML Namespace Name for Resource Binding
  5. XML Namespace Name for Stanza Errors
  6. Nodeprep Profile of Stringprep
  7. Resourceprep Profile of Stringprep
  8. GSSAPI Service Name
  9. Port Numbers

14.  Security Considerations

14.1.  High Security

在实现使用XMPP通讯时,术语"high security"指使用安全技术提供相互的认证和完整性校验;特别是使用基于证书的认证时,信任链SHOULD在带外建立(out-of-band),即使a shared certificate authority signing certificates会允许先前未知的证书在带内建立。参见Section 14.2(Certificate Validation),关于证书的验证过程。

实现MUST支持high security。提供服务时SHOULD使用high security,这取决于本地的安全策略。

14.2.  Certificate Validation

当一个XMPP同位体(peer)与另一个同位体安全的通讯时,它MUST验证该同位体的证书。这有三种情况:

Case #1:
The peer contains an End Entity certificate which appears to be certified by a chain of certificates terminating in a trust anchor ([X509]的6.1章节中有定义).
Case #2:
The peer certificate is certified by a Certificate Authority not known to the validating peer.
Case #3:
The peer certificate is self-signed.

在Case #1中,验证方同位体必须做以下两件事之一:

  1. 根据[X509]中的规则来验证同位体的证书。应该根据[HTTP‑TLS]中描述的规则,依靠所期望的同位体身份来验证此证书,除了一个type为"XMPP"的subjectAltName扩展MUST作为出席时的身份。如果有任何一个验证失败,用户端MUST要么通知用户(无论如何客户端可以用户继续该连接的机会),要么终止连接并抛出无效证书错误。自动化的客户端(Automated clients)则SHOULD终止连接(抛出无效证书错误),并将错误记录于适当的审计日志。Automated clients MAY 提供一个配置设置来取消该验证,但是必须同时提供重选该设置的功能。
  2. 为获得批准,同位体SHOULD向用户展示证书,包括实体的证书链(certificate chain)。同位体MUST缓存此证书(或一些无法伪造的形式如hash)。在之后的连接中,同位体MUST校验呈现的是否是相同的证书,如果改变了则必须通报给用户。

Case #2和Case #3中,实现SHOULD也如上两条行事。

14.3.  Client-to-Server Communications

一个合乎规范的客户端实现MUST同时支持用户连接服务器时的TLS和SASL。

用于加密XML流的TLS协议提供了一个可靠的机制来帮助确保两实体间所交换的数据的保密性和数据完整性。

用于鉴定XML流的SASL协议提供了一个可靠的机制来验证连接到服务器的客户端是该客户端自己所声称的身份。

C2S的通信在服务器声称的DNS主机名被解析前MUST NOT进行。这样的解析SHOULD首先尝试使用"xmpp-client"的一个[SRV]服务和原始的"tcp"来解析主机名,然后产生如"_xmpp-client._tcp.example.com."这样的资源记录(使用用户服务标识符的字符串"xmpp-client"与IANA中登记的一致)。如果SRV查找失败,接着要做的是使用"xmpp-client"的5222端口进行通常的IPv4/IPv6地址记录转化,以解析IP地址。

服务器禁止将客户端的IP地址与访问方法设为公开,除了必需的初始服务器连接外的任何连接也都不能公开。这有助于使与客户端连接的服务器避免被直接攻击或被第三方标识(identification by third parties)。

14.4.  Server-to-Server Communications

一个合乎规范的服务器实现MUST同时支持域间通信时的TLS和SASL。由于历史原因,该实现也SHOULD支持服务器回拨。

由于服务提供(service provisioning)与策略相关,任何给定的域是否与其它域进行通信是可选的(OPTIONAL),任何给定的配置中的管理员可以禁止服务器与服务器的通信。如果一个特定的域允许域间通信,它SHOULD能够提供high security。

管理员可能会要求在S2S通信中使用SASL,来确保双发的认证与机密(例如,在一个组织私有的网络中)。合乎规范的实现因此SHOULD支持SASL。

在服务器声称的DNS主机名未被解析前,禁止进行域间连接。这样的解析SHOULD首先尝试使用"xmpp-server"的一个[SRV]服务和原始的"tcp"来解析主机名,然后产生如"_xmpp-server._tcp.example.com."这样的资源记录(使用用户服务标识符的字符串"xmpp-server"与IANA中登记的一致;注意服务标识符"xmpp-server"取代了早期使用的"jabber"标识符,因为早期的用法与[SRV]不一致;想要向后兼容的实现应该继续寻找或响应"jabber"标识符)。如果SRV查找失败了,接着要做的是使用"xmpp-server"的5269端口进行通常的IPv4/IPv6地址记录转化,以解析IP地址。

服务器回拨有助于防止域欺骗,因为这使得欺骗XML节变的更加困难。不像SASL与TLS所作的,它不是用于认证、保护、加密服务器间的流的机制,而只是导致了服务器身份验证的减弱。此外,如过不用DNSSec的话,会被DNS posisoning攻击,而且即使DNS信息正确,回拨不能够防止攻击者能够劫持远程域的IP地址进行的攻击。需要强安全性的域SHOULD使用TLS和SASl。若SASL被用于S2S的认证,则SHOULD NOT使用dialback了,因为没必要了。

14.5.  Order of Layers

协议层的堆叠次序如下:

  1. TCP
  2. TLS
  3. SASL
  4. XMPP

这样的次序的基本原理:TCP是所有在TCP之上的协议层的基础连接,TLS常常应用在操作系统层,SASL通常应用在应用程序层,而XMPP则是应用程序本身。

14.6.  Lack of SASL Channel Binding to TLS

SASL框架没有提供一个将SASL身份认证绑定到安全层的机制,提供在底层协商中的机密性与完整性保护。信道绑定的不足使得SASL不能够校验资源,及与底层安全性所包括的目的端点相当的SASL认证末段点。(This lack of a "channel binding" prevents SASL from being able to verify that the source and destination end points to which the lower layer's security that are equivalent to the end points that SASL is authenticating.)如果末段点不相同,就不能用底层安全性来保护已由SASL确认的实体间的数据传输。在这种情况中,应该协商一个SASL安全层用于有效的忽略底层安全性的存在。

14.7.  Mandatory-to-Implement Technologies

所有的实现至少MUST自持以下机制:

身份认证:
SASL [DIGEST‑MD5]机制
保密性:
TLS (using the TLS_RSA_WITH_3DES_EDE_CBC_SHA cipher)
两者皆具:
TLS加上SASL EXTERNAL(using the TLS_RSA_WITH_3DES_EDE_CBC_SHA cipher supporting client-side certificates)

14.8.  Firewalls

使用XMPP通信,通常通过5222端口(C2S)或5269端口(S2S)的TCP连接进行,已向IANA登记过(参见IANA Considerations)。使用这些知名的端口使我们的管理员能够通过已存在和一般性配置的防火墙来启动或停止XMPP活动。

14.9.  Use of base64 in SASL

客户端和服务器都MUST校验SASL协商期间接收到的任何BASE64数据。实现MUST丢弃(或忽略)没有在base64字母表里被明确允许的任何字符;这有助于防止会被用于“泄露”信息的隐蔽信道的创建。实现MUST NOT在非法输入上间断,MUST拒绝任何包含插入符('=')的base64字符序列,如果该字符被包含作为不同于数据的最后字符的其他事物的话(例如,"=AAA"或"BBBB=CCC");这有助于防止缓冲器溢出攻击和实现中的其他攻击。Base64编码在视觉上隐藏了哪些容易被识别的信息,例如密码,但是没有提供任何计算的保密性。Base64编码MUST遵循RFC 3548 [BASE64]第三章的定义。

14.10.  Stringprep Profiles

XMPP使用STRINGPREP的NAMEPREP profile,来处理域标识符;关于Nameprep相关的安全性考虑,参考NAMEPREP中合适的章节。

另外,XMPP为节点标识符定义了两个STRINGPREP的profile,为资源标识符第一了个Resourceprep。

Unicode和ISO/IEC 10646指令表有很多相似的字符。在多数情况中,安全性协议的用户会做直观的比较,如比较受托(trusted)的第三方的名时。由于不可能在没有大量上下文中映射外观相似的字符,如获知所使用的字体,stringprep没有办法将外观相似的字符映射在一起,也无法阻止一些看似其他字符的字符。

节点标识符可以作为XMPP网络中实体地址的一部分。一个通常的用法是作为即时通信中用户的用户名;还有一种是作为多用户聊天室的名称;许多其他实体使用节点标识符作为他们地址的一部分。基于这样对国际化节点标识符的不同解释的服务程序的安全性将有损失;例如,一个用户输入一个简单的国际化的节点标识符,可以访问到另一个用户帐户信息,或用户可能获得其它受限制的聊天室或服务的访问权。

资源标识符可以作为XMPP网络中实体地址的一部分。一个通常的用法是作为即时通信中用户的连接资源的名称(在有效会话期间);还有一种是作为多用户聊天室的昵称;许多其他实体使用资源标识符作为他们地址的一部分。基于这样对国际化资源标识符的不同解释的服务程序的安全性将有损失;例如,一个用户可能尝试通过相同的名称来初始化多个会话,或在多人聊天室中,用户可能发送信息给其他人而不是预定中的接收者。

15.  IANA Considerations

15.1.  XML Namespace Name for TLS Data

用于XMPP中与TLS相关的数据的URN子命名空间名(This namespace name adheres to the format defined in The IETF XML Registry [XML‑REG].) ,定义如下:

URI:
urn:ietf:params:xml:ns:xmpp-tls
Specification:
RFC 3920
Description:
This is the XML namespace name for TLS-related data in the Extensible Messaging and Presence Protocol (XMPP) as defined by RFC 3920.
Registrant Contact:
IETF, XMPP Working Group, <xmppwg@jabber.org>

15.2.  XML Namespace Name for SASL Data

用于XMPP中与SASL相关的数据的URN子命名空间名(This namespace name adheres to the format defined in The IETF XML Registry [XML‑REG].) ,定义如下:

URI:
urn:ietf:params:xml:ns:xmpp-sasl
Specification:
RFC 3920
Description:
This is the XML namespace name for SASL-related data in the Extensible Messaging and Presence Protocol (XMPP) as defined by RFC 3920.
Registrant Contact:
IETF, XMPP Working Group, <xmppwg@jabber.org>

15.3.  XML Namespace Name for Stream Errors

用于XMPP中与steam相关的错误数据的URN子命名空间名(This namespace name adheres to the format defined in The IETF XML Registry [XML‑REG].) ,定义如下:

URI:
urn:ietf:params:xml:ns:xmpp-streams
Specification:
RFC 3920
Description:
This is the XML namespace name for stream-related error data in the Extensible Messaging and Presence Protocol (XMPP) as defined by RFC 3920.
Registrant Contact:
IETF, XMPP Working Group, <xmppwg@jabber.org>

15.4.  XML Namespace Name for Resource Binding

用于XMPP中资源绑定的URN子命名空间名(This namespace name adheres to the format defined in The IETF XML Registry [XML‑REG].) ,定义如下:

URI:
urn:ietf:params:xml:ns:xmpp-bind
Specification:
RFC 3920
Description:
This is the XML namespace name for resource binding in the Extensible Messaging and Presence Protocol (XMPP) as defined by RFC 3920.
Registrant Contact:
IETF, XMPP Working Group, <xmppwg@jabber.org>

15.5.  XML Namespace Name for Stanza Errors

用于XMPP中与节相关的错误数据的URN子命名空间名(This namespace name adheres to the format defined in The IETF XML Registry [XML‑REG].) ,定义如下:

URI:
urn:ietf:params:xml:ns:xmpp-stanzas
Specification:
RFC 3920
Description:
This is the XML namespace name for stanza-related error data in the Extensible Messaging and Presence Protocol (XMPP) as defined by RFC 3920.
Registrant Contact:
IETF, XMPP Working Group, <xmppwg@jabber.org>

15.6.  Nodeprep Profile of Stringprep

The Nodeprep profile of stringprep is defined under Nodeprep. The IANA has registered Nodeprep in the stringprep profile registry.

Name of this profile:

Nodeprep

RFC in which the profile is defined:

RFC 3920

Indicator whether or not this is the newest version of the profile:

This is the first version of Nodeprep

15.7.  Resourceprep Profile of Stringprep

The Resourceprep profile of stringprep is defined under Resourceprep. The IANA has registered Resourceprep in the stringprep profile registry.

Name of this profile:

Resourceprep

RFC in which the profile is defined:

RFC 3920

Indicator whether or not this is the newest version of the profile:

This is the first version of Resourceprep

15.8.  GSSAPI Service Name

The IANA has registered "xmpp" as a GSSAPI [GSS‑API] service name, as defined under SASL Definition.

15.9.  Port Numbers

IANA已经分别注册"xmpp-client" and "xmpp-server"为[TCP]端口5222和端口5269的关键字。

这些端口SHOULD分别用于client-to-server和server-to-server通信,但是是否使用他们是可选的。

本篇内容译自官方文档。

本Blog中所有内容皆以“现状”提供且没有任何担保,同时也没有授予任何权利。 This posting is provided "AS IS" with no warranties, and confers no rights.

posted on 2006-12-27 09:12  Hunts.C  阅读(1377)  评论(0编辑  收藏  举报