Triage and Remediation
Remediation
Using Console
Using Console
To remediate the misconfiguration “Databases should have SSL” for GCP using GCP console, follow the below steps:
- Open the GCP Console and navigate to the Cloud SQL Instances page.
- Select the instance that you want to configure SSL for.
- Click on the “Edit” button at the top of the page.
- Scroll down to the “SSL” section and click on the “Show Configuration Options” button.
- Select the option “Server-ca.pem” for “Server Certificate” and “Client-cert.pem” for “Client Certificate”.
- Click on the “Save” button to apply the changes.
Using CLI
Using CLI
To remediate the misconfiguration “Databases Should Have SSL” for GCP using GCP CLI, follow these steps:Replace [INSTANCE_NAME] with the name of your Cloud SQL instance.Replace [INSTANCE_NAME] with the name of your Cloud SQL instance.
- Open the Cloud Shell in the GCP Console.
- Run the following command to list all the Cloud SQL instances in your project:
- Identify the instance that needs to be remediated and note down its name.
- Run the following command to enable SSL for the Cloud SQL instance:
- Verify that SSL is enabled for the Cloud SQL instance by running the following command:
- If the output of the above command shows “requireSsl: true”, then SSL has been successfully enabled for the Cloud SQL instance.
- Repeat the above steps for all the Cloud SQL instances in your project that need to have SSL enabled.
Using Python
Using Python
To remediate the misconfiguration of databases not having SSL in GCP using Python, you can follow the below steps:By following the above steps, you can remediate the misconfiguration of databases not having SSL in GCP using Python.
- First, connect to the Cloud SQL instance using the Cloud SQL Admin API and authenticate using the Google Application Default Credentials (ADC).
- Next, retrieve the current instance settings using the
instances().get()
method.
- Check if SSL is enabled for the instance. If not, enable it using the
settings().update()
method.
- Finally, verify that SSL is enabled by checking the
requireSsl
property of the instance settings.