More Info:
ElasticSearch domains are configured to enforce HTTPS connections. ElasticSearch domains should be configured to enforce HTTPS connections for all clients to ensure encryption of data in transit.Risk Level
LowAddress
SecurityCompliance Standards
AWSWAF, HITRUST, SOC2, PCIDSSTriage and Remediation
Remediation
Using Console
Using Console
To remediate the ElasticSearch misconfiguration of using HTTPS only in AWS using the AWS console, you can follow the below steps:
- Log in to the AWS Management Console and navigate to the ElasticSearch service.
- Select the misconfigured ElasticSearch domain.
- In the domain dashboard, click on the “Edit” button in the “Encryption” section.
- In the “Encryption” section, select the “Require HTTPS” option.
- Click on the “Save Changes” button to apply the new configuration.
- Once the changes are saved, ElasticSearch will only be accessible through HTTPS.
- Verify the changes by attempting to access the ElasticSearch domain using HTTP. It should not be accessible and should return an error message.
Using CLI
Using CLI
To remediate the ElasticSearch misconfiguration of using HTTPS only in AWS using AWS CLI, you can follow the below steps:
-
Open the AWS CLI and run the following command to get the current status of the ElasticSearch domain:
Replace
<domain-name>
with the name of your ElasticSearch domain. -
Check the output of the above command for the value of the
EncryptionAtRestOptions
parameter. If it is not set toEnabled
, then run the following command to enable encryption at rest:Replace<domain-name>
with the name of your ElasticSearch domain. -
Next, run the following command to update the ElasticSearch domain to use HTTPS only:
Replace
<domain-name>
with the name of your ElasticSearch domain. -
After running the above command, wait for a few minutes for the changes to take effect. You can check the status of the ElasticSearch domain again by running the
describe-elasticsearch-domain
command.If the output of this command shows that theHTTPSEnabled
parameter is set totrue
, then the ElasticSearch domain is now using HTTPS only.
Using Python
Using Python
To remediate this misconfiguration on AWS using Python, you can follow the steps below:Note: In the code above, we assume that the ElasticSearch domain is not using VPC and that you have an IAM user with the necessary permissions to update the ElasticSearch domain configuration. Also, make sure to replace
- Install the AWS SDK for Python (Boto3) by running the following command in your terminal:
- Create an AWS ElasticSearch client using the Boto3 library:
- Get the ElasticSearch domain configuration using the
describe_elasticsearch_domain
method:
- Check if the ElasticSearch domain is using HTTPS only by looking at the
DomainStatus
dictionary:
- If the ElasticSearch domain is not using HTTPS only, update the domain configuration using the
update_elasticsearch_domain_config
method:
- Verify that the ElasticSearch domain is now using HTTPS only by checking the
DomainStatus
dictionary again:
your-domain-name
and your-password
with the actual values for your ElasticSearch domain.