This page describes how Cloud SQL uses self-managed Secure Socket Layer (SSL)/Transport Layer Security(TLS) certificates to securely connect to Cloud SQL instances.
Overview
Cloud SQL supports connecting to an instance using the Transport Layer Security (SSL/TLS) protocol. Data in transit inside a physical boundary controlled by or on behalf of Google is generally authenticated but might not be encrypted by default. If you connect to an instance using its public IP address, you must enforce SSL/TLS certificates so that the data is secure during transmission. SSL/TLS is the standard protocol for encryption of data sent over the internet. If your data isn't encrypted, anyone can examine your packets and read confidential information.
SSL/TLS certificates
A server Certificate Authority (CA) certificate is required in SSL connections. Cloud SQL creates a server certificate automatically when you create your instance. As long as the server certificate is valid, you do not need to actively manage your server certificate. However, the certificate has an expiration date of 10 years; after that date, it is no longer valid, and clients are not able to establish a secure connection to your instance using that certificate. You can also manually create a new one.
How server certificate rotation works
Cloud SQL provides a way to rotate your server certificate, so a new certificate can be seamlessly swapped in before the old certificate expires.
About three months before the server certificate expires for a Cloud SQL instance, the project owners receive an email from Cloud SQL, stating that the certificate rotation process has begun for that instance. The email provides the name of the instance, and says that Cloud SQL has added a new server certificate to the project. The existing server certificate continues to function normally. In effect, the instance has two server certificates during this period.
Before the current certificate expires, download the new server-ca.pem
file,
which contains the certificate information for both the current and the new
server certificates. Update your SQL Server clients to use the new
file, by copying it to all of your SQL Server client host machines, replacing
the existing file.
After all of your SQL Server clients have been updated, send a command to the Cloud SQL instance to rotate to the new server certificate. Once that is done, the old server certificate is no longer recognized, and only the new server certificate can be used.
Enforce SSL/TLS encryption
Enforcing SSL ensures that all connections are encrypted.Use authorized networks
If your Cloud SQL instance is using a public IP address, you need to add the IP addresses of your SQL Server clients as authorized networks when configuring SSL/TLS.
In this case, SQL Server clients are only authorized to connect if their IP
addresses are added to this list. The IP addresses can limited to a single
endpoint or consist of a range in CIDR format. For example:
10.50.51.3
or 10.50.51.0/26
.
SSL certificate expiry
SSL certificates associated with Cloud SQL instances come with an expiry period of 10 years. On expiry, perform SSL certificate rotation. You can also reset the SSL configuration of your Cloud SQL instance at any time.
What's next
Configure SSL/TLS on your Cloud SQL instance.
Learn more about how encryption is handled in Google Cloud.
- Learn more about how SQLServer uses encrypted connections.
- Manage SSL/TLS on your Cloud SQL instance.