CRITICAL
Source
Trivy
ID
AVD-AWS-0046

Elasticsearch doesn’t enforce HTTPS traffic.

Plain HTTP is unencrypted and human-readable. This means that if a malicious actor was to eavesdrop on your connection, they would be able to see all of your data flowing back and forth.

You should use HTTPS, which is HTTP over an encrypted (TLS) connection, meaning eavesdroppers cannot read your traffic.

Impact

HTTP traffic can be intercepted and the contents read

Follow the appropriate remediation steps below to resolve the issue.

Enforce the use of HTTPS for ElasticSearch

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
---
AWSTemplateFormatVersion: "2010-09-09"
Description: A sample template
Resources:
  GoodExample:
    Type: AWS::Elasticsearch::Domain
    Properties:
      DomainName: 'test'
      DomainEndpointOptions:
        EnforceHTTPS: true
        
      ElasticsearchVersion: '7.10'
      EncryptionAtRestOptions:
        Enabled: true
        KmsKeyId: alias/kmskey
      ElasticsearchClusterConfig:
        DedicatedMasterEnabled: true
        InstanceCount: '2'
        ZoneAwarenessEnabled: true
        InstanceType: 'm3.medium.elasticsearch'
        DedicatedMasterType: 'm3.medium.elasticsearch'
        DedicatedMasterCount: '3'
      EBSOptions:
        EBSEnabled: true
        Iops: '0'
        VolumeSize: '20'
        VolumeType: 'gp2'

Enforce the use of HTTPS for ElasticSearch

1
2
3
4
5
6
7
resource "aws_elasticsearch_domain" "good_example" {
  domain_name = "domain-foo"
  
  domain_endpoint_options {
    enforce_https = true
  }
}