Skip to main content

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration “AWS Config Log File Delivery Should Be Configured” in AWS, you can follow the below steps:
  1. Open the AWS Management Console and navigate to the AWS Config service.
  2. Click on the “Settings” button in the left-hand menu.
  3. Scroll down to the “Resource Types to Record” section and click on the “Edit” button.
  4. Check the box next to “AWS::S3::Bucket” to enable logging for S3 buckets.
  5. Click on the “Save” button to save the changes.
This will enable AWS Config to log all changes made to S3 buckets in your AWS account. You can also configure logging for other resource types by checking the appropriate boxes in the “Resource Types to Record” section.

To remediate the misconfiguration of AWS Config Log File Delivery, please follow the below steps:Step 1: Open the AWS CLI and run the following command to create an S3 bucket that will store the AWS Config logs:
Note: Replace <bucket-name> with a unique name for your S3 bucket and <region> with the region where you want to create the bucket.Step 2: Run the following command to create an IAM role that AWS Config will use to access the S3 bucket:
Note: Create a file named trust-policy.json with the following content:
Step 3: Run the following command to attach the required policy to the IAM role:
Step 4: Run the following command to enable AWS Config and specify the S3 bucket and IAM role:
Note: Replace <bucket-name> with the name of the S3 bucket you created in Step 1 and <account-id> with your AWS account ID.Step 5: Verify that AWS Config is enabled and the S3 bucket and IAM role are configured correctly by running the following command:
This should return a JSON object that includes the details of the delivery channel you just created.By following the above steps, you can remediate the misconfiguration of AWS Config Log File Delivery.
To remediate the AWS Config Log File Delivery misconfiguration using Python, you can follow these steps:
  1. Import the necessary AWS SDK libraries in your Python script. For example, you can use the boto3 library to interact with AWS services.
  1. Create a boto3 client for AWS Config service.
  1. Check if the AWS Config Log File Delivery is enabled or not.
  1. If AWS Config Log File Delivery is not enabled, create a new delivery channel.
Note: Replace my-delivery-channel and my-s3-bucket with your own delivery channel name and S3 bucket name respectively.
  1. Verify that the AWS Config Log File Delivery is enabled.
  1. Run the Python script to remediate the AWS Config Log File Delivery misconfiguration.
This should enable the AWS Config Log File Delivery and remediate the misconfiguration.
Replace:
  • CONFIG_LOGS_BUCKET_NAME with the S3 bucket used by your AWS Config delivery channel.
  • AWS_ACCOUNT_ID with your 12-digit AWS account ID.
This Terraform resource replaces the entire existing bucket policy on that S3 bucket; if you already have other statements, merge them into the Statement array instead of overwriting them.After applying, terraform plan should show either creation of aws_s3_bucket_policy.config_logs_policy or an in-place policy update whose JSON includes the two AWSConfigBucketPermissionsCheck and AWSConfigBucketDelivery statements.