# ################################### ## Rule Specification ## ##################################### # # Rule Identifier: # neptune_cluster_iam_database_authentication_check # # Description: # This control checks whether an Amazon Neptune cluster has AWS Identity and Access Management (IAM) database authentication enabled. # # Reports on: # AWS::Neptune::DBCluster # # Evaluates: # AWS CloudFormation, AWS CloudFormation hook # # Rule Parameters: # None # # Scenarios: # Scenario: 1 # Given: The input document is an AWS CloudFormation or CloudFormation hook document # And: The input document does not contain any Neptune DB cluster resources # Then: SKIP # Scenario: 2 # Given: The input document is an AWS CloudFormation or CloudFormation hook document # And: The input document contains a Neptune DB cluster resource # And: 'IamAuthEnabled' has not been provided # Then: FAIL # Scenario: 3 # Given: The input document is an AWS CloudFormation or CloudFormation hook document # And: The input document contains a Neptune DB cluster resource # And: 'IamAuthEnabled' has been provided and set to a value other than bool(true) # Then: FAIL # Scenario: 4 # Given: The input document is an AWS CloudFormation or CloudFormation hook document # And: The input document contains a Neptune DB cluster resource # And: 'IamAuthEnabled' has been provided and set to bool(true) # Then: PASS # # Constants # let NEPTUNE_CLUSTER_TYPE = "AWS::Neptune::DBCluster" let INPUT_DOCUMENT = this # # Assignments # let neptune_db_clusters = Resources.*[ Type == %NEPTUNE_CLUSTER_TYPE ] # # Primary Rules # rule neptune_cluster_iam_database_authentication_check when is_cfn_template(%INPUT_DOCUMENT) %neptune_db_clusters not empty { check(%neptune_db_clusters.Properties) << [CT.NEPTUNE.PR.1]: Require an Amazon Neptune DB cluster to have AWS Identity and Access Management (IAM) database authentication enabled [FIX]: Set the value of the 'IamAuthEnabled' parameter to true. >> } rule neptune_cluster_iam_database_authentication_check when is_cfn_hook(%INPUT_DOCUMENT, %NEPTUNE_CLUSTER_TYPE) { check(%INPUT_DOCUMENT.%NEPTUNE_CLUSTER_TYPE.resourceProperties) << [CT.NEPTUNE.PR.1]: Require an Amazon Neptune DB cluster to have AWS Identity and Access Management (IAM) database authentication enabled [FIX]: Set the value of the 'IamAuthEnabled' parameter to true. >> } # # Parameterized Rules # rule check(neptune_cluster) { %neptune_cluster { # Scenario 2 IamAuthEnabled exists # Scenarios 3 and 4 IamAuthEnabled == true } } # # Utility Rules # rule is_cfn_template(doc) { %doc { AWSTemplateFormatVersion exists or Resources exists } } rule is_cfn_hook(doc, RESOURCE_TYPE) { %doc.%RESOURCE_TYPE.resourceProperties exists }