Internet Engineering Task Force (IETF) C. Evans Request for Comments: 7469 C. Palmer Category: Standards Track R. Sleevi ISSN: 2070-1721 Google, Inc. April 2015
Internet Engineering Task Force (IETF) C. Evans Request for Comments: 7469 C. Palmer Category: Standards Track R. Sleevi ISSN: 2070-1721 Google, Inc. April 2015
Public Key Pinning Extension for HTTP
HTTP的公钥固定扩展
Abstract
摘要
This document defines a new HTTP header that allows web host operators to instruct user agents to remember ("pin") the hosts' cryptographic identities over a period of time. During that time, user agents (UAs) will require that the host presents a certificate chain including at least one Subject Public Key Info structure whose fingerprint matches one of the pinned fingerprints for that host. By effectively reducing the number of trusted authorities who can authenticate the domain during the lifetime of the pin, pinning may reduce the incidence of man-in-the-middle attacks due to compromised Certification Authorities.
本文档定义了一个新的HTTP头,允许web主机操作员指示用户代理在一段时间内记住(“pin”)主机的加密身份。在此期间,用户代理(UAs)将要求主机提供一个证书链,其中包括至少一个主体公钥信息结构,其指纹与该主机的一个固定指纹匹配。通过有效减少可在pin生命周期内对域进行身份验证的受信任机构的数量,钉扎可以减少由于认证机构受损而导致的中间人攻击的发生率。
Status of This Memo
关于下段备忘
This is an Internet Standards Track document.
这是一份互联网标准跟踪文件。
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.
本文件是互联网工程任务组(IETF)的产品。它代表了IETF社区的共识。它已经接受了公众审查,并已被互联网工程指导小组(IESG)批准出版。有关互联网标准的更多信息,请参见RFC 5741第2节。
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc7469.
有关本文件当前状态、任何勘误表以及如何提供反馈的信息,请访问http://www.rfc-editor.org/info/rfc7469.
Copyright Notice
版权公告
Copyright (c) 2015 IETF Trust and the persons identified as the document authors. All rights reserved.
版权所有(c)2015 IETF信托基金和确定为文件作者的人员。版权所有。
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
本文件受BCP 78和IETF信托有关IETF文件的法律规定的约束(http://trustee.ietf.org/license-info)自本文件出版之日起生效。请仔细阅读这些文件,因为它们描述了您对本文件的权利和限制。从本文件中提取的代码组件必须包括信托法律条款第4.e节中所述的简化BSD许可证文本,并提供简化BSD许可证中所述的无担保。
Table of Contents
目录
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1. Requirements Language . . . . . . . . . . . . . . . . . . 5 2. Server and Client Behavior . . . . . . . . . . . . . . . . . 5 2.1. Response Header Field Syntax . . . . . . . . . . . . . . 5 2.1.1. The Pin Directive . . . . . . . . . . . . . . . . . . 6 2.1.2. The max-age Directive . . . . . . . . . . . . . . . . 7 2.1.3. The includeSubDomains Directive . . . . . . . . . . . 7 2.1.4. The report-uri Directive . . . . . . . . . . . . . . 7 2.1.5. Examples . . . . . . . . . . . . . . . . . . . . . . 8 2.2. Server Processing Model . . . . . . . . . . . . . . . . . 9 2.2.1. HTTP-over-Secure-Transport Request Type . . . . . . . 9 2.2.2. HTTP Request Type . . . . . . . . . . . . . . . . . . 9 2.3. User Agent Processing Model . . . . . . . . . . . . . . . 10 2.3.1. Public-Key-Pins Response Header Field Processing . . 10 2.3.2. Interaction of Public-Key-Pins and Public-Key-Pins- Report-Only . . . . . . . . . . . . . . . . . . . . . 11 2.3.3. Noting a Pinned Host - Storage Model . . . . . . . . 11 2.3.4. HTTP-Equiv <Meta> Element Attribute . . . . . . . . . 13 2.4. Semantics of Pins . . . . . . . . . . . . . . . . . . . . 13 2.5. Noting Pins . . . . . . . . . . . . . . . . . . . . . . . 14 2.6. Validating Pinned Connections . . . . . . . . . . . . . . 15 2.7. Interactions with Preloaded Pin Lists . . . . . . . . . . 16 2.8. Pinning Self-Signed End Entities . . . . . . . . . . . . 16 3. Reporting Pin Validation Failure . . . . . . . . . . . . . . 16 4. Security Considerations . . . . . . . . . . . . . . . . . . . 19 4.1. Maximum max-age . . . . . . . . . . . . . . . . . . . . . 19 4.2. Using includeSubDomains Safely . . . . . . . . . . . . . 20 4.3. Backup Pins . . . . . . . . . . . . . . . . . . . . . . . 21 4.4. Interactions With Cookie Scoping . . . . . . . . . . . . 21 4.5. Hostile Pinning . . . . . . . . . . . . . . . . . . . . . 21 5. Privacy Considerations . . . . . . . . . . . . . . . . . . . 22 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 24 7. Usability Considerations . . . . . . . . . . . . . . . . . . 24 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 24 8.1. Normative References . . . . . . . . . . . . . . . . . . 24 8.2. Informative References . . . . . . . . . . . . . . . . . 26 Appendix A. Fingerprint Generation . . . . . . . . . . . . . . . 27 Appendix B. Deployment Guidance . . . . . . . . . . . . . . . . 27 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 28 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 28
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1. Requirements Language . . . . . . . . . . . . . . . . . . 5 2. Server and Client Behavior . . . . . . . . . . . . . . . . . 5 2.1. Response Header Field Syntax . . . . . . . . . . . . . . 5 2.1.1. The Pin Directive . . . . . . . . . . . . . . . . . . 6 2.1.2. The max-age Directive . . . . . . . . . . . . . . . . 7 2.1.3. The includeSubDomains Directive . . . . . . . . . . . 7 2.1.4. The report-uri Directive . . . . . . . . . . . . . . 7 2.1.5. Examples . . . . . . . . . . . . . . . . . . . . . . 8 2.2. Server Processing Model . . . . . . . . . . . . . . . . . 9 2.2.1. HTTP-over-Secure-Transport Request Type . . . . . . . 9 2.2.2. HTTP Request Type . . . . . . . . . . . . . . . . . . 9 2.3. User Agent Processing Model . . . . . . . . . . . . . . . 10 2.3.1. Public-Key-Pins Response Header Field Processing . . 10 2.3.2. Interaction of Public-Key-Pins and Public-Key-Pins- Report-Only . . . . . . . . . . . . . . . . . . . . . 11 2.3.3. Noting a Pinned Host - Storage Model . . . . . . . . 11 2.3.4. HTTP-Equiv <Meta> Element Attribute . . . . . . . . . 13 2.4. Semantics of Pins . . . . . . . . . . . . . . . . . . . . 13 2.5. Noting Pins . . . . . . . . . . . . . . . . . . . . . . . 14 2.6. Validating Pinned Connections . . . . . . . . . . . . . . 15 2.7. Interactions with Preloaded Pin Lists . . . . . . . . . . 16 2.8. Pinning Self-Signed End Entities . . . . . . . . . . . . 16 3. Reporting Pin Validation Failure . . . . . . . . . . . . . . 16 4. Security Considerations . . . . . . . . . . . . . . . . . . . 19 4.1. Maximum max-age . . . . . . . . . . . . . . . . . . . . . 19 4.2. Using includeSubDomains Safely . . . . . . . . . . . . . 20 4.3. Backup Pins . . . . . . . . . . . . . . . . . . . . . . . 21 4.4. Interactions With Cookie Scoping . . . . . . . . . . . . 21 4.5. Hostile Pinning . . . . . . . . . . . . . . . . . . . . . 21 5. Privacy Considerations . . . . . . . . . . . . . . . . . . . 22 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 24 7. Usability Considerations . . . . . . . . . . . . . . . . . . 24 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 24 8.1. Normative References . . . . . . . . . . . . . . . . . . 24 8.2. Informative References . . . . . . . . . . . . . . . . . 26 Appendix A. Fingerprint Generation . . . . . . . . . . . . . . . 27 Appendix B. Deployment Guidance . . . . . . . . . . . . . . . . 27 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 28 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 28
This document defines a new HTTP header that enables UAs to determine which Subject Public Key Info (SPKI) structures will be present in a web host's certificate chain in future Transport Layer Security (TLS) [RFC5246] connections.
本文档定义了一个新的HTTP头,使UAs能够确定在将来的传输层安全性(TLS)[RFC5246]连接中,web主机的证书链中将存在哪些主体公钥信息(SPKI)结构。
Deploying Public Key Pinning (PKP) safely will require operational and organizational maturity due to the risk that hosts may make themselves unavailable by pinning to a set of SPKIs that becomes invalid (see Section 4). With care, host operators can greatly reduce the risk of man-in-the-middle (MITM) attacks and other false-authentication problems for their users without incurring undue risk.
安全部署公钥锁定(PKP)需要操作和组织成熟度,因为主机可能会通过锁定一组无效的SPKI而使自己不可用(请参见第4节)。如果小心,主机运营商可以大大降低中间人(MITM)攻击的风险和用户的其他错误身份验证问题,而不会带来不必要的风险。
PKP is meant to be used together with HTTP Strict Transport Security (HSTS) [RFC6797], but it is possible to pin keys without requiring HSTS.
PKP旨在与HTTP严格传输安全性(HSTS)[RFC6797]一起使用,但可以在不需要HST的情况下锁定密钥。
A Pin is a relationship between a hostname and a cryptographic identity (in this document, one or more of the public keys in a chain of X.509 certificates). Pin Validation is the process a UA performs to ensure that a host is in fact authenticated with its previously established Pin.
Pin是主机名和加密标识(在本文档中,是X.509证书链中的一个或多个公钥)之间的关系。Pin验证是UA执行的过程,以确保主机实际上使用其先前建立的Pin进行身份验证。
Key pinning is a trust-on-first-use (TOFU) mechanism. The first time a UA connects to a host, it lacks the information necessary to perform Pin Validation; UAs can only apply their normal cryptographic identity validation. (In this document, it is assumed that UAs apply X.509 certificate chain validation in accord with [RFC5280].)
密钥固定是一种先用后信任(TOFU)机制。UA第一次连接到主机时,缺少执行Pin验证所需的信息;UAs只能应用其正常的加密身份验证。(在本文件中,假设UAs根据[RFC5280]申请X.509证书链验证。)
The UA will not be able to detect and thwart a MITM attacking the UA's first connection to the host. (However, the requirement that the MITM provide an X.509 certificate chain that can pass the UA's validation requirements, without error, mitigates this risk somewhat.) Worse, such a MITM can inject its own PKP header into the HTTP stream, and pin the UA to its own keys. To avoid post facto detection, the attacker would have to be in a position to intercept all future requests to the host from that UA.
UA将无法检测并阻止攻击UA与主机的第一个连接的MITM。(然而,要求MITM提供一个X.509证书链,该证书链可以无误地通过UA的验证要求,在某种程度上缓解了这一风险。)更糟糕的是,这样的MITM可以将自己的PKP头注入HTTP流,并将UA固定到自己的密钥上。为了避免事后检测,攻击者必须能够拦截该UA未来向主机发出的所有请求。
Thus, key pinning as described in this document is not a perfect defense against MITM attackers capable of passing certificate chain validation procedures -- nothing short of pre-shared keys can be. However, it provides significant value by allowing host operators to limit the number of certification authorities that can vouch for the host's identity, and allows UAs to detect in-process MITM attacks after the initial communication.
因此,本文档中描述的密钥固定并不是针对能够通过证书链验证过程的MITM攻击者的完美防御——除了预共享密钥之外,任何东西都不能。然而,它通过允许主机运营商限制可以证明主机身份的认证机构的数量,并允许UAs在初始通信后检测进程内的MITM攻击,从而提供了巨大的价值。
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119].
本文件中的关键词“必须”、“不得”、“要求”、“应”、“不应”、“应”、“不应”、“建议”、“可”和“可选”应按照RFC 2119[RFC2119]中所述进行解释。
The "Public-Key-Pins" and "Public-Key-Pins-Report-Only" header fields, also referred to within this specification as the PKP and PKP-RO header fields, respectively, are new response headers defined in this specification. They are used by a server to indicate that a UA should perform Pin Validation (Section 2.6) for the host emitting the response message, and to provide the necessary information for the UA to do so.
“公钥管脚”和“公钥管脚仅报告”标题字段(在本规范中分别称为PKP和PKP-RO标题字段)是本规范中定义的新响应标题。服务器使用它们来指示UA应对发出响应消息的主机执行Pin验证(第2.6节),并为UA提供执行此操作所需的信息。
Figure 1 describes the syntax (Augmented Backus-Naur Form) of the header fields, using the grammar defined in [RFC5234] and the rules defined in Section 3.2 of [RFC7230]. The field values of both header fields conform to the same rules.
图1使用[RFC5234]中定义的语法和[RFC7230]第3.2节中定义的规则描述了标题字段的语法(扩展的Backus Naur形式)。两个标题字段的字段值符合相同的规则。
Public-Key-Directives = directive *( OWS ";" OWS directive )
Public-Key-Directives = directive *( OWS ";" OWS directive )
directive = directive-name [ "=" directive-value ] directive-name = token directive-value = token / quoted-string
指令=指令名称[“=”指令值]指令名称=令牌指令值=令牌/带引号的字符串
Figure 1: HPKP Header Syntax
图1:HPKP头语法
Optional white space (OWS) is used as defined in Section 3.2.3 of [RFC7230]. token and quoted-string are used as defined in Section 3.2.6 of [RFC7230].
按照[RFC7230]第3.2.3节的定义使用可选空白(OWS)。按照[RFC7230]第3.2.6节的定义使用标记和带引号的字符串。
The directives defined in this specification are described below. The overall requirements for directives are:
本规范中定义的指令如下所述。指令的总体要求如下:
1. The order of appearance of directives is not significant.
1. 指令的出现顺序并不重要。
2. With the exception of pin-directives with the same pin-directive-name (see below), a given directive MUST NOT appear more than once in a given header field. Directives are either optional or required, as stipulated in their definitions.
2. 除了具有相同pin指令名称的pin指令(见下文)外,给定指令在给定标题字段中不得出现多次。指令可以是可选的,也可以是必需的,正如它们的定义中所规定的那样。
3. Directive names are case insensitive.
3. 指令名称不区分大小写。
4. UAs MUST ignore any header fields containing directives, or other header field value data, that do not conform to the syntax defined in this specification. In particular, UAs must not attempt to fix malformed header fields.
4. UAs必须忽略任何包含指令的标题字段,或不符合本规范中定义语法的其他标题字段值数据。特别是,UAs不得尝试修复格式错误的标头字段。
5. If a header field contains any directive(s) the UA does not recognize, the UA MUST ignore those directives.
5. 如果标头字段包含UA无法识别的任何指令,UA必须忽略这些指令。
6. If the PKP or PKP-RO header field otherwise satisfies the above requirements (1 through 5), the UA MUST process the directives it recognizes.
6. 如果PKP或PKP-RO标题字段满足上述要求(1至5),UA必须处理其识别的指令。
Additional directives extending the semantic functionality of the header fields can be defined in other specifications. The first such specification will need to define a registry for such directives. Such future directives will be ignored by UAs implementing only this specification, as well as by generally non-conforming UAs.
扩展头字段语义功能的其他指令可以在其他规范中定义。第一个这样的规范将需要为这样的指令定义一个注册表。仅执行本规范的UAs以及通常不符合本规范的UAs将忽略此类未来指令。
When a connection passes Pin Validation using the UA's noted Pins for the host at the time, the host becomes a Known Pinned Host.
当连接使用UA当时为主机记录的管脚通过管脚验证时,主机将成为已知的管脚主机。
The pin directive specifies a way for web host operators to indicate a cryptographic identity that should be bound to a given web host. The syntax of a pin directive is as follows:
pin指令指定web主机操作员指示应绑定到给定web主机的加密标识的方式。pin指令的语法如下所示:
pin-directive = pin-directive-name "=" pin-directive-value
pin指令=pin指令名称“=”pin指令值
pin-directive-name = "pin-" token pin-directive-value = quoted-string
pin指令名称=“pin-”令牌pin指令值=带引号的字符串
Figure 2: Pin Directive Syntax
图2:Pin指令语法
In the pin-directive, the token is the name of a cryptographic hash algorithm. The only algorithm allowed at this time is "sha256", i.e., the hash algorithm SHA256 [RFC6234]; additional algorithms may be allowed for use in this context in the future. The quoted-string is a sequence of base 64 digits: the base64-encoded SPKI Fingerprint [RFC4648] (see Section 2.4).
在pin指令中,令牌是加密哈希算法的名称。此时唯一允许的算法是“sha256”,即哈希算法sha256[RFC6234];将来可能允许在这种情况下使用其他算法。带引号的字符串是一个以64位为基数的序列:base64编码的SPKI指纹[RFC4648](参见第2.4节)。
According to the processing rules of Section 2.1, the UA MUST ignore pin-directives with tokens naming hash algorithms it does not recognize. If the set of remaining effective pin-directives is empty, and if the host is a Known Pinned Host, the UA MUST cease to consider the host as a Known Pinned Host (the UA should fail open). The UA should indicate to users that the host is no longer a Known Pinned Host.
根据第2.1节的处理规则,UA必须忽略pin指令以及它无法识别的标记命名哈希算法。如果剩余的有效PIN指令的集合是空的,并且如果主机是已知的固定主机,则UA必须停止将主机视为已知的固定主机(UA应该打开失败)。UA应向用户指示主机不再是已知的固定主机。
Note, per the processing rules of Section 2.1, the pin-directive-name is case insensitive.
注意,根据第2.1节的处理规则,pin指令名称不区分大小写。
The "max-age" directive specifies the number of seconds after the reception of the PKP header field during which the UA SHOULD regard the host (from whom the message was received) as a Known Pinned Host.
“max age”指令指定收到PKP报头字段后的秒数,在此期间UA应将主机(接收消息的主机)视为已知的固定主机。
The "max-age" directive is REQUIRED to be present within a "Public-Key-Pins" header field. The "max-age" directive is meaningless within a "Public-Key-Pins-Report-Only" header field, and UAs MUST ignore it and not cache the header. See Section 2.3.3.
“max age”指令必须出现在“Public Key Pins”标题字段中。“max age”指令在“Public Key Pins Report Only”头字段中没有意义,UAs必须忽略它,而不是缓存头。见第2.3.3节。
The max-age directive is REQUIRED to have a directive value, for which the syntax (after quoted-string unescaping, if necessary) is defined as:
max age指令需要有一个指令值,该指令值的语法(如有必要,在带引号的字符串取消跳过后)定义为:
max-age-value = delta-seconds delta-seconds = 1*DIGIT
最大年龄值=增量秒增量秒=1*位
Figure 3: max-age Value Syntax
图3:最大年龄值语法
delta-seconds is used as defined in [RFC7234], Section 1.2.1.
增量秒的使用如[RFC7234]第1.2.1节所定义。
See Section 2.3.3 for limitations on the range of values for max-age.
有关最大年龄值范围的限制,请参见第2.3.3节。
The OPTIONAL includeSubDomains directive is a valueless directive that, if present (i.e., it is "asserted"), signals to the UA that the Pinning Policy applies to this Pinned Host as well as any subdomains of the host's domain name.
可选的includeSubDomains指令是一个无值指令,如果存在(即,它是“断言的”),则向UA发出信号,表明固定策略适用于该固定主机以及主机域名的任何子域。
The OPTIONAL report-uri directive indicates the URI to which the UA SHOULD report Pin Validation failures (Section 2.6). The UA POSTs the reports to the given URI as described in Section 3.
可选报告uri指令指示UA应向其报告Pin验证失败的uri(第2.6节)。UA将报告发布到第3节中描述的给定URI。
When used in the PKP or PKP-RO headers, the presence of a report-uri directive indicates to the UA that in the event of Pin Validation failure it SHOULD POST a report to the report-uri. If the header is Public-Key-Pins, the UA should do this in addition to terminating the connection (as described in Section 2.6).
在PKP或PKP-RO标头中使用时,报告uri指令的存在向UA表明,如果Pin验证失败,UA应向报告uri发布报告。如果报头是公钥管脚,UA除了终止连接外还应这样做(如第2.6节所述)。
Hosts may set report-uris that use HTTP or HTTPS. If the scheme in the report-uri is one that uses TLS (e.g., HTTPS), UAs MUST perform Pinning Validation when the host in the report-uri is a Known Pinned Host; similarly, UAs MUST apply HSTS if the host in the report-uri is a Known HSTS Host.
主机可以设置使用HTTP或HTTPS的报告URI。如果报告uri中的方案是使用TLS(例如HTTPS)的方案,则当报告uri中的主机是已知的固定主机时,UAs必须执行固定验证;同样,如果报告uri中的主机是已知的HSTS主机,UAs必须应用HSTS。
Note that the report-uri need not necessarily be in the same Internet domain or web origin as the host being reported about.
请注意,报告uri不必与报告的主机位于相同的Internet域或web源中。
UAs SHOULD make their best effort to report Pin Validation failures to the report-uri, but they may fail to report in exceptional conditions. For example, if connecting the report-uri itself incurs a Pinning Validation failure or other certificate validation failure, the UA MUST cancel the connection. Similarly, if Known Pinned Host A sets a report-uri referring to Known Pinned Host B, and if B sets a report-uri referring to A, and if both hosts fail Pin Validation, the UA SHOULD detect and break the loop by failing to send reports to and about those hosts.
UAs应尽最大努力向报告uri报告Pin验证失败,但在异常情况下可能无法报告。例如,如果连接报表uri本身导致固定验证失败或其他证书验证失败,UA必须取消连接。类似地,如果已知固定主机A设置了一个引用已知固定主机B的报告uri,如果B设置了一个引用A的报告uri,并且如果两个主机的Pin验证都失败,UA应该通过向这些主机发送报告失败来检测并中断循环。
In any case of report failure, the UA MAY attempt to re-send the report later.
在任何报告失败的情况下,UA可尝试稍后重新发送报告。
UAs SHOULD limit the rate at which they send reports. For example, it is unnecessary to send the same report to the same report-uri more than once per distinct set of declared Pins.
UAs应限制其发送报告的速率。例如,对于每个不同的声明管脚集,不必多次将同一报告发送到同一报告uri。
Figure 4 shows some example PKP and PKP-RO response header fields. (Lines are folded to fit.)
图4显示了一些PKP和PKP-RO响应头字段示例。(将线折叠以适合。)
Public-Key-Pins: max-age=3000; pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="
Public-Key-Pins: max-age=3000; pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="
Public-Key-Pins: max-age=2592000; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="
Public-Key-Pins: max-age=2592000; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="
Public-Key-Pins: max-age=2592000; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; report-uri="http://example.com/pkp-report"
Public-Key-Pins: max-age=2592000; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; report-uri="http://example.com/pkp-report"
Public-Key-Pins-Report-Only: max-age=2592000; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; report-uri="https://other.example.net/pkp-report"
Public-Key-Pins-Report-Only: max-age=2592000; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; report-uri="https://other.example.net/pkp-report"
Public-Key-Pins: pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; max-age=259200
Public-Key-Pins: pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; max-age=259200
Public-Key-Pins: pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; max-age=10000; includeSubDomains
Public-Key-Pins: pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; max-age=10000; includeSubDomains
Figure 4: HTTP Public Key Pinning (HPKP) Header Examples
图4:HTTP公钥固定(HPKP)头示例
This section describes the processing model that Pinned Hosts implement. The model has 2 parts: (1) the processing rules for HTTP request messages received over a secure transport (e.g., authenticated, non-anonymous TLS); and (2) the processing rules for HTTP request messages received over non-secure transports, such as TCP.
本节介绍固定主机实现的处理模型。该模型包括两部分:(1)通过安全传输(例如,经过身份验证的非匿名TLS)接收的HTTP请求消息的处理规则;以及(2)通过非安全传输(如TCP)接收的HTTP请求消息的处理规则。
When replying to an HTTP request that was conveyed over a secure transport, a Pinned Host SHOULD include in its response exactly one PKP header field, exactly one PKP-RO header field, or one of each. Each instance of either header field MUST satisfy the grammar specified in Section 2.1.
当响应通过安全传输传输传输的HTTP请求时,固定主机的响应中应仅包含一个PKP头字段、一个PKP-RO头字段或每个字段中的一个。任一标题字段的每个实例都必须满足第2.1节中指定的语法。
Establishing a given host as a Known Pinned Host, in the context of a given UA, is accomplished as follows:
在给定UA的上下文中,将给定主机建立为已知固定主机的过程如下:
1. Over the HTTP protocol running over secure transport, by correctly returning (per this specification) at least one valid PKP header field to the UA.
1. 通过在安全传输上运行的HTTP协议,通过(根据本规范)向UA正确返回至少一个有效的PKP头字段。
2. Through other mechanisms, such as a client-side preloaded Known Pinned Host List.
2. 通过其他机制,例如客户端预加载已知的固定主机列表。
Pinned Hosts SHOULD NOT include the PKP header field in HTTP responses conveyed over non-secure transport. UAs MUST ignore any PKP header received in an HTTP response conveyed over non-secure transport.
固定主机不应在通过非安全传输传输的HTTP响应中包含PKP标头字段。UAs必须忽略通过非安全传输传输的HTTP响应中接收到的任何PKP头。
The UA processing model relies on parsing domain names. Note that internationalized domain names SHALL be canonicalized according to the scheme in Section 10 of [RFC6797].
UA处理模型依赖于解析域名。请注意,应根据[RFC6797]第10节中的方案规范化国际化域名。
If the UA receives, over a secure transport, an HTTP response that includes a PKP header field conforming to the grammar specified in Section 2.1, and there are no underlying secure transport errors or warnings (see Section 2.5), the UA MUST either:
如果UA通过安全传输接收到HTTP响应,该响应包含符合第2.1节规定语法的PKP头字段,并且没有潜在的安全传输错误或警告(参见第2.5节),UA必须:
o Note the host as a Known Pinned Host if it is not already so noted (see Section 2.3.3),
o 如果尚未如此标注,则将主机标注为已知固定主机(参见第2.3.3节),
or,
或
o Update the UA's cached information for the Known Pinned Host if any of the max-age, includeSubDomains, or report-uri header field value directives convey information different from that already maintained by the UA.
o 如果任何max-age、includeSubDomains或report-uri头字段值指令传递的信息与UA已经维护的信息不同,则更新UA对已知固定主机的缓存信息。
The max-age value is essentially a "time to live" value relative to the time of the most recent observation of the PKP header field. If the max-age header field value token has a value of 0, the UA MUST remove its cached Pinning Policy information (including the includeSubDomains directive, if asserted) if the Pinned Host is Known, or, MUST NOT note this Pinned Host if it is not yet Known.
“最大年龄”值本质上是相对于PKP标头字段最近一次观察的时间的“生存时间”值。如果max age标头字段值令牌的值为0,则UA必须在锁定主机已知的情况下删除其缓存的锁定策略信息(如果断言,则包括includeSubDomains指令),或者,如果尚未知道该锁定主机,则不必记下该锁定主机。
If a UA receives more than one PKP header field or more than one PKP-RO header field in an HTTP response message over secure transport, then the UA MUST process only the first PKP header field (if present) and only the first PKP-RO header field (if present).
如果UA通过安全传输在HTTP响应消息中接收到多个PKP标头字段或多个PKP-RO标头字段,则UA必须仅处理第一个PKP标头字段(如果存在)和第一个PKP-RO标头字段(如果存在)。
If the UA receives the HTTP response over insecure transport, or if the PKP header is not a Valid Pinning Header (see Section 2.5), the UA MUST ignore any present PKP header field(s). Similarly, if the UA receives the HTTP response over insecure transport, the UA MUST ignore any present PKP-RO header field(s). The UA MUST ignore any PKP or PKP-RO header fields not conforming to the grammar specified in Section 2.1.
如果UA通过不安全的传输接收HTTP响应,或者如果PKP头不是有效的固定头(参见第2.5节),UA必须忽略任何现有的PKP头字段。类似地,如果UA通过不安全的传输接收HTTP响应,则UA必须忽略任何现有的PKP-RO头字段。UA必须忽略任何不符合第2.1节规定语法的PKP或PKP-RO标题字段。
A server MAY set both the "Public-Key-Pins" and "Public-Key-Pins-Report-Only" headers simultaneously. The headers do not interact with one another, but the UA MUST process the PKP header and SHOULD process both.
服务器可以同时设置“公钥PIN”和“仅报告公钥PIN”头。报头彼此不交互,但UA必须处理PKP报头,并且应该同时处理这两个报头。
The headers are processed according to Section 2.3.1.
根据第2.3.1节处理标题。
When the PKP-RO header is used with a report-uri, the UA SHOULD POST reports for Pin Validation failures to the indicated report-uri, although the UA MUST NOT enforce Pin Validation. That is, in the event of Pin Validation failure when the host has set the PKP-RO header, the UA performs Pin Validation to check whether or not it should POST a report, but not whether it should cause a connection failure.
当PKP-RO标头与报告uri一起使用时,UA应将Pin验证失败的报告发布到指定的报告uri,尽管UA不得强制Pin验证。也就是说,如果主机设置了PKP-RO头,Pin验证失败,UA将执行Pin验证,以检查是否应发布报告,但不检查是否应导致连接失败。
Note: There is no purpose to using the PKP-RO header without the report-uri directive. User Agents MAY discard such headers without interpreting them further.
注意:如果没有report-uri指令,那么使用PKP-RO头是没有意义的。用户代理可以丢弃这些头,而不进一步解释它们。
When the PKP header is used with a report-uri, the UA SHOULD POST reports for Pin Validation failures to the indicated report-uri, as well as enforce Pin Validation.
当PKP头与报告uri一起使用时,UA应将Pin验证失败的报告发布到指定的报告uri,并强制执行Pin验证。
If a host sets the PKP-RO header, the UA SHOULD note the Pins and directives given in the PKP-RO header, ignoring any max-age directive. If the UA does note the Pins and directives in the PKP-RO header, it SHOULD evaluate the specified policy and SHOULD report any would-be Pin Validation failures that would occur if the report-only policy were enforced.
如果主机设置PKP-RO标头,UA应注意PKP-RO标头中给出的引脚和指令,忽略任何max age指令。如果UA确实注意到PKP-RO标头中的Pin和指令,则应评估指定的策略,并应报告在强制执行仅报告策略时可能发生的任何Pin验证失败。
If a host sets both the PKP header and the PKP-RO header, the UA MUST note and enforce Pin Validation as specified by the PKP header, and SHOULD process the Pins and directives given in the PKP-RO header. If the UA does process the Pins and directives in the PKP-RO header, it SHOULD evaluate the specified policy and SHOULD report any would-be Pin Validation failures that would occur if the report-only policy were enforced.
如果主机同时设置PKP标头和PKP-RO标头,UA必须按照PKP标头的规定注意并执行Pin验证,并应处理PKP-RO标头中给出的Pin和指令。如果UA确实处理PKP-RO标头中的Pin和指令,则其应评估指定的策略,并应报告在强制执行仅报告策略时可能发生的任何Pin验证失败。
The Effective Pin Date of a Known Pinned Host is the time that the UA observed a Valid Pinning Header for the host. The Effective Expiration Date of a Known Pinned Host is the Effective Pin Date plus the max-age. A Known Pinned Host is "expired" if the Effective Expiration Date refers to a date in the past. The UA MUST ignore any expired Known Pinned Hosts in its cache.
已知固定主机的有效Pin日期是UA观察到该主机的有效固定标头的时间。已知锁定主机的有效过期日期为有效锁定日期加上最大期限。如果有效过期日期指的是过去的日期,则已知固定主机已“过期”。UA必须忽略其缓存中任何过期的已知固定主机。
For example, if a UA is beginning to perform Pin Validation for a Known Pinned Host and finds that the cached pinning information for the host indicates an Effective Expiration Date in the past, the UA MUST NOT continue with Pin Validation for the host, and MUST consider the host to no longer be a Known Pinned Host.
例如,如果UA开始对已知的已锁定主机执行PIN验证,并且发现主机的缓存钉扎信息指示过去有效的过期日期,则UA不必继续对主机进行PIN验证,并且必须考虑主机不再是已知的被钉扎主机。
Known Pinned Hosts are identified only by domain names, and never IP addresses. If the substring matching the host production from the Request-URI (of the message to which the host responded) syntactically matches the IP-literal or IPv4address productions from Section 3.2.2 of [RFC3986], then the UA MUST NOT note this host as a Known Pinned Host.
已知的固定主机只能通过域名识别,而不能通过IP地址识别。如果与(主机响应的消息的)请求URI中的主机产品相匹配的子字符串在语法上与[RFC3986]第3.2.2节中的IP文本或IPv4address产品相匹配,则UA不得将该主机视为已知的固定主机。
Otherwise, if the substring does not congruently match an existing Known Pinned Host's domain name, per the matching procedure specified in Section 8.2 of [RFC6797], then the UA MUST add this host to the Known Pinned Host cache. The UA caches:
否则,根据[RFC6797]第8.2节中规定的匹配过程,如果子字符串与现有已知固定主机的域名不一致,则UA必须将该主机添加到已知固定主机缓存中。UA缓存:
o the Pinned Host's domain name,
o 锁定主机的域名,
o the Effective Expiration Date, or enough information to calculate it (the Effective Pin Date and the value of the max-age directive),
o 有效失效日期,或计算有效失效日期的足够信息(有效Pin日期和max age指令的值),
o whether or not the includeSubDomains directive is asserted, and
o 是否断言includeSubDomains指令,以及
o the value of the report-uri directive, if present.
o 报告uri指令的值(如果存在)。
If any other metadata from optional or future PKP header directives are present in the Valid Pinning Header, and the UA understands them, the UA MAY note them as well.
如果来自可选或未来PKP头指令的任何其他元数据存在于有效的固定头中,并且UA理解这些元数据,则UA也可以记录它们。
UAs MAY set an upper limit on the value of max-age, so that UAs that have noted erroneous Pins (whether by accident or due to attack) have some chance of recovering over time. If the server sets a max-age greater than the UA's upper limit, the UA MAY behave as if the server set the max-age to the UA's upper limit. For example, if the UA caps max-age at 5,184,000 seconds (60 days), and a Pinned Host sets a max-age directive of 90 days in its Valid Pinning Header, the UA MAY behave as if the max-age were effectively 60 days. (One way to achieve this behavior is for the UA to simply store a value of 60 days instead of the 90-day value provided by the Pinned Host.) For UA implementation guidance on how to select a maximum max-age, see Section 4.1.
UAs可能会对“最大年龄”的值设置一个上限,以便注意到错误PIN(无论是意外还是由于攻击)的UAs有一定的恢复机会。如果服务器设置的最大使用年限大于UA的上限,UA可能会表现为服务器将最大使用年限设置为UA的上限。例如,如果UA将最大使用期限限制为5184000秒(60天),并且固定主机在其有效固定标头中设置了90天的最大使用期限指令,则UA可能会表现为最大使用期限实际上为60天。(实现此行为的一种方法是UA仅存储60天的值,而不是由固定主机提供的90天值。)有关如何选择最大年龄的UA实施指南,请参阅第4.1节。
The UA MUST NOT modify any pinning metadata of any superdomain matched Known Pinned Host.
UA不得修改任何与已知固定主机匹配的超域的任何固定元数据。
The UA MUST NOT cache information derived from a PKP-RO header. (PKP-RO headers are useful only at the time of receipt and processing.)
UA不得缓存来自PKP-RO头的信息。(PKP-RO标题仅在接收和处理时有用。)
UAs MUST NOT heed http-equiv="Public-Key-Pins" or http-equiv="Public-Key-Pins-Report-Only" attribute settings on <meta> elements [W3C.REC-html401-19991224] in received content.
UAs不得关注所接收内容中<meta>元素[W3C.REC-html401-19991224]上的http equiv=“Public Key Pins”或http equiv=“Public Key Pins Report Only”属性设置。
An SPKI Fingerprint is defined as the output of a known cryptographic hash algorithm whose input is the DER-encoded ASN.1 representation of the Subject Public Key Info (SPKI) of an X.509 certificate. A Pin is defined as the combination of the known algorithm identifier and the SPKI Fingerprint computed using that algorithm.
SPKI指纹定义为已知加密哈希算法的输出,其输入是X.509证书的主体公钥信息(SPKI)的DER编码ASN.1表示。Pin定义为已知算法标识符和使用该算法计算的SPKI指纹的组合。
The SPKI Fingerprint is encoded in base 64 for use in an HTTP header [RFC4648].
SPKI指纹在base 64中编码,用于HTTP头[RFC4648]。
In this version of the specification, the known cryptographic hash algorithm is SHA-256, identified as "sha256" [RFC6234]. (Future specifications may add new algorithms and deprecate old ones.) UAs MUST ignore Pins for which they do not recognize the algorithm identifier. UAs MUST continue to process the rest of a PKP response header field and note Pins for algorithms they do recognize.
在此版本的规范中,已知的加密哈希算法是SHA-256,标识为“sha256”[RFC6234]。(未来的规范可能会添加新的算法,而不推荐旧的算法。)UAs必须忽略其无法识别算法标识符的管脚。UAs必须继续处理PKP响应头字段的其余部分,并注意它们识别的算法的引脚。
Figure 5 reproduces the definition of the SubjectPublicKeyInfo structure in [RFC5280].
图5重现了[RFC5280]中SubjectPublicKeyInfo结构的定义。
SubjectPublicKeyInfo ::= SEQUENCE { algorithm AlgorithmIdentifier, subjectPublicKey BIT STRING }
SubjectPublicKeyInfo ::= SEQUENCE { algorithm AlgorithmIdentifier, subjectPublicKey BIT STRING }
AlgorithmIdentifier ::= SEQUENCE { algorithm OBJECT IDENTIFIER, parameters ANY DEFINED BY algorithm OPTIONAL }
AlgorithmIdentifier ::= SEQUENCE { algorithm OBJECT IDENTIFIER, parameters ANY DEFINED BY algorithm OPTIONAL }
Figure 5: SPKI Definition
图5:SPKI定义
If the certificate's Subject Public Key Info is incomplete when taken in isolation, such as when holding a DSA key without domain parameters, a public key pin cannot be formed.
如果证书的使用者公钥信息在隔离时不完整,例如在持有没有域参数的DSA密钥时,则无法形成公钥pin。
We pin public keys, rather than entire certificates, to enable operators to generate new certificates containing old public keys (see [why-pin-key]).
我们锁定公钥,而不是整个证书,以使操作员能够生成包含旧公钥的新证书(请参见[为什么锁定密钥])。
See Appendix A for an example non-normative program that generates SPKI Fingerprints from certificates.
有关从证书生成SPKI指纹的示例非规范程序,请参见附录A。
Upon receipt of the PKP response header field, the UA notes the host as a Known Pinned Host, storing the Pins and their associated directives in non-volatile storage (for example, along with the HSTS metadata). The Pins and their associated directives are collectively known as Pinning Metadata.
收到PKP响应头字段后,UA将主机记录为已知的固定主机,将这些固定及其相关指令存储在非易失性存储器中(例如,与HSTS元数据一起)。pin及其相关指令统称为Pinning元数据。
The UA MUST note the Pins for a Host if and only if all three of the following conditions hold:
当且仅当以下三种条件均成立时,UA必须注意主机的引脚:
o It received the PKP response header field over an error-free TLS connection. If the host is a Pinned Host, this includes the validation added in Section 2.6.
o 它通过无错误的TLS连接接收PKP响应头字段。如果主机是固定主机,这包括第2.6节中添加的验证。
o The TLS connection was authenticated with a certificate chain containing at least one of the SPKI structures indicated by at least one of the given SPKI Fingerprints (see Section 2.6).
o TLS连接通过包含至少一个给定SPKI指纹指示的至少一个SPKI结构的证书链进行身份验证(见第2.6节)。
o The given set of Pins contains at least one Pin that does NOT refer to an SPKI in the certificate chain. (That is, the host must set a Backup Pin; see Section 4.3.)
o 给定的管脚集至少包含一个不引用证书链中SPKI的管脚。(也就是说,主机必须设置备份Pin;请参阅第4.3节。)
If the PKP response header field does not meet all three of these criteria, the UA MUST NOT note the host as a Pinned Host. A PKP response header field that meets all these criteria is known as a Valid Pinning Header.
如果PKP响应头字段不符合上述三个标准,UA不得将主机记录为固定主机。满足所有这些条件的PKP响应标头字段称为有效的固定标头。
Whenever a UA receives a Valid Pinning Header, it MUST set its Pinning Metadata to the exact Pins, Effective Expiration Date (computed from max-age), and (if any) report-uri given in the most recently received Valid Pinning Header.
每当UA收到有效的固定标头时,它必须将其固定元数据设置为最近收到的有效固定标头中给出的确切PIN、有效过期日期(从最大期限计算)和(如果有)报告uri。
For forward compatibility, the UA MUST ignore any unrecognized PKP and PKP-RO header directives, while still processing those directives it does recognize. Section 2.1 specifies the directives max-age, Pins, includeSubDomains, and report-uri, but future specifications and implementations might use additional directives.
为了实现前向兼容性,UA必须忽略任何未识别的PKP和PKP-RO头指令,同时仍处理其识别的指令。第2.1节指定了指令max-age、Pins、includeSubDomains和report-uri,但未来的规范和实现可能会使用其他指令。
Upon receipt of a PKP-RO response header field, the UA SHOULD evaluate the policy expressed in the field, and SHOULD generate and send a report (see Section 3). However, failure to validate the Pins in the field MUST have no effect on the validity or non-validity of the policy expressed in the PKP field or in previously noted Pins for the Known Pinned Host.
收到PKP-RO响应标题字段后,UA应评估该字段中表达的政策,并生成并发送报告(见第3节)。但是,未能验证该字段中的PIN不得影响PKP字段或已知已锁定主机的先前注意到的PIN中表示的策略的有效性或无效性。
The UA need not note any Pins or other policy expressed in the PKP-RO response header field, except for the purpose of determining that it has already sent a report for a given policy. UAs SHOULD make a best effort not to inundate report-uris with redundant reports.
UA无需注意PKP-RO响应标头字段中表示的任何PIN或其他策略,除非确定其已发送给定策略的报告。UAs应尽最大努力避免用冗余报告淹没报告URI。
When a UA connects to a Pinned Host using a TLS connection, if the TLS connection has errors, the UA MUST terminate the connection without allowing the user to proceed anyway. (This behavior is the same as that required by [RFC6797].)
当UA使用TLS连接连接到固定主机时,如果TLS连接有错误,UA必须终止连接,而不允许用户继续。(此行为与[RFC6797]要求的行为相同。)
If the connection has no errors, then the UA will determine whether to apply a new, additional correctness check: Pin Validation. A UA SHOULD perform Pin Validation whenever connecting to a Known Pinned Host, as soon as possible (e.g., immediately after receiving the Server Certificate message). It is acceptable to allow Pin Validation to be disabled for some Hosts according to local policy. For example, a UA may disable Pin Validation for Pinned Hosts whose validated certificate chain terminates at a user-defined trust anchor, rather than a trust anchor built-in to the UA (or underlying platform).
如果连接没有错误,UA将决定是否应用新的附加正确性检查:Pin验证。UA应在连接到已知固定主机时尽快(例如,在收到服务器证书消息后立即)执行Pin验证。允许根据本地策略对某些主机禁用Pin验证是可以接受的。例如,UA可能会禁用锁定主机的Pin验证,这些主机的验证证书链终止于用户定义的信任锚点,而不是UA(或基础平台)内置的信任锚点。
To perform Pin Validation, the UA will compute the SPKI Fingerprints for each certificate in the Pinned Host's validated certificate chain, using each supported hash algorithm for each certificate. (As described in Section 2.4, certificates whose SPKI cannot be taken in isolation cannot be pinned.) The UA MUST ignore superfluous certificates in the chain that do not form part of the validating chain. The UA will then check that the set of these SPKI Fingerprints intersects the set of SPKI Fingerprints in that Pinned Host's Pinning Metadata. If there is set intersection, the UA continues with the connection as normal. Otherwise, the UA MUST treat this Pin Validation failure as a non-recoverable error. Any procedure that matches the results of this Pin Validation procedure is considered equivalent.
要执行Pin验证,UA将使用每个证书支持的哈希算法,计算固定主机的已验证证书链中每个证书的SPKI指纹。(如第2.4节所述,不能锁定SPKI不能单独获取的证书。)UA必须忽略链中不构成验证链一部分的多余证书。UA随后将检查这些SPKI指纹集是否与该固定主机的固定元数据中的SPKI指纹集相交。如果设置了交叉点,UA将继续正常连接。否则,UA必须将此Pin验证失败视为不可恢复的错误。任何与此Pin验证程序结果相匹配的程序都被视为等效程序。
A UA that has previously noted a host as a Known Pinned Host MUST perform Pin Validation when setting up the TLS session, before beginning an HTTP conversation over the TLS channel.
先前将主机标记为已知固定主机的UA必须在设置TLS会话时执行Pin验证,然后才能通过TLS通道开始HTTP对话。
UAs send validation failure reports only when Pin Validation is actually in effect. Pin Validation might not be in effect, e.g., because the user has elected to disable it, or because a presented certificate chain chains up to a user-defined trust anchor. In such cases, UAs SHOULD NOT send reports.
UAs仅在Pin验证实际生效时发送验证失败报告。Pin验证可能无效,例如,因为用户选择禁用Pin验证,或者因为提供的证书链链接到用户定义的信任锚点。在这种情况下,UAs不应发送报告。
UAs MAY choose to implement additional sources of pinning information, such as through built-in lists of pinning information. Such UAs should allow users to override such additional sources, including disabling them from consideration.
UAs可以选择实现附加的固定信息源,例如通过固定信息的内置列表。此类UAs应允许用户覆盖此类附加源,包括禁用它们。
The effective policy for a Known Pinned Host that has both built-in Pins and Pins from previously observed PKP header response fields is implementation-defined.
对于既有内置管脚又有来自先前观察到的PKP头响应字段的管脚的已知固定主机,有效的策略是实现定义的。
If UAs accept hosts that authenticate themselves with self-signed end entity certificates, they MAY also allow hosts to pin the public keys in such certificates. The usability and security implications of this practice are outside the scope of this specification.
如果UAs接受使用自签名终端实体证书对自己进行身份验证的主机,则它们还可能允许主机将公钥固定在此类证书中。此实践的可用性和安全性影响不在本规范的范围内。
When a Known Pinned Host has set the report-uri directive, the UA SHOULD report Pin Validation failures to the indicated URI. The UA does this by POSTing a JSON [RFC7159] message to the URI; the JSON message takes this form:
当已知的固定主机设置了report-uri指令时,UA应该向指示的uri报告Pin验证失败。UA通过向URI发布JSON[RFC7159]消息来实现这一点;JSON消息采用以下形式:
{ "date-time": date-time, "hostname": hostname, "port": port, "effective-expiration-date": expiration-date, "include-subdomains": include-subdomains, "noted-hostname": noted-hostname, "served-certificate-chain": [ pem1, ... pemN ], "validated-certificate-chain": [ pem1, ... pemN ], "known-pins": [ known-pin1, ... known-pinN ] }
{ "date-time": date-time, "hostname": hostname, "port": port, "effective-expiration-date": expiration-date, "include-subdomains": include-subdomains, "noted-hostname": noted-hostname, "served-certificate-chain": [ pem1, ... pemN ], "validated-certificate-chain": [ pem1, ... pemN ], "known-pins": [ known-pin1, ... known-pinN ] }
Figure 6: JSON Report Format
图6:JSON报告格式
Whitespace outside of quoted strings is not significant. The key/ value pairs may appear in any order, but each MUST appear only once.
带引号的字符串之外的空白不重要。键/值对可以以任何顺序出现,但每个只能出现一次。
The date-time indicates the time the UA observed the Pin Validation failure. It is provided as a string formatted according to Section 5.6, "Internet Date/Time Format", of [RFC3339].
日期时间表示UA观察到Pin验证失败的时间。它是根据[RFC3339]第5.6节“互联网日期/时间格式”以字符串形式提供的。
The hostname is the hostname to which the UA made the original request that failed Pin Validation. It is provided as a string.
主机名是UA发出原始请求但未通过Pin验证的主机名。它作为字符串提供。
The port is the port to which the UA made the original request that failed Pin Validation. It is provided as an integer.
端口是UA向其发出原始请求但未通过Pin验证的端口。它以整数形式提供。
The effective-expiration-date is the Effective Expiration Date for the noted Pins. It is provided as a string formatted according to Section 5.6, "Internet Date/Time Format", of [RFC3339].
有效失效日期是所注PIN的有效失效日期。它是根据[RFC3339]第5.6节“互联网日期/时间格式”以字符串形式提供的。
include-subdomains indicates whether or not the UA has noted the includeSubDomains directive for the Known Pinned Host. It is provided as one of the JSON identifiers "true" or "false".
include subdomains表示UA是否已注意到已知固定主机的includeSubDomains指令。它作为JSON标识符“true”或“false”之一提供。
noted-hostname indicates the hostname that the UA noted when it noted the Known Pinned Host. This field allows operators to understand why Pin Validation was performed for, e.g., foo.example.com when the noted Known Pinned Host was example.com with includeSubDomains set.
noted hostname表示UA在注意到已知固定主机时注意到的主机名。通过此字段,操作员可以了解为什么在已设置includeSubDomains的已知固定主机为example.com时对例如foo.example.com执行Pin验证。
The served-certificate-chain is the certificate chain, as served by the Known Pinned Host during TLS session setup. It is provided as an array of strings; each string pem1, ... pemN is the Privacy-Enhanced Mail (PEM) representation of each X.509 certificate as described in [RFC7468].
服务的证书链是证书链,在TLS会话设置期间由已知的固定主机提供服务。它以字符串数组的形式提供;每串pem1。。。pemN是[RFC7468]中描述的每个X.509证书的隐私增强邮件(PEM)表示。
The validated-certificate-chain is the certificate chain, as constructed by the UA during certificate chain verification. (This may differ from the served-certificate-chain.) It is provided as an array of strings; each string pem1, ... pemN is the PEM representation of each X.509 certificate as described in [RFC7468]. UAs that build certificate chains in more than one way during the validation process SHOULD send the last chain built. In this way, they can avoid keeping too much state during the validation process.
经验证的证书链是由UA在证书链验证期间构建的证书链。(这可能不同于服务的证书链。)它作为字符串数组提供;每串pem1。。。pemN是[RFC7468]中描述的每个X.509证书的PEM表示。在验证过程中以多种方式构建证书链的UAs应发送最后构建的链。这样,他们可以避免在验证过程中保持太多的状态。
The known-pins are the Pins that the UA has noted for the Known Pinned Host. They are provided as an array of strings with the syntax:
已知管脚是UA为已知固定主机记录的管脚。它们以字符串数组的形式提供,语法如下:
known-pin = token "=" quoted-string
已知pin=标记“=”带引号的字符串
Figure 7: Known Pin Syntax
图7:已知的Pin语法
As in Section 2.4, the token refers to the algorithm name, and the quoted-string refers to the base64 encoding of the SPKI Fingerprint. When formulating the JSON POST body, the UA MUST either use single-quoted JSON strings or use double-quoted JSON strings and backslash-escape the embedded double quotes in the quoted-string part of the known-pin.
如第2.4节所述,令牌指的是算法名称,带引号的字符串指的是SPKI指纹的base64编码。制定JSON POST正文时,UA必须使用单引号的JSON字符串或双引号的JSON字符串,并对已知pin的引号字符串部分中嵌入的双引号进行反斜杠转义。
Figure 8 shows an example of a Pin Validation failure report. (PEM strings are shown on multiple lines for readability.)
图8显示了Pin验证失败报告的示例。(为了便于阅读,PEM字符串显示在多行上。)
{ "date-time": "2014-04-06T13:00:50Z", "hostname": "www.example.com", "port": 443, "effective-expiration-date": "2014-05-01T12:40:50Z" "include-subdomains": false, "served-certificate-chain": [ "-----BEGIN CERTIFICATE-----\n MIIEBDCCAuygAwIBAgIDAjppMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT\n ... HFa9llF7b1cq26KqltyMdMKVvvBulRP/F/A8rLIQjcxz++iPAsbw+zOzlTvjwsto\n WHPbqCRiOwY1nQ2pM714A5AuTHhdUDqB1O6gyHA43LL5Z/qHQF1hwFGPa4NrzQU6\n yuGnBXj8ytqU0CwIPX4WecigUCAkVDNx\n -----END CERTIFICATE-----", ... ], "validated-certificate-chain": [ "-----BEGIN CERTIFICATE-----\n MIIEBDCCAuygAwIBAgIDAjppMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT\n ... HFa9llF7b1cq26KqltyMdMKVvvBulRP/F/A8rLIQjcxz++iPAsbw+zOzlTvjwsto\n WHPbqCRiOwY1nQ2pM714A5AuTHhdUDqB1O6gyHA43LL5Z/qHQF1hwFGPa4NrzQU6\n yuGnBXj8ytqU0CwIPX4WecigUCAkVDNx\n -----END CERTIFICATE-----", ... ], "known-pins": [ 'pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="', "pin-sha256=\"E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=\"" ] }
{ "date-time": "2014-04-06T13:00:50Z", "hostname": "www.example.com", "port": 443, "effective-expiration-date": "2014-05-01T12:40:50Z" "include-subdomains": false, "served-certificate-chain": [ "-----BEGIN CERTIFICATE-----\n MIIEBDCCAuygAwIBAgIDAjppMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT\n ... HFa9llF7b1cq26KqltyMdMKVvvBulRP/F/A8rLIQjcxz++iPAsbw+zOzlTvjwsto\n WHPbqCRiOwY1nQ2pM714A5AuTHhdUDqB1O6gyHA43LL5Z/qHQF1hwFGPa4NrzQU6\n yuGnBXj8ytqU0CwIPX4WecigUCAkVDNx\n -----END CERTIFICATE-----", ... ], "validated-certificate-chain": [ "-----BEGIN CERTIFICATE-----\n MIIEBDCCAuygAwIBAgIDAjppMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT\n ... HFa9llF7b1cq26KqltyMdMKVvvBulRP/F/A8rLIQjcxz++iPAsbw+zOzlTvjwsto\n WHPbqCRiOwY1nQ2pM714A5AuTHhdUDqB1O6gyHA43LL5Z/qHQF1hwFGPa4NrzQU6\n yuGnBXj8ytqU0CwIPX4WecigUCAkVDNx\n -----END CERTIFICATE-----", ... ], "known-pins": [ 'pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="', "pin-sha256=\"E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=\"" ] }
Figure 8: Pin Validation Failure Report Example
图8:Pin验证失败报告示例
Pinning public keys helps hosts strongly assert their cryptographic identity even in the face of issuer error, malfeasance, or compromise. But, there is some risk that a host operator could lose (or lose control of) their host's private key (such as by operator error or host compromise). If the operator had pinned only the key of the host's end-entity certificate, the operator would not be able to serve their web site or application in a way that UAs would trust for the duration of their pin's max-age. (Recall that UAs MUST close the connection to a host upon Pin Failure.)
固定公钥有助于主机在遇到颁发者错误、渎职或泄露时强烈声明其加密身份。但是,主机运营商可能会丢失(或失去对主机私钥的控制)(例如,由于运营商错误或主机泄露)。如果运营商仅锁定了主机的终端实体证书的密钥,则运营商将无法在其pin的最长期限内以UAs信任的方式为其网站或应用程序提供服务。(回想一下,UAs必须在引脚故障时关闭与主机的连接。)
Therefore, there is a necessary trade-off between two competing goods: pin specificity and maximal reduction of the scope of issuers on the one hand; and flexibility and resilience of the host's cryptographic identity on the other hand. One way to resolve this trade-off is to compromise by pinning to the key(s) of the issuer(s) of the host's end-entity certificate(s). Often, a valid certificate chain will have at least two certificates above the end-entity certificate: the intermediate issuer and the trust anchor. Operators can pin any one or more of the public keys in this chain, and indeed MUST pin to issuers not in the chain (as, for example, a Backup Pin). Pinning to an intermediate issuer, or even to a trust anchor or root, still significantly reduces the number of issuers who can issue end-entity certificates for the Known Pinned Host, while still giving that host flexibility to change keys without a disruption of service.
因此,在两种相互竞争的商品之间存在着必要的权衡:一方面,pin专用性和发行人范围的最大缩减;另一方面,主机加密身份的灵活性和弹性。解决此折衷的一种方法是通过锁定主机的最终实体证书的颁发者的密钥进行折衷。通常,有效的证书链在最终实体证书之上至少有两个证书:中间颁发者和信任锚。运营商可以将任意一个或多个公钥锁定在此链中,实际上必须将其锁定到不在链中的发卡机构(例如,备份pin)。固定到中间颁发者,甚至固定到信任锚或根,仍然可以显著减少可以为已知固定主机颁发最终实体证书的颁发者的数量,同时仍然为该主机提供在不中断服务的情况下更改密钥的灵活性。
As mentioned in Section 2.3.3, UAs MAY cap the max-age value at some upper limit. There is a security trade-off in that low maximum values provide a narrow window of protection for users who visit the Known Pinned Host only infrequently, while high maximum values might result in a UA's inability to successfully perform Pin Validation for a Known Pinned Host if the UA's noted Pins and the host's true Pins diverge.
如第2.3.3节所述,UAs可能将最大年限值限制在某个上限。存在一个安全权衡,即低最大值为仅偶尔访问已知固定主机的用户提供了一个狭窄的保护窗口,而高最大值可能会导致UA无法成功执行已知固定主机的Pin验证,如果UA注意到的Pin和主机的真实Pin发生分歧。
Such divergence could occur for several reasons, including: UA error; host operator error; network attack; or a Known Pinned Host that intentionally migrates all pinned keys, combined with a UA that has noted true Pins with a high max-age value and has not had a chance to observe the new true Pins for the host. (This last example underscores the importance for host operators to phase in new keys gradually and to set the max-age value in accordance with their planned key migration schedule.)
出现这种差异可能有几个原因,包括:UA错误;主机操作员错误;网络攻击;或者,已知的固定主机有意迁移所有固定关键点,再加上UA已注意到具有高最大年龄值的真实接点,并且没有机会观察到主机的新真实接点。(最后一个示例强调了主机运营商逐步引入新密钥并根据其计划密钥迁移计划设置最大年龄值的重要性。)
There is probably no ideal upper limit to the max-age directive that would satisfy all use cases. However, a value on the order of 60 days (5,184,000 seconds) may be considered a balance between the two competing security concerns.
对于满足所有用例的max-age指令,可能没有理想的上限。但是,60天(5184000秒)左右的值可以被视为两个相互竞争的安全问题之间的平衡。
It may happen that Pinned Hosts whose hostnames share a parent domain use different Valid Pinning Headers. If a host whose hostname is a parent domain for another host sets the includeSubDomains directive, the two hosts' Pins may conflict with each other. For example, consider two Known Pinned Hosts, example.com and subdomain.example.com. Assume example.com sets a Valid Pinning Header such as this:
主机名共享父域的固定主机可能会使用不同的有效固定头。如果主机名为另一主机的父域的主机设置了includeSubDomains指令,则两台主机的PIN可能会相互冲突。例如,考虑两个已知的固定主机,ExpLo.com和SudiDime.ExpLo.com。假设example.com设置了一个有效的固定头,如下所示:
Public-Key-Pins: max-age=12000; pin-sha256="ABC..."; pin-sha256="DEF..."; includeSubDomains
Public-Key-Pins: max-age=12000; pin-sha256="ABC..."; pin-sha256="DEF..."; includeSubDomains
Figure 9: example.com Valid Pinning Header
图9:example.com有效固定头
Assume subdomain.example.com sets a Valid Pinning Header such as this:
假设subdomain.example.com设置了有效的固定头,如下所示:
Public-Key-Pins: pin-sha256="GHI..."; pin-sha256="JKL..."
Public-Key-Pins: pin-sha256="GHI..."; pin-sha256="JKL..."
Figure 10: subdomain.example.com Valid Pinning Header
图10:subdomain.example.com有效固定头
Assume a UA that has not previously noted any Pins for either of these hosts. If the UA first contacts subdomain.example.com, it will note the Pins in the Valid Pinning Header, and perform Pin Validation as normal on subsequent connections. If the UA then contacts example.com, again it will note the Pins and perform Pin Validation on future connections.
假设一个UA之前没有为这两个主机中的任何一个记录任何管脚。如果UA首先联系subdomain.example.com,它将在有效的Pinning头中记录管脚,并在后续连接上正常执行管脚验证。如果UA随后联系example.com,它将再次记录管脚并对未来的连接执行管脚验证。
However, if the UA happened to visit example.com before subdomain.example.com, the UA would, due to example.com's use of the includeSubDomains directive, attempt to perform Pin Validation for subdomain.example.com using the SPKI hashes ABC... and DEF..., which are not valid for the certificate chains subdomain.example.com (which uses certificates with SPKIs GHI... and JLK...). Thus, depending on the order in which the UA observes the Valid Pinning Headers for hosts example.com and subdomain.example.com, Pin Validation might or might not fail for subdomain.example.com, even if the certificate chain the UA receives for subdomain.example.com is perfectly valid.
但是,如果UA在subdomain.example.com之前访问example.com,由于example.com使用includeSubDomains指令,UA将尝试使用SPKI哈希ABC对subdomain.example.com执行Pin验证。。。和DEF…,对证书链subdomain.example.com无效(它使用带有SPKIs GHI…和JLK…的证书)。因此,根据UA观察主机example.com和subdomain.example.com的有效固定头的顺序,subdomain.example.com的固定头验证可能会失败,也可能不会失败,即使UA为subdomain.example.com接收的证书链完全有效。
Thus, Pinned Host operators must use the includeSubDomains directive with care. For example, they may choose to use overlapping pin sets for hosts under a parent domain that uses includeSubDomains, or to
因此,固定主机操作员必须谨慎使用includeSubDomains指令。例如,他们可以选择为使用includeSubDomains的父域下的主机使用重叠的pin集,或者
not use the includeSubDomains directive in their effective-second-level domains, or to simply use the same pin set for all hosts under a given parent domain.
不要在其有效的二级域中使用includeSubDomains指令,也不要对给定父域下的所有主机使用相同的pin集。
The primary way to cope with the risk of inadvertent Pin Validation failure is to keep a Backup Pin. A Backup Pin is a fingerprint for the public key of a secondary, not-yet-deployed key pair. The operator keeps the backup key pair offline, and sets a pin for it in the PKP header. Then, in case the operator loses control of their primary private key, they can deploy the backup key pair. UAs, who have had the backup key pair pinned (when it was set in previous Valid Pinning Headers), can connect to the host without error.
应对意外Pin验证失败风险的主要方法是保留备用Pin。备份Pin是尚未部署的辅助密钥对公钥的指纹。操作员使备份密钥对脱机,并在PKP标头中为其设置pin。然后,如果操作员失去对其主私钥的控制,他们可以部署备份密钥对。已锁定备份密钥对(在以前的有效锁定头中设置时)的UAs可以连接到主机而不会出错。
Because having a backup key pair is so important to recovery, UAs MUST require that hosts set a Backup Pin (see Section 2.5). The down side of keeping a not-yet-deployed key pair is that, if an attacker gains control of the private key, she will be able to perform a MITM attack without being discovered. Operators must take care to avoid leaking the key such as keeping it offline.
由于备份密钥对恢复非常重要,UAs必须要求主机设置备份Pin(请参阅第2.5节)。保留尚未部署的密钥对的缺点是,如果攻击者获得私钥的控制权,她将能够在不被发现的情况下执行MITM攻击。操作员必须小心避免钥匙泄漏,例如使其处于脱机状态。
HTTP cookies [RFC6265] set by a Known Pinned Host can be stolen by a network attacker who can forge web and DNS responses so as to cause a client to send the cookies to a phony subdomain of the host. To prevent this, hosts SHOULD set the "secure" attribute and precisely scope the "domain" attribute on all security-sensitive cookies, such as session cookies. These settings tell the browser that the cookie should only be sent back to the specific host(s) (and not, e.g., all subdomains of a given domain), and should only be sent over HTTPS (not HTTP).
由已知固定主机设置的HTTP Cookie[RFC6265]可能被网络攻击者窃取,网络攻击者可以伪造web和DNS响应,从而导致客户端将Cookie发送到主机的虚假子域。为了防止出现这种情况,主机应该设置“secure”属性,并在所有安全敏感cookie(如会话cookie)上精确定义“domain”属性的范围。这些设置告诉浏览器cookie应该只发送回特定主机(而不是,例如,给定域的所有子域),并且应该只通过HTTPS(而不是HTTP)发送。
An attacker who is able to obtain a valid certificate for a domain, either through misissuance by a Certification Authority or through other means, such as being the prior owner of a given domain, may attempt to perform 'hostile' pinning. In this scenario, the attacker provides a Valid Pinning Header that pins to a set of SPKIs of the attacker's choice. If a UA has not previously noted pins for that host, it may note the attacker's pins, preventing access to the legitimate site.
能够通过证书颁发机构的错误颁发或通过其他方式(例如作为给定域的前所有者)获得域的有效证书的攻击者可能会尝试执行“恶意”锁定。在这种情况下,攻击者会提供一个有效的固定头,将其固定到攻击者选择的一组SPKI上。如果UA以前没有注意到该主机的PIN,它可能会注意到攻击者的PIN,从而阻止对合法站点的访问。
This attack is mitigated through several means. Most prominently, the attack can only persist for the maximum max-age (see Section 4.1). Web host operators can reduce the opportunity for
这种攻击可以通过几种方法减轻。最显著的是,攻击只能持续最长时间(见第4.1节)。Web主机运营商可以减少
attack by working to preload the host's pins within the UA. Operators may further detect such misissuance through other means, such as certificate transparency ([RFC6962]).
通过在UA中预加载主机的PIN进行攻击。运营商可通过其他方式,如证书透明度([RFC6962])进一步检测此类错误发布。
Hosts can use HSTS or HPKP as a "super-cookie", by setting distinct policies for a number of subdomains. For example, assume example.com wishes to track distinct UAs without explicitly setting a cookie, or that a previously set cookie is deleted from the UA's cookie store. Here are two attack scenarios.
主机可以通过为许多子域设置不同的策略,将HST或HPKP用作“超级cookie”。例如,假设example.com希望在不显式设置cookie的情况下跟踪不同的UAs,或者先前设置的cookie已从UA的cookie存储中删除。这里有两种攻击场景。
o example.com can use report-uri and the ability to pin arbitrary identifiers to distinguish UAs.
o example.com可以使用报告uri和锁定任意标识符的能力来区分UAs。
1. example.com sets a Valid Pinning Header in its response to requests. The header asserts the includeSubDomains directive and specifies a report-uri directive as well. Pages served by the host also include references to subresource https://bad.example.com/foo.png.
1. example.com在其对请求的响应中设置有效的固定标头。标头声明includeSubDomains指令,并指定报表uri指令。主机提供的页面还包括对子资源的引用https://bad.example.com/foo.png.
2. The Valid Pinning Header includes a "pin" that is not really the hash of an SPKI but is instead an arbitrary distinguishing string sent only in response to a particular request. For each request, the host creates a new, distinct distinguishing string and sets it as if it were a pin.
2. 有效的Pinning头包含一个“pin”,它实际上不是SPKI的散列,而是一个仅在响应特定请求时发送的任意区分字符串。对于每个请求,主机都会创建一个新的、不同的区分字符串,并将其设置为pin。
3. The certificate chain served by bad.example.com does not pass Pin Validation given the pin set the host asserted in step (1). The HPKP-conforming UA attempts to report the Pin Validation failure to the specified report-uri, including the certificate chain it observed and the SPKI hashes it expected to see. Among the SPKI hashes is the distinguishing string in step (2).
3. 鉴于主机在步骤(1)中声明的Pin设置,bad.example.com提供的证书链未通过Pin验证。符合HPKP的UA尝试向指定的报告uri报告Pin验证失败,包括它观察到的证书链和它预期看到的SPKI哈希。SPKI散列中有步骤(2)中的区别字符串。
o Different site operators/origins can optionally collaborate by setting the report-uri to be in an origin they share administrative control of. UAs MAY, therefore, refuse to send reports outside of the origin that set the PKP or PKP-RO header.
o 不同的站点操作员/来源可以选择通过将报表uri设置为它们共享管理控制的来源来进行协作。因此,UAs可能会拒绝在设置PKP或PKP-RO标头的源站之外发送报告。
o example.com can use server name indication (SNI; [RFC3546]) and subdomains to distinguish UAs.
o example.com可以使用服务器名称指示(SNI;[RFC3546])和子域来区分UAs。
1. example.com sets a Valid Pinning Header in its response to requests. The header asserts the includeSubDomains directive.
1. example.com在其对请求的响应中设置有效的固定标头。标头断言includeSubDomains指令。
2. On a subsequent page view, the host responds with a page including the subresource https://0.fingerprint.example.com/ foo.png, and the server responds using a certificate chain that does not pass Pin Validation for the pin-set defined in the Valid Pinning Header in step (1). The HPKP-conforming UA will close the connection, never completing the request to 0.fingerprint.example.com. The host may thus note that this particular UA had noted the (good) Pins for that subdomain.
2. 在随后的页面视图中,主机用包含子资源的页面进行响应https://0.fingerprint.example.com/ foo.png,服务器使用一个证书链进行响应,该证书链未通过步骤(1)中有效Pinning头中定义的Pin集的Pin验证。符合HPKP的UA将关闭连接,永远不会完成对0.fingerprint.example.com的请求。因此,主机可能会注意到该特定UA已注意到该子域的(良好)管脚。
3. example.com can distinguish 2^N UAs by serving Valid Pinning Headers from an arbitrary number N distinct subdomains. For any given subdomain n.fingerprint.example.com, the host may deliver a Valid Pinning Header to one UA, but not deliver it to a different UA. The server may then change the configuration for n.fingerprint.example.com. If the UA fails to connect, it was in the set of UAs that were pinned, which can be distinguished from the UAs that were not pinned, as they will succeed in connecting. The host may repeat this for a sufficient number of subdomains necessary to distinguish individual UAs.
3. example.com可以通过从任意数量的N个不同子域提供有效的固定头来区分2^N个UAs。对于任何给定的子域n.fingerprint.example.com,主机可以向一个UA传递有效的钉扎头,但不能将其传递给不同的UA。然后,服务器可能会更改n.fingerprint.example.com的配置。如果UA无法连接,则它位于固定的UAs集中,这可以与未固定的UAs区分开来,因为它们将成功连接。主机可以对足够数量的子域重复此操作,以区分各个UAs。
o Conforming implementations (as well as implementations conforming to [RFC6797]) must store state about which domains have set policies, hence which domains the UA has contacted. Because these policies cause remotely detectable behaviors, it is advisable that UAs have a way for privacy-sensitive users to clear current Pins for Pinned Hosts and that UAs allow users to query the current state of Pinned Hosts. In addition, note that because pinning a host implies a degree of persistent state, an attacker with physical access to a device may be able to recover information about hosts a user has visited, even if the user has cleared other parts of the UA's state.
o 一致性实现(以及符合[RFC6797]的实现)必须存储关于哪些域设置了策略的状态,因此UA接触了哪些域。由于这些策略会导致远程可检测的行为,因此建议UAs为隐私敏感用户提供一种清除固定主机当前PIN的方法,并且UAs允许用户查询固定主机的当前状态。此外,请注意,由于固定主机意味着一定程度的持久状态,因此对设备具有物理访问权限的攻击者可能能够恢复有关用户访问过的主机的信息,即使用户已清除UA状态的其他部分。
o Pin reports, as noted in Section 3, contains information about the certificate chain that has failed pin validation. In some cases, such as organization-wide compromise of the end-to-end security of TLS, this may include information about the interception tools and design used by the organization that the organization would otherwise prefer not be disclosed.
o 如第3节所述,Pin报告包含有关Pin验证失败的证书链的信息。在某些情况下,例如组织范围内对TLS的端到端安全性的危害,这可能包括关于组织使用的拦截工具和设计的信息,否则组织不希望披露这些信息。
IANA has registered the response headers described in this document under "Permanent Message Header Field Names" in the "Message Headers" registry [message-headers] with the following parameters:
IANA已使用以下参数在“消息头”注册表[消息头]中的“永久消息头字段名称”下注册了本文档中描述的响应头:
o Header Field Names: Public-Key-Pins and Public-Key-Pins-Report-Only
o 标题字段名称:仅报告公钥PIN和公钥PIN
o Protocol: http
o 协议:http
o Status: standard
o 状态:标准
o Reference: RFC 7469
o 参考:RFC 7469
When pinning works to detect impostor Pinned Hosts, users will experience denial of service. It is advisable for UAs to explain the reason why, i.e., that it was impossible to verify the confirmed cryptographic identity of the host.
当锁定用于检测冒名顶替者锁定的主机时,用户将体验到拒绝服务。建议UAs解释原因,即无法验证主机的已确认加密身份。
It is advisable that UAs have a way for users to clear current Pins for Pinned Hosts and that UAs allow users to query the current state of Pinned Hosts.
建议UAs为用户清除固定主机的当前PIN,并允许用户查询固定主机的当前状态。
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997, <http://www.rfc-editor.org/info/rfc2119>.
[RFC2119]Bradner,S.,“RFC中用于表示需求水平的关键词”,BCP 14,RFC 2119,1997年3月<http://www.rfc-editor.org/info/rfc2119>.
[RFC3339] Klyne, G. and C. Newman, "Date and Time on the Internet: Timestamps", RFC 3339, July 2002, <http://www.rfc-editor.org/info/rfc3339>.
[RFC3339]Klyne,G.和C.Newman,“互联网上的日期和时间:时间戳”,RFC33392002年7月<http://www.rfc-editor.org/info/rfc3339>.
[RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, January 2005, <http://www.rfc-editor.org/info/rfc3986>.
[RFC3986]Berners Lee,T.,Fielding,R.,和L.Masinter,“统一资源标识符(URI):通用语法”,STD 66,RFC 3986,2005年1月<http://www.rfc-editor.org/info/rfc3986>.
[RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data Encodings", RFC 4648, October 2006, <http://www.rfc-editor.org/info/rfc4648>.
[RFC4648]Josefsson,S.,“Base16、Base32和Base64数据编码”,RFC4648,2006年10月<http://www.rfc-editor.org/info/rfc4648>.
[RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", STD 68, RFC 5234, January 2008, <http://www.rfc-editor.org/info/rfc5234>.
[RFC5234]Crocker,D.,Ed.和P.Overell,“语法规范的扩充BNF:ABNF”,STD 68,RFC 5234,2008年1月<http://www.rfc-editor.org/info/rfc5234>.
[RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security (TLS) Protocol Version 1.2", RFC 5246, August 2008, <http://www.rfc-editor.org/info/rfc5246>.
[RFC5246]Dierks,T.和E.Rescorla,“传输层安全(TLS)协议版本1.2”,RFC 5246,2008年8月<http://www.rfc-editor.org/info/rfc5246>.
[RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., Housley, R., and W. Polk, "Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile", RFC 5280, May 2008, <http://www.rfc-editor.org/info/rfc5280>.
[RFC5280]Cooper,D.,Santesson,S.,Farrell,S.,Boeyen,S.,Housley,R.,和W.Polk,“Internet X.509公钥基础设施证书和证书撤销列表(CRL)配置文件”,RFC 52802008年5月<http://www.rfc-editor.org/info/rfc5280>.
[RFC6234] Eastlake 3rd, D. and T. Hansen, "US Secure Hash Algorithms (SHA and SHA-based HMAC and HKDF)", RFC 6234, May 2011, <http://www.rfc-editor.org/info/rfc6234>.
[RFC6234]Eastlake 3rd,D.和T.Hansen,“美国安全哈希算法(基于SHA和SHA的HMAC和HKDF)”,RFC 62342011年5月<http://www.rfc-editor.org/info/rfc6234>.
[RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, April 2011, <http://www.rfc-editor.org/info/rfc6265>.
[RFC6265]Barth,A.,“HTTP状态管理机制”,RFC6265,2011年4月<http://www.rfc-editor.org/info/rfc6265>.
[RFC6797] Hodges, J., Jackson, C., and A. Barth, "HTTP Strict Transport Security (HSTS)", RFC 6797, November 2012, <http://www.rfc-editor.org/info/rfc6797>.
[RFC6797]Hodges,J.,Jackson,C.,和A.Barth,“HTTP严格传输安全(HSTS)”,RFC 67972012年11月<http://www.rfc-editor.org/info/rfc6797>.
[RFC7159] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data Interchange Format", RFC 7159, March 2014, <http://www.rfc-editor.org/info/rfc7159>.
[RFC7159]Bray,T.,Ed.“JavaScript对象表示法(JSON)数据交换格式”,RFC 7159,2014年3月<http://www.rfc-editor.org/info/rfc7159>.
[RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing", RFC 7230, June 2014, <http://www.rfc-editor.org/info/rfc7230>.
[RFC7230]Fielding,R.,Ed.和J.Reschke,Ed.,“超文本传输协议(HTTP/1.1):消息语法和路由”,RFC 7230,2014年6月<http://www.rfc-editor.org/info/rfc7230>.
[RFC7234] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", RFC 7234, June 2014, <http://www.rfc-editor.org/info/rfc7234>.
[RFC7234]Fielding,R.,Ed.,Nottingham,M.,Ed.,和J.Reschke,Ed.,“超文本传输协议(HTTP/1.1):缓存”,RFC 7234,2014年6月<http://www.rfc-editor.org/info/rfc7234>.
[RFC7468] Josefsson, S. and S. Leonard, "Textual Encodings of PKIX, PKCS, and CMS Structures", RFC 7468, April 2015, <http://www.rfc-editor.org/info/rfc7468>.
[RFC7468]Josefsson,S.和S.Leonard,“PKIX、PKCS和CMS结构的文本编码”,RFC 7468,2015年4月<http://www.rfc-editor.org/info/rfc7468>.
[W3C.REC-html401-19991224] Raggett, D., Hors, A., and I. Jacobs, "HTML 4.01 Specification", World Wide Web Consortium Recommendation REC-html401-19991224, December 1999, <http://www.w3.org/TR/1999/REC-html401-19991224>.
[W3C.REC-html401-19991224]Raggett,D.,Hors,A.和I.Jacobs,“HTML 4.01规范”,万维网联盟建议REC-html401-19991224,1999年12月<http://www.w3.org/TR/1999/REC-html401-19991224>.
[message-headers] IANA, "Message Headers", <http://www.iana.org/assignments/message-headers/>.
[消息头]IANA,“消息头”<http://www.iana.org/assignments/message-headers/>.
[RFC3546] Blake-Wilson, S., Nystrom, M., Hopwood, D., Mikkelsen, J., and T. Wright, "Transport Layer Security (TLS) Extensions", RFC 3546, June 2003, <http://www.rfc-editor.org/info/rfc3546>.
[RFC3546]Blake Wilson,S.,Nystrom,M.,Hopwood,D.,Mikkelsen,J.,和T.Wright,“传输层安全(TLS)扩展”,RFC 35462003年6月<http://www.rfc-editor.org/info/rfc3546>.
[RFC6962] Laurie, B., Langley, A., and E. Kasper, "Certificate Transparency", RFC 6962, June 2013, <http://www.rfc-editor.org/info/rfc6962>.
[RFC6962]Laurie,B.,Langley,A.和E.Kasper,“证书透明度”,RFC 69622013年6月<http://www.rfc-editor.org/info/rfc6962>.
[TACK] Marlinspike, M., "Trust Assertions for Certificate Keys", Work in Progress, draft-perrin-tls-tack-02, January 2013.
[TACK]Marlinspike,M.,“证书密钥的信任断言”,正在进行的工作,草稿-perrin-tls-TACK-022013年1月。
[why-pin-key] Langley, A., "Public Key Pinning", Imperial Violet: Adam Langley's Weblog, May 2011, <https://www.imperialviolet.org/2011/05/04/pinning.html>.
[why pin key]兰利,A.,“公钥锁定”,帝国紫罗兰:亚当·兰利的博客,2011年5月<https://www.imperialviolet.org/2011/05/04/pinning.html>.
This Portable Operating System Interface (POSIX) shell program generates SPKI Fingerprints, suitable for use in pinning, from PEM-encoded certificates. It is non-normative.
这个便携式操作系统接口(POSIX)外壳程序从PEM编码的证书生成SPKI指纹,适合用于固定。这是不规范的。
openssl x509 -noout -in certificate.pem -pubkey | \ openssl asn1parse -noout -inform pem -out public.key openssl dgst -sha256 -binary public.key | openssl enc -base64
openssl x509 -noout -in certificate.pem -pubkey | \ openssl asn1parse -noout -inform pem -out public.key openssl dgst -sha256 -binary public.key | openssl enc -base64
Figure 11: Example SPKI Fingerprint Generation Code
图11:SPKI指纹生成代码示例
This section is non-normative guidance that may smooth the adoption of public key pinning.
本节为非规范性指南,可能会使公钥锁定的采用更加顺利。
o Operators should get the backup public key signed by a different (root and/or intermediary) CA than their primary certificate, and store the backup key pair safely offline. The semantics of an SPKI Fingerprint do not require the issuance of a certificate to construct a valid Pin. However, in many deployment scenarios, in order to make a Backup Pin operational, the server operator will need to have a certificate to deploy TLS on the host. Failure to obtain a certificate through prior arrangement will leave clients that recognize the site as a Known Pinned Host unable to successfully perform Pin Validation until such a time as the operator can obtain a new certificate from their desired certificate issuer.
o 操作员应获得由与其主证书不同的(根和/或中介)CA签署的备份公钥,并安全地脱机存储备份密钥对。SPKI指纹的语义不需要颁发证书来构造有效的Pin。但是,在许多部署场景中,为了使备份Pin正常工作,服务器操作员需要有证书才能在主机上部署TLS。未能通过事先安排获得证书将使识别站点为已知固定主机的客户端无法成功执行Pin验证,直到操作员能够从其所需的证书颁发者处获得新证书为止。
o It is most economical to have the backup certificate signed by a completely different signature chain than the live certificate, to maximize recoverability in the event of compromise of either the root or intermediary signer.
o 让备份证书由与活动证书完全不同的签名链进行签名是最经济的,这样可以在根签名者或中间签名者受到损害时最大限度地提高可恢复性。
o Operators should periodically exercise their Backup Pin plan -- an untested backup is no backup at all.
o 操作员应定期执行其备份Pin计划——未经测试的备份根本不是备份。
o Operators should start small. Operators should first deploy public key pinning by using the report-only mode together with a report-uri directive that points to a reliable report collection endpoint. When moving out of report-only mode, operators should start by setting a max-age of minutes or a few hours and gradually increase max-age as they gain confidence in their operational capability.
o 操作员应从小处着手。操作员应首先使用仅报告模式和指向可靠报告收集端点的报告uri指令部署公钥固定。当退出仅报告模式时,操作员应首先将最长使用时间设置为分钟或几小时,并在对其操作能力有信心时逐渐增加最长使用时间。
Acknowledgements
致谢
Thanks to Tobias Gondrom, Jeff Hodges, Paul Hoffman, Ivan Krstic, Adam Langley, Barry Leiba, Nicolas Lidzborski, SM, James Manger, Yoav Nir, Trevor Perrin, Eric Rescorla, Pete Resnick, Tom Ritter, and Yan Zhu for suggestions and edits that clarified the text.
感谢托拜厄斯·冈德罗姆、杰夫·霍奇斯、保罗·霍夫曼、伊万·克斯蒂克、亚当·兰利、巴里·莱巴、尼古拉斯·利兹博斯基、SM、詹姆斯·马格尔、约阿夫·尼尔、特雷弗·佩林、埃里克·雷索拉、皮特·雷斯尼克、汤姆·里特和朱岩,感谢他们的建议和编辑,澄清了文本。
TACK [TACK] is a fruitful source of alternative design considerations.
TACK[TACK]是替代设计考虑的有效来源。
Authors' Addresses
作者地址
Chris Evans Google, Inc. 1600 Amphitheatre Pkwy Mountain View, CA 94043 United States
Chris Evans Google,Inc.1600圆形剧场Pkwy Mountain View,加利福尼亚州,美国94043
EMail: cevans@google.com
EMail: cevans@google.com
Chris Palmer Google, Inc. 1600 Amphitheatre Pkwy Mountain View, CA 94043 United States
Chris Palmer Google,Inc.1600圆形剧场Pkwy Mountain View,加利福尼亚州,美国94043
EMail: palmer@google.com
EMail: palmer@google.com
Ryan Sleevi Google, Inc. 1600 Amphitheatre Pkwy Mountain View, CA 94043 United States
Ryan Slovi Google,Inc.1600圆形剧场Pkwy Mountain View,加利福尼亚州,美国94043
EMail: sleevi@google.com
EMail: sleevi@google.com