google-chrome - 如何根据 HSTS header 检查网站列表?

标签 google-chrome ssl tls1.2 hsts strict-transport-security

我需要检查网站列表以检查它们是否支持 HSTS 政策。

我抓取了他们的响应标题。但是,我现在很困惑,因为似乎 HSTS 策略订阅可以通过预加载列表完成,而不仅仅是标题(我可能错了,但我没有明白这一点)。

检查网站响应 header (即查找 Strict-Transport-Security header )是否为我提供了以下问题的正确答案:网站是否支持 HSTS 政策?

因为有一个预加载列表。我不确定:网站可以在不发送 HSTS header 的情况下订阅列表吗?即网站是否可以在不发送 Strict-Transport-Security header 的情况下支持 HSTS 策略?

我检查了 Chrome 的 HSTS 预加载列表订阅页面 here .它说:

If your site is committed to HTTPS and you want to preload HSTS, we suggest the following steps: [...] Add the Strict-Transport-Security header to all HTTPS responses and ramp up the max-age in stages, using the following header values: [...]

谁能给我解释一下。首先,Chrome 页面中的suggest 字眼不清楚。是必须的吗?还是可选的?第二,如果是必须的,那么,如果要订阅列表的网站无论如何都需要发送HSTS头,它为什么要订阅列表?这个列表是否只是为了提供一种保护第一个连接的方法(使用 HSTS header 方法无法保护)?或者它是双重检查的意思还是类似的意思?请向我澄清一下。

底线问题:是否足以让我检查 header 以说明给定网站是否支持 HSTS 政策,而无需根据 Chrome 预加载列表检查该网站?

如果需要根据 Chrome 的 HSTS 预加载列表检查网站,请指点我如何自动执行此操作(我无法手动执行此操作,因为我的网站列表不是一两个)。此外,如何根据过去特定日期(几个月前)的列表检查网站。

最佳答案

Does checking the websites response headers (i.e. look for the Strict-Transport-Security header) gives me a correct answer to the questions: does the website support the HSTS policy?

是的。

Because there is a preloaded list. I am not sure: can a website subscribe to the list without sending the HSTS header? i.e. can a website support the HSTS policy without sending the Strict-Transport-Security header?

从技术上讲,他们可以。但是,它们可能会从预加载列表中删除。此外,并非所有浏览器都支持预加载(尽管主流浏览器支持),并且它们并不都使用相同的预加载列表。因此,标题是必须的,列表是可选的。

Can anyone clarify to me. First, the word suggest in Chrome's page is not clear. Is it a must? or optional?

一般来说,规则是必须的,如果不遵守规则,它们将不会被自动接受到列表中,并且它们可能会从预加载列表中删除。然而,规则是用来打破的,如果你愿意,你可以手动请求添加。例如https://gov.uk (英国政府)在预加载列表中,但 HSTS header 上没有 includesSubDomain 属性。这大概是因为他们尚未将所有子域转换为 HTTPS,但仍希望保护这个重要的顶级站点的预加载。并非我们所有人都受到英国政府的影响,因此对于其他人来说,最好遵守所有规则并自动提交。

Second, if it is a must, then, if the website that want to subscribe to the list needs to send the HSTS header anyways, why does it subscribe to the list? Is this list just to provide a mean to protect the first connection (which can not be protected using the HSTS header method)? or is it a mean of double-check or something like that? Please, clarify to me.

正确。 Preload是为了保护第一个负载。没有这个,浏览器就没有看到 HSTS header ,因此不知道该站点支持 HSTS。

老实说,我认为预加载对大多数网站来说都是矫枉过正,我真的不喜欢在你无法控制的地方硬编码这个概念,这可能是一把脚枪,正如我在 this blog post 中讨论的那样.一般来说(但不总是!)第一个请求相对安全(因为你没有 cookie),只要你使用安全的网站技术(安全、HTTPOnly cookie、HSTS 和重定向到 HTTPS),风险就相对较低。但是,如果您是全局知名网站(例如英国政府),那么预加载确实可以提供最好的保护。

The bottom line question: Is it enough for me to check the headers to say if a given website support the HSTS policy or not, without checking the website against the Chrome preloaded list?

差不多,如上所述。尽管您可能有一些边缘情况(现在?)仍然预加载但已停止发布 header 。这取决于您究竟为什么需要知道是否使用 HSTS。

If checking the website against the Chrome's HSTS preloaded list is required, can you please point to me how to automate this (I can not perform this manually as I have a list of websites not one or two). Also, how to check the website against the list of a specific date in the past (few months ago).

你需要检查这个 against the HSTS source code ,并查看此列表的历史版本。不是那个other browsers may not use this same list .要手动检查一个或两个站点的当前状态,可以使用 SSLLabs 等工具或 Hardenize基本上为您解析此列表。

关于google-chrome - 如何根据 HSTS header 检查网站列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56951328/

相关文章:

android - 使用 HTTPS 协议(protocol)的 android 连接中的 Socket.io 客户端失败?

java - Apache HttpClient - 使用 SSL 或 TLSv1.2 时忽略 keepalive

google-chrome - 自定义 Chrome 网络检查器的外观

jquery - 点击时 Chrome 会模糊 div

Javascript - socket.io get 显示未找到

Java:用于在 Windows 上测试的 ssl 证书?

一个站点在 IIS 中的 SSL 证书,所有站点都响应 https 请求

java - Tomcat : Installing LetsEncrypt certificate for https, 不工作

java - 如何在 java 6 上启用 TLSv1.2 (TLSv1.2 + BouncycaSTLe + Java 1.6_45)

google-chrome - Chrome 扩展 : how to use serial port (now that apps are sunsetting)?