# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 --- description: | ### Document Name - ASR-CIS_1.2.0_1.4 ## What does this document do? This document disables active keys that have not been rotated for more than 90 days. Note that this remediation is **DISRUPTIVE**. ## 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 ## Documentation Links * [CIS v1.2.0 1.4](https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-cis-controls.html#securityhub-cis-controls-1.4) schemaVersion: '0.3' assumeRole: '{{ AutomationAssumeRole }}' outputs: - ParseInput.AffectedObject - Remediation.Output parameters: Finding: type: StringMap description: The input from the Orchestrator Step function for the 1.4 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+=,.@-]+$' MaxCredentialUsageAge: type: String description: (Required) Maximum number of days a key can be unrotated. The default value is 90 days. allowedPattern: ^(?:[1-9]\d{0,3}|10000)$ default: "90" RemediationRoleName: type: String default: "SO0111-RevokeUnrotatedKeys" allowedPattern: '^[\w+=,.@-]+$' mainSteps: - name: ParseInput action: 'aws:executeScript' outputs: - Name: IAMUser Selector: $.Payload.resource_id Type: String - Name: IAMResourceId Selector: $.Payload.details.AwsIamUser.UserId 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 inputs: InputPayload: Finding: '{{Finding}}' parse_id_pattern: '^arn:(?:aws|aws-cn|aws-us-gov):iam::\d{12}:user(?:(?:\u002F)|(?:\u002F[\u0021-\u007F]{1,510}\u002F))([\w+=,.@-]{1,64})$' expected_control_id: - '1.4' Runtime: python3.8 Handler: parse_event Script: |- %%SCRIPT=common/parse_input.py%% isEnd: false - name: Remediation action: 'aws:executeAutomation' isEnd: false inputs: DocumentName: ASR-RevokeUnrotatedKeys RuntimeParameters: IAMResourceId: '{{ ParseInput.IAMResourceId }}' AutomationAssumeRole: 'arn:{{global:AWS_PARTITION}}:iam::{{global:ACCOUNT_ID}}:role/{{RemediationRoleName}}' MaxCredentialUsageAge: '{{MaxCredentialUsageAge}}' - name: UpdateFinding action: 'aws:executeAwsApi' inputs: Service: securityhub Api: BatchUpdateFindings FindingIdentifiers: - Id: '{{ParseInput.FindingId}}' ProductArn: '{{ParseInput.ProductArn}}' Note: Text: 'Deactivated unrotated keys for {{ ParseInput.IAMUser }}.' UpdatedBy: 'ASR-CIS_1.2.0_1.4' Workflow: Status: RESOLVED description: Update finding isEnd: true