github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/rules/cloud/policies/aws/elasticsearch/enforce_https.go (about) 1 package elasticsearch 2 3 import ( 4 "github.com/khulnasoft-lab/defsec/internal/rules" 5 "github.com/khulnasoft-lab/defsec/pkg/providers" 6 "github.com/khulnasoft-lab/defsec/pkg/scan" 7 "github.com/khulnasoft-lab/defsec/pkg/severity" 8 "github.com/khulnasoft-lab/defsec/pkg/state" 9 ) 10 11 var CheckEnforceHttps = rules.Register( 12 scan.Rule{ 13 AVDID: "AVD-AWS-0046", 14 Provider: providers.AWSProvider, 15 Service: "elastic-search", 16 ShortCode: "enforce-https", 17 Summary: "Elasticsearch doesn't enforce HTTPS traffic.", 18 Impact: "HTTP traffic can be intercepted and the contents read", 19 Resolution: "Enforce the use of HTTPS for ElasticSearch", 20 Explanation: `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. 21 22 You should use HTTPS, which is HTTP over an encrypted (TLS) connection, meaning eavesdroppers cannot read your traffic.`, 23 Links: []string{ 24 "https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-data-protection.html", 25 }, 26 Terraform: &scan.EngineMetadata{ 27 GoodExamples: terraformEnforceHttpsGoodExamples, 28 BadExamples: terraformEnforceHttpsBadExamples, 29 Links: terraformEnforceHttpsLinks, 30 RemediationMarkdown: terraformEnforceHttpsRemediationMarkdown, 31 }, 32 CloudFormation: &scan.EngineMetadata{ 33 GoodExamples: cloudFormationEnforceHttpsGoodExamples, 34 BadExamples: cloudFormationEnforceHttpsBadExamples, 35 Links: cloudFormationEnforceHttpsLinks, 36 RemediationMarkdown: cloudFormationEnforceHttpsRemediationMarkdown, 37 }, 38 Severity: severity.Critical, 39 }, 40 func(s *state.State) (results scan.Results) { 41 for _, domain := range s.AWS.Elasticsearch.Domains { 42 if domain.Endpoint.EnforceHTTPS.IsFalse() { 43 results.Add( 44 "Domain does not enforce HTTPS.", 45 domain.Endpoint.EnforceHTTPS, 46 ) 47 } else { 48 results.AddPassed(&domain) 49 } 50 } 51 return 52 }, 53 )