Elasticsearch without IAM authentication This product is not supported for your selected
Datadog site . (
).
このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、
お気軽にご連絡ください 。
Id: terraform-aws-elasticsearch-without-iam-authentication
Provider: AWS
Platform: Terraform
Severity: Medium
Category: Access Control
Learn More Description AWS Elasticsearch domains should enforce IAM authentication to restrict access to authorized users only. Without proper IAM policies—such as using "Principal": "*" in the aws_elasticsearch_domain_policy resource—unauthorized users could gain access to sensitive data by connecting from approved IP addresses. To mitigate this risk, the Principal field should be set to reference specific IAM principals, as shown below:
"Principal" : {
"AWS": [
"arn:aws:iam::123456789012:root",
"arn:aws:iam::555555555555:root"
]
}
Failing to enforce IAM authentication can expose your Elasticsearch domain to unauthorized access and potential data breaches.
Compliant Code Examples resource "aws_elasticsearch_domain" "negativee" {
domain_name = "tf-test"
elasticsearch_version = "2.3"
}
resource "aws_elasticsearch_domain_policy" "main8" {
domain_name = aws_elasticsearch_domain . negativee . domain_name
access_policies = <<POLICIES
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "es:*",
"Principal" : {
"AWS": [
"arn:aws:iam::123456789012:root",
"arn:aws:iam::555555555555:root"
]
},
"Effect": "Allow",
"Condition": {
"IpAddress": {"aws:SourceIp": "127.0.0.1/32"}
},
"Resource": "${aws_elasticsearch_domain.negativee.arn}/*"
}
]
}
POLICIES
}
Non-Compliant Code Examples resource "aws_elasticsearch_domain" "example" {
domain_name = "tf-test"
elasticsearch_version = "2.3"
}
resource "aws_elasticsearch_domain_policy" "main" {
domain_name = aws_elasticsearch_domain . example . domain_name
access_policies = <<POLICIES
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "es:*",
"Principal": "*",
"Effect": "Allow",
"Condition": {
"IpAddress": {"aws:SourceIp": "127.0.0.1/32"}
},
"Resource": "${aws_elasticsearch_domain.example.arn}/*"
}
]
}
POLICIES
}
resource "aws_elasticsearch_domain" "example2" {
domain_name = "tf-test"
elasticsearch_version = "2.3"
}
resource "aws_elasticsearch_domain_policy" "main2" {
domain_name = aws_elasticsearch_domain . example2 . domain_name
access_policies = <<POLICIES
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "es:*",
"Effect": "Allow",
"Condition": {
"IpAddress": {"aws:SourceIp": "127.0.0.1/32"}
},
"Resource": "${aws_elasticsearch_domain.example2.arn}/*"
}
]
}
POLICIES
}