Overview
It is recommended to enforce all incoming connections to SQL database instance to use SSL.
Rationale
SQL database connections, if successfully intercepted (through MITM - Man In The Middle), can reveal sensitive data like credentials, database queries, query outputs etc. For security, it is recommended to always use SSL encryption when connecting to your instance. This recommendation is applicable for PostgreSQL, MySQL generation 1, MySQL generation 2, and SQL Server 2017 instances.
Impact
After enforcing SSL connection, existing client will not be able to communicate with SQL server unless configured with appropriate client-certificates to communicate to SQL database instance.
Remediation guidance
From Google Cloud Console
- Go to https://console.cloud.google.com/sql/instances
- Click on an instance name to see its configuration overview
- In the left-side panel, select
Connections, then select theSecuritytab - In the SSL connections section, click
Allow only SSL connections - Under
Configure SSL server certificatesclickCreate new certificate - Under
Configure SSL client certificatesclickCreate a client certificate - Follow the instructions shown to learn how to connect to your instance
From Google Cloud CLI
To enforce SSL encryption for an instance run the command:
gcloud sql instances patch <instanceName> --require-ssl
Note
RESTART is required for type MySQL Generation 1 Instances (backendType: FIRST_GEN) to get this configuration in effect.
Default Value
By default parameter settings: ipConfiguration: requireSsl is not set which is equivalent to requireSsl:false.
References
Additional Information
By default Settings: ipConfiguration has no authorizedNetworks set/configured. In that case even if by default requireSsl is not set, which is equivalent to requireSsl:false there is no risk as instance cannot be accessed outside of the network unless authorizedNetworks are configured. However, If default for requireSsl is not updated to true any authorizedNetworks created later on will not enforce SSL only connection.
Service-wide remediation
Recommended when many resources are affected: fix the platform baseline first so new resources inherit the secure setting, then remediate the existing flagged resources in batches.
Google Cloud
Use organization or folder policies where available, shared project templates, logs and alerting baselines, and IaC modules so new resources inherit the secure setting.
Operational rollout
- Fix the baseline first at the account, subscription, project, cluster, or tenant scope that owns this control.
- Remediate the currently affected resources in batches, starting with internet-exposed and production assets.
- Re-scan and track approved exceptions with an owner and expiry date.
Query logic
These are the stored checks tied to this control.
Cloud SQL database instances require all incoming connections to use SSL
Connectors
Covered asset types
Expected check: eq []
cloudSqlInstances(where:{settingsIPConfigurationRequireSsl:false}){...AssetFragment}
Google Cloud