# ##################################### ## Gherkin ## ##################################### # Rule Identifier: # ELASTICSEARCH_ENCRYPTED_AT_REST # # Description: # Elasticsearch domains must enforce server side encryption # # Reports on: # AWS::Elasticsearch::Domain # # Evaluates: # AWS CloudFormation # # Rule Parameters: # NA # # Scenarios: # a) SKIP: when there is no Elasticsearch domain present # b) SKIP: when metada has rule suppression for ELASTICSEARCH_ENCRYPTED_AT_REST # c) FAIL: when Elasticsearch domain has server side encryption property is missing # d) FAIL: when Elasticsearch domain has server side encryption set to false # e) PASS: when Elasticsearch domain has server side encryption set to true # # Select all elasticsearch domains from incoming template # let elasticsearch_domains_encrypted = Resources.*[ Type == "AWS::Elasticsearch::Domain" Metadata.guard.SuppressedRules not exists or Metadata.guard.SuppressedRules.* != "ELASTICSEARCH_ENCRYPTED_AT_REST" ] rule ELASTICSEARCH_ENCRYPTED_AT_REST when %elasticsearch_domains_encrypted !empty { %elasticsearch_domains_encrypted.Properties.EncryptionAtRestOptions.Enabled == true << Violation: Elasticsearch domains must enforce server side encryption. Fix: Set the EncryptionAtRestOptions.Enabled parameter to true. >> }