Skip to content

Commit

Permalink
Merge pull request #12
Browse files Browse the repository at this point in the history
Updated CIS 3.2 and CIS 4.7
  • Loading branch information
prasanna7401 authored Jan 9, 2025
2 parents 6aa5ce4 + 0d4dfd3 commit 0c2bec9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion main/cisPlaybook.py
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,7 @@ def cis_4_7(event, target_session, region, target_account_id, sns_topic_arn, log
print(f"Task to be implemented on {target_account_id} in {region}")

# --- REMEDIATION CODE ---
filter_pattern = '{ $.eventSource = kms* && $.errorMessage = "* is pending deletion."}'
filter_pattern = '{($.eventSource=kms.amazonaws.com) && (($.eventName=DisableKey) || ($.eventName=ScheduleKeyDeletion))}'

# Important Variables
filter_name = 'CMKDisablingDeletionFilter'
Expand Down
5 changes: 3 additions & 2 deletions main/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,11 @@ def lambda_handler(event, context):

# CIS 3.2 (CloudTrail log file validation should be enabled) -- AUTO-Remediation upon invoke
if(security_control_id=="CloudTrail.4"):
trail_name = event['detail']['findings'][0]['Resources'][0]['Details']['AwsCloudTrailTrail']['Name']
# trail_name = event['detail']['findings'][0]['Resources'][0]['Details']['AwsCloudTrailTrail']['Name']
trail_arn = event['detail']['findings'][0]['Resources'][0]['Id']
log_validation_status = event['detail']['findings'][0]['Resources'][0]['Details']['AwsCloudTrailTrail']['LogFileValidationEnabled']
if not log_validation_status:
cis_3_2(event, target_session, region, target_account_id, sns_topic_arn, trail_name)
cis_3_2(event, target_session, region, target_account_id, sns_topic_arn, trail_arn)

# CIS 3.3 (Ensure the S3 bucket used to store CloudTrail logs is not publicly accessible) -- AUTO-Remediation upon invoke
if(security_control_id=="CloudTrail.6"):
Expand Down

0 comments on commit 0c2bec9

Please sign in to comment.