Help us understand the problem. What is going on with this article?

HTTP Strict-Transport-Security (HSTS)

More than 1 year has passed since last update.

概要

ブラウザに次回のアクセス以降(指定した期間内であれば)ではHTTPSを使ってアクセスさせる

Strict-Transport-Security: max-age=<expire-time>
Strict-Transport-Security: max-age=<expire-time>; includeSubDomains
Strict-Transport-Security: max-age=<expire-time>; preload

max-age

  • HTTPSでのアクセスを強制させる期間

includeSubDomains

  • このオプションが指定された場合は全てのサブドメインに適用される

preload

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
https://hstspreload.org/
https://tools.ietf.org/html/rfc6797

HSTS 事前リスト

  • HSTSをあらかじめ有効にするサイト一覧
  • 事前リストに含めてもらうにはここで申請が必要 (一見怪しいサイトにみえるが、証明書を見る限りgoogleが管理してるっぽい)

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security#Preloading_Strict_Transport_Security

その他

HSTSが有効なサイトはユーザが証明書エラーを無視することができなくなる(UAがそのケースはコネクションを切断してしまうため)

8.4. Errors in Secure Transport Establishment

When connecting to a Known HSTS Host, the UA MUST terminate the
connection (see also Section 12 ("User Agent Implementation Advice"))
if there are any errors, whether "warning" or "fatal" or any other
error level, with the underlying secure transport. For example, this
includes any errors found in certificate validity checking that UAs
employ, such as via Certificate Revocation Lists (CRLs) [RFC5280], or
via the Online Certificate Status Protocol (OCSP) [RFC2560], as well
as via TLS server identity checking [RFC6125].

https://tools.ietf.org/html/rfc6797#section-8.4

防げる問題

  • httpアクセスをMITMで攻撃するケース
  • httpsサイトにhttpのリンクやコンテンツを意図せず含めてしまったケース
  • 不正な証明書をユーザが無視するようなケースを狙った攻撃

https://www.owasp.org/index.php/HTTP_Strict_Transport_Security_Cheat_Sheet#Threats

実際のレスポンスの例

$ curl -s -D - 'https://www.facebook.com/' -o /dev/null | grep Strict-Transport-Security
Strict-Transport-Security: max-age=15552000; preload
nyamage
Docker, Ruby, Swiftは趣味で触ってるだけです。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした