Skip to main content

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration “CloudTrail Must Be Enabled For All Regions” for AWS, you can follow the below steps:
  1. Log in to your AWS Management Console.
  2. Go to the AWS CloudTrail service homepage.
  3. Click on the “Trails” option from the left-hand menu.
  4. Select the trail that you want to modify from the list of trails.
  5. Click on the “Edit” button.
  6. In the “Management events” section, select “All” from the “Apply trail to all regions” dropdown.
  7. Click on the “Save” button to save the changes.
This configuration change will enable CloudTrail for all regions in your AWS account.

To remediate the misconfiguration “CloudTrail Must Be Enabled For All Regions” for AWS using AWS CLI, follow these steps:
  1. Open the AWS CLI on your local machine or EC2 instance.
  2. Run the following command to enable CloudTrail in all regions:
    This command will use the describe-trails operation to get a list of all CloudTrail trails in your account, and then use the update-trail operation to enable multi-region support for each trail.
  3. Wait for the command to complete and verify that CloudTrail is now enabled for all regions. You can do this by going to the CloudTrail console and checking that there is at least one trail with multi-region support enabled.
That’s it! You have successfully remediated the misconfiguration “CloudTrail Must Be Enabled For All Regions” for AWS using AWS CLI.
To remediate the “CloudTrail Must Be Enabled For All Regions” misconfiguration for AWS using Python, you can use the boto3 library to enable CloudTrail in all regions.Here are the steps to remediate the misconfiguration:
  1. Import the necessary libraries:
  1. Create a boto3 client for CloudTrail:
  1. Get a list of all regions using the boto3 client for EC2:
  1. Loop through each region and enable CloudTrail:
This code will create a CloudTrail trail in each region with the specified settings. If a trail already exists in a region, it will throw an error which will be caught and printed to the console.Note: You will need to replace the S3BucketName, CloudWatchLogsLogGroupArn, CloudWatchLogsRoleArn, and Tags values with your own values.
This change is an in-place update of the existing trail; it does not force resource replacement.To verify, terraform plan should show is_multi_region_trail and enable_logging changing from false (or unset) to true on the aws_cloudtrail resource.