Skip to main content

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration of an SQS Queue not enforcing server-side encryption in AWS using the AWS Management Console, follow these step-by-step instructions:
  1. Sign in to the AWS Management Console:
  2. Navigate to the Amazon SQS service:
    • From the AWS Management Console, search for “SQS” or find the “Simple Queue Service” under the “Messaging” section.
  3. Select the SQS Queue requiring encryption:
    • Click on the SQS Queue that needs to enforce server-side encryption.
  4. Configure Server-Side Encryption:
    • In the SQS Queue details page, click on the “Configure Queue” button.
  5. Enable Server-Side Encryption:
    • Under the “Server-side encryption” section, select the option to enable server-side encryption.
  6. Choose Encryption Key:
    • Choose the Customer Master Key (CMK) from AWS Key Management Service (KMS) that you want to use for encrypting the messages in the SQS Queue.
  7. Save Changes:
    • Click on the “Save Changes” button to apply the server-side encryption configuration to the SQS Queue.
  8. Verify Encryption Configuration:
    • To ensure that server-side encryption is enforced, you can check the SQS Queue settings to confirm that encryption is enabled.
By following these steps, you have successfully enforced server-side encryption for the SQS Queue in AWS using the AWS Management Console. This will help in securing the messages stored in the queue and ensure compliance with security best practices.

To remediate the misconfiguration of SQS Queue not enforcing server-side encryption in AWS using AWS CLI, follow these steps:
  1. List all the existing SQS Queues to identify the one that needs to be remediated:
  1. Get the attributes of the specific SQS Queue that needs to enforce server-side encryption. Replace queue-url with the URL of the SQS Queue:
  1. Enable server-side encryption on the SQS Queue. Replace queue-url with the URL of the SQS Queue:
  1. Verify that server-side encryption is enabled on the SQS Queue by checking the attributes again:
By following these steps, you can successfully remediate the misconfiguration of SQS Queue not enforcing server-side encryption in AWS using AWS CLI.
To enforce server-side encryption for an AWS SQS queue using Python, you can follow these steps:
  1. Import the necessary libraries:
  1. Initialize the SQS client:
  1. Get the URL of the SQS queue:
  1. Update the SQS queue attributes to enable server-side encryption:
Replace YOUR_QUEUE_URL, YOUR_KMS_KEY_ID, YOUR_QUEUE_ARN, and YOUR_ACCOUNT_ID with your actual values.
  1. Verify that the server-side encryption is enabled for the SQS queue:
By following these steps, you can remediate the misconfiguration and enforce server-side encryption for an AWS SQS queue using Python.
Substitute:
  • THIS_QUEUE with your Terraform local name.
  • REPLACE_WITH_QUEUE_NAME with the actual SQS queue name.
  • For SSE-KMS, change alias/aws/sqs if you want a customer-managed KMS key.
This encryption change is an in-place update for an existing queue (no forced replacement), though it can affect permissions for producers/consumers (they must satisfy KMS requirements when using SSE-KMS).After updating the code and running terraform plan, you should see:
  • either sqs_managed_sse_enabled changing from false (or null) to true,
  • or kms_master_key_id being added/updated (and possibly kms_data_key_reuse_period_seconds),
    with the queue resource being updated in place, not recreated.