Skip to content

Commit b4900ab

Browse files
committed
Change default LB policy
This sets the default Load Balancer policy to ELBSecurityPolicy-TLS13-1-2-2021-06, which allows TLSv1.3 and 1.2. This is the recommended policy. See https://docs.aws.amazon.com/elasticloadbalancing/latest/application/describe-ssl-policies.html for details on all the policies. In fact, clients were still able to connect via TLSv1.3 due to changes in the ALB applied last year. https://aws.amazon.com/about-aws/whats-new/2023/03/application-load-balancer-tls-1-3/ This policy ensures that connections between the ALB and the server is also TLSv1.3 or 1.2. This is somewhat less important since it is all internal to the VPC, but a good idea nonetheless. This also updates the ALB policy when setting up pgadmin. Finally, this exposes the security policy as a variable so it can be overriden if needed.
1 parent f029ea2 commit b4900ab

File tree

7 files changed

+22
-4
lines changed

7 files changed

+22
-4
lines changed

cloud/aws/bin/pgadmin.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def run(config: ConfigLoader):
2727

2828
url = f"{config.get_base_url()}:4433"
2929
print(
30-
"\npgadmin terraform deployment finished. Waiting for pgadmin to be available (some request failures are expected). Press ctlr-c to shortcut this wait and print connection information."
30+
f"\npgadmin terraform deployment finished. Waiting for pgadmin to be available at {url} (some request failures are expected). Press Ctrl-c to shortcut this wait and print connection information."
3131
)
3232
_wait_for_pgadmin_response(url)
3333
_print_connection_info(config, url)

cloud/aws/modules/pgadmin/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ resource "aws_lb_listener" "pgadmin" {
1717
port = 4433
1818
protocol = "HTTPS"
1919
certificate_arn = var.lb_ssl_cert_arn
20-
ssl_policy = "ELBSecurityPolicy-2016-08" # Default policy.
20+
ssl_policy = var.lb_ssl_policy
2121
default_action {
2222
type = "forward"
2323
target_group_arn = aws_lb_target_group.pgadmin.arn

cloud/aws/modules/pgadmin/variables.tf

+5
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,8 @@ variable "secrets_recovery_window_in_days" {
7979
type = string
8080
description = "Recovery window for secrets"
8181
}
82+
variable "lb_ssl_policy" {
83+
description = "The AWS security policy to use on the load balancer. https://docs.aws.amazon.com/elasticloadbalancing/latest/network/describe-ssl-policies.html"
84+
type = string
85+
default = "ELBSecurityPolicy-TLS13-1-2-2021-06"
86+
}

cloud/aws/templates/aws_oidc/app.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ module "ecs_fargate_service" {
316316
app_prefix = var.app_prefix
317317
desired_count = var.fargate_desired_task_count
318318
default_certificate_arn = var.ssl_certificate_arn
319-
ssl_policy = "ELBSecurityPolicy-FS-1-2-Res-2020-10"
319+
ssl_policy = var.lb_ssl_policy
320320
vpc_id = local.vpc_id
321321
task_definition_arn = var.monitoring_stack_enabled ? aws_ecs_task_definition.civiform_with_monitoring.arn : aws_ecs_task_definition.civiform_only.arn
322322
container_name = "${var.app_prefix}-civiform"

cloud/aws/templates/aws_oidc/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ module "pgadmin" {
192192
vpc_id = local.vpc_id
193193
lb_arn = module.ecs_fargate_service.aws_lb_civiform_lb_arn
194194
lb_ssl_cert_arn = var.ssl_certificate_arn
195+
lb_ssl_policy = var.lb_ssl_policy
195196
lb_access_sg_id = module.ecs_fargate_service.aws_security_group_lb_access_sg_id
196197
cidr_allowlist = var.pgadmin_cidr_allowlist
197198

cloud/aws/templates/aws_oidc/variable_definitions.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -448,5 +448,11 @@
448448
"secret": false,
449449
"tfvar": true,
450450
"type": "bool"
451-
}
451+
},
452+
"LB_SSL_POLICY": {
453+
"required": false,
454+
"secret": false,
455+
"tfvar": true,
456+
"type": "string"
457+
}
452458
}

cloud/aws/templates/aws_oidc/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -561,3 +561,9 @@ variable "enable_http_listener" {
561561
type = bool
562562
default = true
563563
}
564+
565+
variable "lb_ssl_policy" {
566+
description = "The AWS security policy to use on the load balancer. https://docs.aws.amazon.com/elasticloadbalancing/latest/network/describe-ssl-policies.html"
567+
type = string
568+
default = "ELBSecurityPolicy-TLS13-1-2-2021-06"
569+
}

0 commit comments

Comments
 (0)