Description
Amazon MSK always encrypts stored data, using an AWS managed KMS key by default. New clusters also default to TLS-only client connections and encrypted broker traffic. Check the deployed settings if encryption_info is absent.
Potential impact
PLAINTEXT and TLS_PLAINTEXT allow clients to send messages in plaintext. With in_cluster = false, traffic between brokers is also exposed to interception or modification.
Remediation
- Configure producers and consumers to use TLS, then set
client_broker = "TLS"andin_cluster = true. Test that clients can produce and consume with the intended authentication, topic permissions and network access. - If a customer-managed storage key is required, grant MSK access and keep the key enabled. For an existing cluster, review the Terraform plan and migrate data and clients before retiring any cluster marked for replacement.
Examples
These excerpts show encryption settings. Supply the supported Kafka version, broker configuration, subnets and security groups, plus the referenced KMS key in the second example.
Before
resource "aws_msk_cluster" "msk_cluster" {
cluster_name = "example"
kafka_version = var.kafka_version
number_of_broker_nodes = 3
encryption_info {
encryption_in_transit {
client_broker = "PLAINTEXT"
in_cluster = false
}
}
}
Both network paths use plaintext. MSK still encrypts the stored data.
After
resource "aws_msk_cluster" "msk_cluster" {
encryption_info {
encryption_at_rest_kms_key_arn = aws_kms_key.kms.arn
encryption_in_transit {
client_broker = "TLS"
in_cluster = true
}
}
}
The second example requires TLS on client connections, encrypts traffic between brokers and selects aws_kms_key.kms for storage.