-
-
Notifications
You must be signed in to change notification settings - Fork 606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds HSTS configuration variables #388
Conversation
Any particular reason why we would want these options to be configurable vs enforcing them as sane defaults? |
i ran into an issue today where |
@louim if you need to refresh your settings you might need to set max_age to 0 temporarily
https://developer.mozilla.org/en-US/docs/Web/Security/HTTP_strict_transport_security Also, mind as well keep them configurable since these are potentially site-breaking options |
{% set hsts_include_subdomains = item.value.ssl.hsts_include_subdomains | default(nginx_hsts_include_subdomains) %} | ||
{% set hsts_preload = item.value.ssl.hsts_preload | default(nginx_hsts_preload) %} | ||
|
||
add_header Strict-Transport-Security "max-age={{ hsts_max_age }}{{ hsts_include_subdomains | ternary('; includeSubdomains', '') }}{{ hsts_preload | ternary('; preload', '') }}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we care how messy this is? If the variables were strings it could be:
add_header Strict-Transport-Security "max-age={{ [hsts_max_age, hsts_include_subdomains, hsts_preload].join(';') }}";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why I did the manual "; " prefix is because I was trying to follow the format:
Other formatting examples
https://tools.ietf.org/html/draft-hodges-strict-transport-sec-02#page-14
https://www.owasp.org/index.php/HTTP_Strict_Transport_Security
{% set hsts_max_age = item.value.ssl.hsts_max_age | default(nginx_hsts_max_age) %} | ||
{% set hsts_include_subdomains = item.value.ssl.hsts_include_subdomains | default(nginx_hsts_include_subdomains) | ternary('includeSubdomains', None) %} | ||
{% set hsts_preload = item.value.ssl.hsts_preload | default(nginx_hsts_preload) | ternary('preload', None) %} | ||
add_header Strict-Transport-Security "max-age={{ [hsts_max_age, hsts_include_subdomains, hsts_preload] | reject('none') | join('; ') }}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
results in add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload";
@austinpray changelog pls 🍉 |
Adds the following WordPress site variables ssl.nginx_hsts_max_age ssl.nginx_hsts_include_subdomains ssl.nginx_hsts_preload Adds the following nginx global defaults nginx_hsts_max_age: 31536000 nginx_hsts_include_subdomains: true nginx_hsts_preload: true
@roots/trellis-contributors gimme a couple extra go-aheads and I'll merge. |
👍 |
1 similar comment
👍 |
Adds HSTS configuration variables
Adds the following WordPress site variables
ssl.nginx_hsts_max_age
ssl.nginx_hsts_include_subdomains
ssl.nginx_hsts_preload
Adds the following nginx global defaults
nginx_hsts_max_age: 31536000
nginx_hsts_include_subdomains: true
nginx_hsts_preload: true