diff --git a/avd_docs/aws/elasticache/AVD-AWS-0197/docs.md b/avd_docs/aws/elasticache/AVD-AWS-0197/docs.md new file mode 100644 index 000000000..050517bb6 --- /dev/null +++ b/avd_docs/aws/elasticache/AVD-AWS-0197/docs.md @@ -0,0 +1,13 @@ + +Ensure that your Amazon ElastiCache Redis clusters are encrypted to increase data security. + +### Impact + + + +{{ remediationActions }} + +### Links +- https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/at-rest-encryption.html + + diff --git a/internal/rules/policies/cloud/policies/aws/elasticache/enable_at_rest_encryption.rego b/internal/rules/policies/cloud/policies/aws/elasticache/enable_at_rest_encryption.rego new file mode 100644 index 000000000..24748592e --- /dev/null +++ b/internal/rules/policies/cloud/policies/aws/elasticache/enable_at_rest_encryption.rego @@ -0,0 +1,25 @@ +# METADATA +# title: "ElastiCache Redis Cluster Encryption At-Rest" +# description: "Ensure that your Amazon ElastiCache Redis clusters are encrypted to increase data security." +# scope: package +# schemas: +# - input: schema.input +# related_resources: +# - https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/at-rest-encryption.html +# custom: +# avd_id: AVD-AWS-0197 +# provider: aws +# service: elasticache +# severity: HIGH +# short_code: enable-at-rest-encryption +# recommended_action: "Enable encryption for ElastiCache cluster data-at-rest" +# input: +# selector: +# - type: cloud +package builtin.aws.elasticache.aws0197 + +deny[res] { + group := input.aws.elasticache.replicationgroups[_] + not group.atrestencryptionenabled.value + res := result.new("Replication group does not have at-rest encryption enabled.", group.atrestencryptionenabled) +} diff --git a/internal/rules/policies/cloud/policies/aws/elasticache/enable_at_rest_encryption_test.rego b/internal/rules/policies/cloud/policies/aws/elasticache/enable_at_rest_encryption_test.rego new file mode 100644 index 000000000..d1500d1d0 --- /dev/null +++ b/internal/rules/policies/cloud/policies/aws/elasticache/enable_at_rest_encryption_test.rego @@ -0,0 +1,11 @@ +package builtin.aws.elasticache.aws0197 + +test_detects_when_disabled { + r := deny with input as {"aws": {"elasticache": {"replicationgroups": [{"atrestencryptionenabled": {"value": false}}]}}} + count(r) == 1 +} + +test_when_enabled { + r := deny with input as {"aws": {"elasticache": {"replicationgroups": [{"atrestencryptionenabled": {"value": true}}]}}} + count(r) == 0 +} \ No newline at end of file