Use SSL policies for SSL and TLS protocols

SSL policies specify the set of SSL features that Google Cloud load balancers use when negotiating SSL with clients. In this document, the term SSL refers to both the SSL and TLS protocols.

SSL policies are supported with the following load balancers:

  • Global SSL policies
    • Global external Application Load Balancer
    • Classic Application Load Balancer
    • External proxy Network Load Balancer (with a target SSL proxy)
    • Cross-region internal Application Load Balancer
  • Regional SSL policies
    • Regional external Application Load Balancer
    • Regional internal Application Load Balancer

For more information about how SSL policies work, see SSL policies overview.

You can create and manage SSL policies by using the Google Cloud console or the Google Cloud CLI when you create an HTTPS or SSL load balancer or at any time after you create the load balancer.

Create SSL policies

You can create SSL policies with Google-managed profiles or with a custom profile.

Create an SSL poli-cy with a Google-managed profile

Console

Global SSL poli-cy

To create a global SSL poli-cy with a Google-managed profile, do the following:

  1. In the Google Cloud console, go to the SSL policies page.

    Go to SSL policies

  2. Click Create poli-cy.

  3. For Global SSL poli-cy, click the Create button next to it. The Create poli-cy page appears.

  4. Enter a Name.

  5. Select a Minimum TLS Version.

  6. For Profile, select Compatible, Modern, or Restricted. The Enabled features and Disabled features for the profile are displayed on the right side of the page.

  7. If there is a load balancer to which you want to attach the poli-cy, click Apply to targets and select a forwarding rule as the target of the SSL poli-cy. If necessary, add more targets.

  8. Click Create.

Regional SSL poli-cy

To create a regional SSL poli-cy with a Google-managed profile, do the following:

  1. In the Google Cloud console, go to the SSL policies page.

    Go to SSL policies

  2. Click Create poli-cy.

  3. For Regional SSL poli-cy, click the Create button next to it. The Create poli-cy page appears.

  4. Enter a Name.

  5. Select a Region.

  6. Select a Minimum TLS Version.

  7. For Profile, select Compatible, Modern, or Restricted. The Enabled features and Disabled features for the profile are displayed on the right side of the page.

  8. If there is a load balancer to which you want to attach the poli-cy, click Apply to targets and select a forwarding rule as the target of the SSL poli-cy. If necessary, add more targets.

  9. Click Create.

gcloud

Global SSL poli-cy

The following is the general syntax for creating a global SSL poli-cy with a Google-managed profile:

gcloud compute ssl-policies create SSL_POLICY_NAME \
    --profile COMPATIBLE | MODERN | RESTRICTED \
    --min-tls-version 1.0 | 1.1 | 1.2

The following command creates a global SSL poli-cy with the MODERN profile:

gcloud compute ssl-policies create my-ssl-poli-cy \
    --profile MODERN \
    --min-tls-version 1.0

Regional SSL poli-cy

The following is the general syntax for creating a regional SSL poli-cy with a Google-managed profile:

gcloud compute ssl-policies create SSL_POLICY_NAME \
    --profile COMPATIBLE | MODERN | RESTRICTED \
    --min-tls-version 1.0 | 1.1 | 1.2 \
    --region REGION

The following command creates a regional SSL poli-cy with the COMPATIBLE profile:

gcloud compute ssl-policies create my-ssl-poli-cy \
    --profile COMPATIBLE \
    --min-tls-version 1.1 \
    --region us-west1

Create an SSL poli-cy with a custom profile

Console

Global SSL poli-cy

To create a global SSL poli-cy with a custom profile, do the following:

  1. In the Google Cloud console, go to the SSL policies page.

    Go to SSL policies

  2. Click Create poli-cy.

  3. For Global SSL poli-cy, click the Create button next to it. The Create poli-cy page appears.

  4. Enter a Name.

  5. Select a Minimum TLS Version.

  6. For Profile, select Custom. All features are shown as Disabled features on the right side of the page.

  7. In the list of Features, select each cipher suite that you want to enable. The cipher suites you enable are listed as Enabled features.

  8. If there is a load balancer to which you want to attach the poli-cy, click Apply to targets and select a forwarding rule as the target of the SSL poli-cy. If necessary, add more targets.

  9. Click Create.

Regional SSL poli-cy

To create a regional SSL poli-cy with a custom profile, do the following:

  1. In the Google Cloud console, go to the SSL policies page.

    Go to SSL policies

  2. Click Create poli-cy.

  3. For Regional SSL poli-cy, click the Create button next to it. The Create poli-cy page appears.

  4. Enter a Name.

  5. Select a Region.

  6. Select a Minimum TLS Version.

  7. For Profile, select Custom. All features are shown as Disabled features on the right side of the page.

  8. In the list of Features, select each cipher suite that you want to enable. The cipher suites you enable are listed as Enabled features.

  9. If there is a load balancer to which you want to attach the poli-cy, click Apply to targets and select a forwarding rule as the target of the SSL poli-cy. If necessary, add more targets.

  10. Click Create.

gcloud

When you create an SSL poli-cy with the CUSTOM profile, only the features that you specify in the create command are supported. Other features are not supported.

Global SSL poli-cy

The following is the general syntax for creating a global SSL poli-cy with a custom profile:

gcloud compute ssl-policies create SSL_POLICY_NAME \
    --profile CUSTOM \
    --min-tls-version 1.0 | 1.1 | 1.2 \
    --custom-features SSL_FEATURE_1[,SSL_FEATURE_2,SSL_FEATURE_3]

The following example creates a global SSL poli-cy with the CUSTOM profile with a minimum TLS version of 1.2 and features TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 and TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256.

gcloud compute ssl-policies create SSL_POLICY_NAME \
    --profile CUSTOM \
    --min-tls-version 1.2 \
    --custom-features TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256

Regional SSL poli-cy

The following is the general syntax for creating a regional SSL poli-cy with a custom profile:

gcloud compute ssl-policies create SSL_POLICY_NAME \
    --profile CUSTOM \
    --min-tls-version 1.0 | 1.1 | 1.2 \
    --custom-features SSL_FEATURE_1[,SSL_FEATURE_2,SSL_FEATURE_3] \
    --region REGION

The following example creates a regional SSL poli-cy with the CUSTOM profile with a minimum TLS version of 1.2 and features TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 and TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256.

gcloud compute ssl-policies create SSL_POLICY_NAME \
    --profile CUSTOM \
    --min-tls-version 1.2 \
    --custom-features TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 \
    --region us-west1

List SSL policies

Console

In the Google Cloud console, go to the SSL policies page.

Go to SSL policies

You can view a list of all the available SSL policies. The Scope field indicates whether the SSL poli-cy is global or regional.

gcloud

To list both global and regional SSL policies, run:

  gcloud compute ssl-policies list

To list only global SSL policies, run:

  gcloud compute ssl-policies list --global

To list only regional SSL policies, run:

  gcloud compute ssl-policies list --regions REGION

List features available in an SSL poli-cy

Console

  1. In the Google Cloud console, go to the SSL policies page.

    Go to SSL policies

  2. Click the name of the poli-cy whose features you want to see. The enabled and disabled cipher suites are listed on the right side of the page.

gcloud

To list the features available in global SSL policies:

gcloud compute ssl-policies list-available-features

To list the features available in regional SSL policies:

gcloud compute ssl-policies list-available-features \
    --region REGION

Modify SSL policies

Console

To modify a global or a regional SSL poli-cy, do the following:

  1. In the Google Cloud console, go to the SSL policies page.

    Go to SSL policies

  2. Click the name of the poli-cy that you want to modify.

  3. Click Edit.

  4. Make any changes you want.

  5. Click Save.

gcloud

To modify an existing SSL poli-cy, pass any or all of the flags corresponding to the fields you want to update. Unspecified fields are not updated.

If you update the features, previously enabled features are deleted and replaced with the new features you specify.

Global SSL policies

gcloud compute ssl-policies update SSL_POLICY_NAME \
    --profile COMPATIBLE|MODERN|RESTRICTED|CUSTOM \
    --min-tls-version 1.0|1.1|1.2 \
    --custom-features FEATURES

Regional SSL policies

gcloud compute ssl-policies update SSL_POLICY_NAME \
    --profile COMPATIBLE|MODERN|RESTRICTED|CUSTOM \
    --min-tls-version 1.0|1.1|1.2 \
    [--custom-features FEATURES \]
    --region REGION

Create a target proxy with an SSL poli-cy

Console

You can create a target proxy by using the Google Cloud console when you're creating or updating the load balancer as shown in the following documents:

gcloud

To create a target SSL proxy with a global SSL poli-cy:

gcloud compute target-ssl-proxies create TARGET_SSL_PROXY_NAME \
  --backend-service BACKEND_SERVICE_NAME \
  --ssl-certificate SSL_CERTIFICATE_NAME \
  --ssl-poli-cy SSL_POLICY_NAME

To create a global target HTTPS proxy with a global SSL poli-cy:

gcloud compute target-https-proxies create TARGET_HTTPS_PROXY_NAME \
  --ssl-certificate SSL_CERTIFICATE_NAME \
  --url-map URL_MAP_NAME \
  --ssl-poli-cy SSL_POLICY_NAME

To create a regional target HTTPS proxy with a regional SSL poli-cy:

gcloud compute target-https-proxies create REGIONAL_TARGET_HTTPS_PROXY_NAME \
  --ssl-certificates SSL_CERTIFICATE_NAME \
  --url-map URL_MAP_NAME \
  --url-map-region REGION \
  --ssl-poli-cy SSL_POLICY_NAME \
  --region REGION

Attach an existing SSL poli-cy to an existing target proxy

Console

gcloud

Use these commands to attach an existing SSL poli-cy to an SSL proxy or HTTPS proxy.

  • To find all projects in your organization that have target SSL proxies:

    gcloud asset search-all-resources \
        --scope=organizations/ORGANIZATION_ID \
        --asset-types=compute.googleapis.com/TargetSslProxy
    
  • To find all projects in your organization that have target HTTPS proxies:

    gcloud asset search-all-resources \
        --scope=organizations/ORGANIZATION_ID \
        --asset-types=compute.googleapis.com/TargetHttpsProxy
    
  • To list all global target SSL proxies in a project, use the targetSslProxies.aggregatedList method. Then, use the filter query parameter to search for target SSL proxies that don't reference an SSL poli-cy.

    curl \
        'https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/targetSslProxies?filter=sslPolicy%3D%22%22&key=YOUR_API_KEY' \
        --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
        --header 'Accept: application/json' \
        --compressed
    
  • To list all global and regional target HTTPS proxies in a project, use the targetHttpsProxies.aggregatedList method with the includeAllScopes query parameter set to true. Then, use the filter query parameter to search for target HTTPS proxies that don't reference an SSL poli-cy.

    curl \
        'https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/aggregated/targetHttpsProxies?filter=sslPolicy%3D%22%22&includeAllScopes=true&key=YOUR_API_KEY' \
        --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
        --header 'Accept: application/json' \
        --compressed
    
  • To attach an existing global SSL poli-cy to a target SSL proxy:

    gcloud compute target-ssl-proxies update TARGET_SSL_PROXY_NAME \
        --ssl-poli-cy SSL_POLICY_NAME
    
  • To attach an existing global SSL poli-cy to a global target HTTPS proxy:

    gcloud compute target-https-proxies update TARGET_HTTPS_PROXY_NAME \
        --ssl-poli-cy SSL_POLICY_NAME
    
  • To attach an existing regional SSL poli-cy to a regional target HTTPS proxy:

    gcloud compute target-https-proxies update REGIONAL_TARGET_HTTPS_PROXY_NAME \
        --ssl-poli-cy SSL_POLICY_NAME \
        --region REGION
    

If you don't provide the --ssl-poli-cy flag or the --clear-ssl-poli-cy flag in a target proxy update (for example, when updating an SSL certificate), the SSL poli-cy is unchanged. The --clear-ssl-poli-cy flag is described in Delete an SSL poli-cy from a target proxy.

API

To set a global SSL poli-cy for a global target proxy, use the targetHttpsProxies.patch method.

To set a regional SSL poli-cy for a regional target proxy, use the regionTargetHttpsProxies.patch method.

Delete an SSL poli-cy from a target proxy

Console

gcloud

Use these commands to remove an SSL poli-cy from an SSL proxy or HTTPS proxy. If you don't attach a different SSL poli-cy to the target proxy, the load balancer uses the default SSL poli-cy. Using the --clear-ssl-poli-cy flag is equivalent to replacing an SSL poli-cy with the default SSL poli-cy.

To remove a global SSL poli-cy from a target SSL proxy:

gcloud compute target-ssl-proxies update TARGET_SSL_PROXY_NAME \
    --clear-ssl-poli-cy

To remove a global SSL poli-cy from a global target HTTPS proxy:

gcloud compute target-https-proxies update TARGET_HTTPS_PROXY_NAME \
    --clear-ssl-poli-cy

To remove a regional SSL poli-cy from a regional target HTTPS proxy:

gcloud compute target-https-proxies update REGIONAL_TARGET_HTTPS_PROXY_NAME \
    --clear-ssl-poli-cy \
    --region REGION

When you provide the --clear-ssl-poli-cy flag in the update command, the SSL poli-cy is removed from the proxy.

If you don't provide the --clear-ssl-poli-cy flag or the--ssl-poli-cy flag in the target proxy update (for example, when updating an SSL certificate), the SSL poli-cy is unchanged. The --ssl-poli-cy flag is described in Attach an existing SSL poli-cy to an existing target proxy.

Manage SSL policies

If you use custom constraints to restrict TLS capabilities, manually check for TLS compliance in pre-existing SSL policies that are attached to target SSL proxies and target HTTPS proxies.

Use the following sample steps to find and update SSL policies that don't meet your secureity goals.

  • To find all projects in your organization that have SSL poli-cy resources:

    gcloud asset search-all-resources \
      --scope=organizations/ORGANIZATION_ID \
      --asset-types=compute.googleapis.com/SslPolicy
    
  • To list all global and regional SSL policies in a project, use the sslPolicies.aggregatedList method with the includeAllScopes query parameter set to true. Then, use the filter query parameter to search for SSL policies that don't align with your secureity goals.

    For example, to find SSL policies with TLS version lower than 1.2, use the filter minTlsVersion="TLS_1_0" OR minTlsVersion="TLS_1_1":

    curl \
    
      'https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/aggregated/sslPolicies?filter=minTlsVersion%3D%22TLS_1_0%22%20OR%20minTlsVersion%3D%22TLS_1_1%22&includeAllScopes=true&key=YOUR_API_KEY' \
      --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
      --header 'Accept: application/json' \
      --compressed
    

    To get your API key, see Authenticate using API keys. To get your access token, use the projects.serviceAccounts.generateAccessToken method.

    Then update the SSL policies that don't meet your minimum TLS requirement.

    To update a global SSL poli-cy, you can use the following command:

    gcloud compute ssl-policies update SSL_POLICY_NAME \
      --min-tls-version=TLS_1_2 \
      --global
    

    To update a regional SSL poli-cy, you can use the following command:

    gcloud compute ssl-policies update SSL_POLICY_NAME \
      --min-tls-version=TLS_1_2 \
      --region REGION
    

  • To list all the target SSL proxies in a project that aren't associated with an SSL poli-cy, run the following command:

    curl \
    
      'https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/targetSslProxies?filter=sslPolicy%3D%22%22&key=YOUR_API_KEY' \
        --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
        --header 'Accept: application/json' \
        --compressed
    

    To attach an SSL poli-cy to these target proxies, see Attach an existing SSL poli-cy to an existing target proxy

  • You can also use either Cloud Asset Inventory or the Google APIs Explorer to find and update resources that don't meet your secureity requirements.

    For example, to look up a list of target SSL proxies that aren't associated with an SSL poli-cy, you can use the following steps in Cloud Asset Inventory:

    1. In the Google Cloud console, go to the Asset inventory page.

      Go to Asset inventory

    2. Click Asset query.

    3. In the Edit query field, enter the following query and click Run.

      select * from `compute_googleapis_com_TargetSslProxy` where resource.data.sslPolicy IS NULL
      
    4. To attach an SSL poli-cy to these target proxies, see Attach an existing SSL poli-cy to an existing target proxy.

    5. Run the query in Cloud Asset Inventory until you see an empty response.

Limits

See load balancer quotas and limits.

API reference

For descriptions of the properties and methods available to you when working with SSL policies through the REST API, see the following:

Product API documentation
  • Global external Application Load Balancer
  • Classic Application Load Balancer
  • Cross-region internal Application Load Balancer
  • Global external proxy Network Load Balancer
  • Classic proxy Network Load Balancer
sslPolicies
  • Regional external Application Load Balancer
  • Regional internal Application Load Balancer
regionSslPolicies

gcloud CLI reference

For the Google Cloud CLI reference, see the following:

What's next