# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 --- description: | ### Document Name - ASR-CIS_1.2.0_2.8 ## What does this document do? Enables rotation for customer-managed KMS keys. ## Input Parameters * Finding: (Required) Security Hub finding details JSON * AutomationAssumeRole: (Required) The ARN of the role that allows Automation to perform the actions on your behalf. ## Output Parameters * Remediation.Output - Remediation results ## Documentation Links * [CIS v1.2.0 2.8](https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-cis-controls.html#securityhub-cis-controls-2.8) schemaVersion: '0.3' assumeRole: '{{ AutomationAssumeRole }}' outputs: - ParseInput.AffectedObject - Remediation.Output parameters: Finding: type: StringMap description: The input from the Orchestrator Step function for the 2.8 finding AutomationAssumeRole: type: String description: (Required) The ARN of the role that allows Automation to perform the actions on your behalf. allowedPattern: '^arn:(?:aws|aws-us-gov|aws-cn):iam::\d{12}:role/[\w+=,.@-]+$' RemediationRoleName: type: String default: "SO0111-EnableKeyRotation" allowedPattern: '^[\w+=,.@-]+$' mainSteps: - name: ParseInput action: 'aws:executeScript' outputs: - Name: KMSKeyId Selector: $.Payload.resource_id Type: String - Name: FindingId Selector: $.Payload.finding_id Type: String - Name: ProductArn Selector: $.Payload.product_arn Type: String - Name: AffectedObject Selector: $.Payload.object Type: StringMap - Name: RemediationRegion Selector: $.Payload.resource_region Type: String - Name: RemediationAccount Selector: $.Payload.account_id Type: String inputs: InputPayload: Finding: '{{Finding}}' parse_id_pattern: '^arn:(?:aws|aws-cn|aws-us-gov):kms:(?:[a-z]{2}(?:-gov)?-[a-z]+-\d):\d{12}:key/([A-Za-z0-9-]{36})$' expected_control_id: - '2.8' Runtime: python3.8 Handler: parse_event Script: |- %%SCRIPT=common/parse_input.py%% - name: Remediation action: 'aws:executeAutomation' inputs: DocumentName: ASR-EnableKeyRotation TargetLocations: - Accounts: [ '{{ParseInput.RemediationAccount}}' ] Regions: [ '{{ParseInput.RemediationRegion}}' ] ExecutionRoleName: '{{RemediationRoleName}}' RuntimeParameters: KeyId: '{{ParseInput.KMSKeyId}}' AutomationAssumeRole: 'arn:{{global:AWS_PARTITION}}:iam::{{global:ACCOUNT_ID}}:role/{{RemediationRoleName}}' - name: UpdateFinding action: 'aws:executeAwsApi' inputs: Service: securityhub Api: BatchUpdateFindings FindingIdentifiers: - Id: '{{ParseInput.FindingId}}' ProductArn: '{{ParseInput.ProductArn}}' Note: Text: 'Enabled KMS Customer Managed Key rotation for {{ParseInput.KMSKeyId}}' UpdatedBy: 'ASR-CIS_1.2.0_2.8' Workflow: Status: RESOLVED description: Update finding isEnd: true