Skip to main content

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration of “Restrict Default Google-Managed Encryption for Cloud SQL Instances” in GCP using GCP console, follow the below steps:
  1. Login to your GCP console.
  2. Navigate to the Cloud SQL Instances page.
  3. Select the instance for which you want to remediate the misconfiguration.
  4. Click on the “Edit” button at the top of the page.
  5. Scroll down to the “Encryption” section.
  6. Under the “Encryption in transit” section, select “Require SSL” option.
  7. Under the “Encryption at rest” section, select “Customer-managed encryption key” option.
  8. Provide the required details for Customer-managed encryption key, such as key name, key version and key location.
  9. Click on the “Save” button to save the changes.
  10. Verify the changes by checking the “Encryption” section on the Cloud SQL instance page.
By following the above steps, you have successfully remediated the misconfiguration of “Restrict Default Google-Managed Encryption for Cloud SQL Instances” in GCP using GCP console.

To remediate the misconfiguration of “Restrict Default Google-Managed Encryption for Cloud SQL Instances” for GCP using GCP CLI, you need to follow the below steps:
  1. Open the Google Cloud Shell by clicking on the Activate Cloud Shell button present on the top right corner of the Google Cloud Console.
  2. Once you have opened the Google Cloud Shell, run the following command to set the project where you want to remediate the misconfiguration:
    Replace [PROJECT_ID] with the ID of the project where you want to remediate the misconfiguration.
  3. Next, run the following command to list all the Cloud SQL instances in the project:
  4. Identify the Cloud SQL instance for which you want to remediate the misconfiguration and note down its name.
  5. Run the following command to update the Cloud SQL instance configuration and restrict default Google-managed encryption:
    Replace [INSTANCE_NAME] with the name of the Cloud SQL instance for which you want to remediate the misconfiguration.
  6. After running the above command, the default Google-managed encryption will be restricted for the Cloud SQL instance. Note: The above command also enforces SSL connections and sets the backup start time to 00:00.
By following the above steps, you can remediate the misconfiguration of “Restrict Default Google-Managed Encryption for Cloud SQL Instances” for GCP using GCP CLI.
To remediate the “Restrict Default Google-Managed Encryption for Cloud SQL Instances” misconfiguration in GCP using Python, you can follow the below steps:
  1. Import the necessary libraries:
  1. Authenticate and authorize the client:
  1. Get the list of Cloud SQL instances:
  1. Iterate over the instances and update the settings:
  1. Save the Python script and run it using the command:
This will remediate the “Restrict Default Google-Managed Encryption for Cloud SQL Instances” misconfiguration in GCP.
It is not currently possible to enforce “no Google‑managed encryption keys” for all Cloud SQL instances at the organization level via IAM / Org Policy in Terraform, because Google does not expose an organization policy constraint for this behavior.Terraform can only set CMEK per–instance (on google_sql_database_instance using disk_encryption_configuration.kms_key_name), not an org‑wide enforcement. To approximate the control you must either:
  • Create all Cloud SQL instances with CMEK in Terraform, and
  • Use an external control (organization policy if/when Google adds such a constraint, or an out‑of‑band scanner/validator) to detect/deny non‑CMEK instances.
The actual org‑wide restriction you are asking for cannot be modeled on the google_organization_policy resource today, so there is no valid HCL snippet that will do what your check describes. You would need to enforce this via the GCP Console/CLI only if and when Google provides a corresponding org policy constraint.