Skip to content

Commit 7f68f72

Browse files
JC-wkJames Chapmanmarrobi
authored
App gateway secure config (#4863)
* add security headers * add CUSTOM_DOMAIN param Enable HSTS Enable HTTP2 Enable NoSniff header * changelog * Update CHANGELOG.md Co-authored-by: Marcus Robinson <marrobi@microsoft.com> * add comment and disable http2 * revert custom_domain changes * remove host name * remove custom_domain * remove custom domain * remove custom domain * remove http2 settng --------- Co-authored-by: James Chapman <james.chapman@necsu.onmicrosoft.com> Co-authored-by: Marcus Robinson <marrobi@microsoft.com>
1 parent 29febb3 commit 7f68f72

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* _No changes yet_
55

66
ENHANCEMENTS:
7-
* _No changes yet_
7+
* Harden security of the app gateway. ([#4863](https://github.com/microsoft/AzureTRE/pull/4863))
88

99
BUG FIXES:
1010
* Fix property substitution not occuring where there is only a main step in the pipeline ([#4824](https://github.com/microsoft/AzureTRE/issues/4824))

core/terraform/appgateway/appgateway.tf

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,13 @@ resource "azurerm_application_gateway" "agw" {
6969

7070
# SSL policy
7171
ssl_policy {
72-
policy_type = "Predefined"
73-
policy_name = "AppGwSslPolicy20220101"
72+
policy_type = "CustomV2"
73+
min_protocol_version = "TLSv1_2"
74+
# The cipher suites TLS_AES_128_GCM_SHA256 and TLS_AES_256_GCM_SHA384 are mandatory for TLSv1.3. You need NOT mention these explicitly when setting a CustomV2 policy
75+
cipher_suites = [
76+
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
77+
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"
78+
]
7479
}
7580

7681
# Backend pool with the static website in storage account.
@@ -164,17 +169,43 @@ resource "azurerm_application_gateway" "agw" {
164169
priority = 10
165170
}
166171

172+
rewrite_rule_set {
173+
name = "security-headers-rewrite-rule"
174+
175+
rewrite_rule {
176+
name = "Strict-Transport-Security"
177+
rule_sequence = 100
178+
179+
response_header_configuration {
180+
header_name = "Strict-Transport-Security"
181+
header_value = "max-age=31536000; includeSubDomains"
182+
}
183+
}
184+
185+
rewrite_rule {
186+
name = "X-Content-Type-Options"
187+
rule_sequence = 110
188+
189+
response_header_configuration {
190+
header_name = "X-Content-Type-Options"
191+
header_value = "nosniff"
192+
}
193+
}
194+
}
195+
167196
# Default traffic is routed to the static website. Exception is API.
168197
url_path_map {
169198
name = local.app_path_map_name
170199
default_backend_address_pool_name = local.staticweb_backend_pool_name
171200
default_backend_http_settings_name = local.staticweb_http_setting_name
201+
default_rewrite_rule_set_name = "security-headers-rewrite-rule"
172202

173203
path_rule {
174204
name = "api"
175205
paths = ["/api/*", "/openapi.json"]
176206
backend_address_pool_name = local.api_backend_pool_name
177207
backend_http_settings_name = local.api_http_setting_name
208+
rewrite_rule_set_name = "security-headers-rewrite-rule"
178209
}
179210

180211
}

core/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.16.13"
1+
__version__ = "0.16.14"

0 commit comments

Comments
 (0)