Description
To protect file traffic between an ECS host and EFS with TLS, enable transit encryption on the EFS volume in the task definition.
Potential impact
Without TLS, file contents and metadata can be exposed along the network path, including inside a VPC.
Remediation
Set transit_encryption = "ENABLED" in efs_volume_configuration. Deploy the new task-definition revision and verify that tasks can mount, read and write files. Configure IAM, access points, security groups and encryption at rest separately.
Examples
Define the service-storage mount point in task-definitions/service.json and make /opt/data available on the referenced EFS file system.
Before
resource "aws_ecs_task_definition" "example" {
family = "service"
container_definitions = file("task-definitions/service.json")
volume {
name = "service-storage"
efs_volume_configuration {
file_system_id = aws_efs_file_system.fs.id
root_directory = "/opt/data"
transit_encryption = "DISABLED"
transit_encryption_port = 2999
}
}
}
After
resource "aws_ecs_task_definition" "example" {
family = "service"
container_definitions = file("task-definitions/service.json")
volume {
name = "service-storage"
efs_volume_configuration {
file_system_id = aws_efs_file_system.fs.id
root_directory = "/opt/data"
transit_encryption = "ENABLED"
transit_encryption_port = 2999
}
}
}
Both excerpts specify port 2999. The transit_encryption setting controls whether the connection uses TLS.