2021-11-08 10:49:47 +00:00
include::../description.adoc[]
include::../ask-yourself.adoc[]
include::../recommended.adoc[]
2021-11-08 16:41:35 +01:00
== Sensitive Code Example
2021-11-08 16:31:26 +01:00
2021-11-09 18:15:28 +01:00
For https://aws.amazon.com/kinesis/[AWS Kinesis] Data Streams server-side encryption:
2023-01-09 15:29:41 +01:00
2022-03-02 15:19:10 +01:00
[source,terraform]
2021-11-09 18:15:28 +01:00
----
resource "aws_kinesis_stream" "sensitive_stream" {
encryption_type = "NONE" # Sensitive
}
----
2021-11-09 15:49:28 +01:00
For https://aws.amazon.com/elasticache/[Amazon ElastiCache]:
2023-01-09 15:29:41 +01:00
2022-03-02 15:19:10 +01:00
[source,terraform]
2021-11-09 15:49:28 +01:00
----
resource "aws_elasticache_replication_group" "example" {
replication_group_id = "example"
replication_group_description = "example"
transit_encryption_enabled = false # Sensitive
}
----
2021-11-09 11:01:19 +01:00
For https://aws.amazon.com/ecs/[Amazon ECS]:
2023-01-09 15:29:41 +01:00
2022-03-02 15:19:10 +01:00
[source,terraform]
2021-11-09 11:01:19 +01:00
----
resource "aws_ecs_task_definition" "ecs_task" {
family = "service"
container_definitions = file("task-definition.json")
volume {
name = "storage"
efs_volume_configuration {
file_system_id = aws_efs_file_system.fs.id
transit_encryption = "DISABLED" # Sensitive
}
}
}
----
2021-11-08 16:31:26 +01:00
For https://docs.aws.amazon.com/opensearch-service/index.html[Amazon OpenSearch domains]:
2023-01-09 15:29:41 +01:00
2022-03-02 15:19:10 +01:00
[source,terraform]
2021-11-08 16:31:26 +01:00
----
resource "aws_elasticsearch_domain" "example" {
domain_name = "example"
domain_endpoint_options {
enforce_https = false # Sensitive
}
node_to_node_encryption {
enabled = false # Sensitive
}
2021-11-09 11:01:19 +01:00
}
2021-11-08 16:31:26 +01:00
----
2021-11-08 10:49:47 +00:00
For https://aws.amazon.com/msk/[Amazon MSK] communications between clients and brokers:
2023-01-09 15:29:41 +01:00
2022-03-02 15:19:10 +01:00
[source,terraform]
2021-11-08 10:49:47 +00:00
----
resource "aws_msk_cluster" "sensitive_data_cluster" {
encryption_info {
encryption_in_transit {
client_broker = "TLS_PLAINTEXT" # Sensitive
in_cluster = false # Sensitive
}
}
}
----
2021-11-08 16:41:35 +01:00
For https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html[AWS Load Balancer Listeners]:
2023-01-09 15:29:41 +01:00
2022-03-02 15:19:10 +01:00
[source,terraform]
2021-11-08 16:41:35 +01:00
----
resource "aws_lb_listener" "front_load_balancer" {
protocol = "HTTP" # Sensitive
default_action {
type = "redirect"
redirect {
protocol = "HTTP"
}
}
2021-11-09 11:01:19 +01:00
}
2021-11-08 16:41:35 +01:00
----
2022-03-02 15:19:10 +01:00
HTTP protocol is used for https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_region_backend_service[GCP Region Backend Services]:
2023-01-09 15:29:41 +01:00
2022-03-02 15:19:10 +01:00
[source,terraform]
----
resource "google_compute_region_backend_service" "example" {
name = "example-service"
region = "us-central1"
health_checks = [google_compute_region_health_check.region.id]
connection_draining_timeout_sec = 10
session_affinity = "CLIENT_IP"
load_balancing_scheme = "EXTERNAL"
protocol = "HTTP" # Sensitive
}
----
2021-11-08 10:49:47 +00:00
== Compliant Solution
2021-11-09 18:15:28 +01:00
For https://aws.amazon.com/kinesis/[AWS Kinesis] Data Streams server-side encryption:
2022-02-04 17:28:24 +01:00
[source,terraform]
2021-11-09 18:15:28 +01:00
----
resource "aws_kinesis_stream" "compliant_stream" {
encryption_type = "KMS"
}
----
2021-11-09 15:49:28 +01:00
For https://aws.amazon.com/elasticache/[Amazon ElastiCache]:
2022-02-04 17:28:24 +01:00
[source,terraform]
2021-11-09 15:49:28 +01:00
----
resource "aws_elasticache_replication_group" "example" {
replication_group_id = "example"
replication_group_description = "example"
transit_encryption_enabled = true
}
----
2021-11-09 11:01:19 +01:00
For https://aws.amazon.com/ecs/[Amazon ECS]:
2022-02-04 17:28:24 +01:00
[source,terraform]
2021-11-09 11:01:19 +01:00
----
resource "aws_ecs_task_definition" "ecs_task" {
family = "service"
container_definitions = file("task-definition.json")
volume {
name = "storage"
efs_volume_configuration {
file_system_id = aws_efs_file_system.fs.id
transit_encryption = "ENABLED"
}
}
}
----
2021-11-08 16:31:26 +01:00
For https://docs.aws.amazon.com/opensearch-service/index.html[Amazon OpenSearch domains]:
2022-02-04 17:28:24 +01:00
[source,terraform]
2021-11-08 16:31:26 +01:00
----
resource "aws_elasticsearch_domain" "example" {
domain_name = "example"
domain_endpoint_options {
enforce_https = true
}
node_to_node_encryption {
enabled = true
}
2021-11-09 11:01:19 +01:00
}
2021-11-08 16:31:26 +01:00
----
2021-11-08 10:49:47 +00:00
For https://aws.amazon.com/msk/[Amazon MSK] communications between clients and brokers, data in transit is encrypted by default, allowing you to omit writing the `encryption_in_transit` configuration. However, if you need to configure it explicitly, this configuration is compliant:
2022-02-04 17:28:24 +01:00
[source,terraform]
2021-11-08 10:49:47 +00:00
----
resource "aws_msk_cluster" "sensitive_data_cluster" {
encryption_info {
encryption_in_transit {
client_broker = "TLS"
in_cluster = true
}
}
}
----
2021-11-08 16:41:35 +01:00
For https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html[AWS Load Balancer Listeners]:
2022-02-04 17:28:24 +01:00
[source,terraform]
2021-11-08 16:41:35 +01:00
----
resource "aws_lb_listener" "front_load_balancer" {
protocol = "HTTP"
default_action {
type = "redirect"
redirect {
protocol = "HTTPS"
}
}
}
----
2022-03-02 15:19:10 +01:00
HTTPS protocol is used for https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_region_backend_service[GCP Region Backend Services]:
2023-01-09 15:29:41 +01:00
2022-03-02 15:19:10 +01:00
[source,terraform]
----
resource "google_compute_region_backend_service" "example" {
name = "example-service"
region = "us-central1"
health_checks = [google_compute_region_health_check.region.id]
connection_draining_timeout_sec = 10
session_affinity = "CLIENT_IP"
load_balancing_scheme = "EXTERNAL"
protocol = "HTTPS"
}
----
2021-11-09 11:01:19 +01:00
include::../exceptions.adoc[]
2021-11-08 16:41:35 +01:00
2021-11-08 10:49:47 +00:00
include::../see.adoc[]
2021-11-09 18:15:28 +01:00
2021-11-08 10:49:47 +00:00
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
2022-03-14 15:00:11 +01:00
include::message.adoc[]
2021-11-08 10:49:47 +00:00
2021-11-08 16:31:26 +01:00
include::highlighting.adoc[]
2021-11-08 10:49:47 +00:00
endif::env-github,rspecator-view[]