限制 TLS 加密套件

本页面介绍了如何通过拒绝使用某些不太安全的传输层安全协议 (TLS) 加密套件发出的请求,来阻止对 Google Cloud 资源的访问。

概览

Google Cloud 支持多个 TLS 加密套件。 为满足安全性或合规性要求,您可能需要拒绝来自使用安全性较低的 TLS 加密套件的客户端的请求。

此功能由 gcp.restrictTLSCipherSuites 组织政策限制条件提供。该限制条件可应用于资源层次结构中的组织、文件夹或项目。

您可以将 gcp.restrictTLSCipherSuites 限制用作许可名单或拒绝名单:

  • 许可名单: 允许一组特定的加密套件。所有其他请求都会被拒绝。
  • 拒绝列表:拒绝一组特定的加密套件。允许所有其他应用。

根据组织政策层次结构评估的行为,限制 TLS 加密套件限制条件适用于指定的资源节点及其所有子级。例如,如果您仅允许某个组织的特定 TLS 加密套件,那么来自该组织的所有文件夹和项目(子级)也会受到此限制。

准备工作

如需获得设置、更改或删除组织政策所需的权限,请让您的管理员为您授予组织的 Organization Policy Administrator (roles/orgpolicy.policyAdmin) IAM 角色。 如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限

您也可以通过自定义角色或其他预定义角色来获取所需的权限。

设置组织政策

“限制 TLS 加密套件”限制条件是一种列表限制条件。您可以通过“限制 TLS 加密套件”限制条件的 allowed_valuesdenied_values 列表添加和移除加密套件。为防止组织政策过于严格并简化政策管理,请使用值组。值组是 Google 精心挑选的推荐 TLS 密码套件。

控制台

  1. 在 Google Cloud 控制台中打开组织政策页面。

    转到组织政策

  2. 选择页面顶部的项目选择器。

  3. 在项目选择器中,选择要为其设置组织政策的资源。

  4. 组织政策页面上,从列表中选择限制 TLS 加密套件限制。

  5. 如需为该资源更新组织政策,请点击管理政策

  6. 修改页面,选择自定义

  7. 强制执行下,选择强制执行选项:

    • 要合并和评估组织政策,请选择与父资源规则合并。如需详细了解继承机制与资源层次结构,请参阅了解层次结构评估

    • 如需覆盖从父资源继承的政策,请选择替换

  8. 点击添加规则

  9. 政策值下方,选择自定义

  10. 政策类型下,选择允许以创建允许的加密套件列表,或者选择拒绝以创建拒绝的加密套件列表。

  11. 自定义值下,输入 in: 前缀和值组字符串,然后按 Enter 键。

    • 例如 in:NIST-800-52-recommended-ciphers。您可以点击添加值来输入多个值组字符串。

    • 您还可以使用 is: 前缀输入特定的加密套件字符串。如需查看支持的值的列表,请参阅支持的加密套件

  12. 如需强制执行政策,请点击设置政策

gcloud

如需创建强制执行“限制 TLS 密码套件”限制条件的组织政策,请创建引用该限制条件的 YAML 政策文件:

constraint: constraints/gcp.restrictTLSCipherSuites
listPolicy:
  allowedValues:
  - in:CNSA-2.0-recommended-ciphers
  - is:TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA

如需强制执行包含限制条件的组织政策,请运行以下命令

gcloud resource-manager org-policies set-policy \
--RESOURCE_TYPE RESOURCE_ID \
POLICY_PATH

替换以下内容:

  • RESOURCE_TYPE 替换为 organizationfolderproject

  • RESOURCE_ID 替换为您的组织 ID、文件夹 ID、项目 ID 或项目编号。

  • POLICY_PATH 替换为包含组织政策的 YAML 文件的完整路径。

系统返回的响应将包含新组织政策的结果:

constraint: constraints/gcp.restrictTLSCipherSuites
etag: COS9qr0GELii6o0C
listPolicy:
  allowedValues:
  - in:CNSA-2.0-recommended-ciphers
  - is:TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
updateTime: '2025-02-11T00:50:44.565875Z'

值组

值组是由 Google 精心挑选的一组加密套件,可让您更轻松地定义首选或推荐的 TLS 加密套件。值组包含多个加密套件,并且会随着时间的推移由 Google 进行扩展。您无需更改组织政策即可适应新的加密套件。

如需在组织政策中使用值组,请在您的条目前面添加 in: 字符串作为前缀。如需详细了解如何使用值前缀,请参阅使用限制条件。 调用以设置组织政策时,将验证值组名称。使用无效的群组名称会导致政策设置失败。

下表包含最新的可用组列表:

详情 直接成员
CNSA-2.0-recommended-ciphers Google Cloud 支持的 CNSA 2.0 推荐的加密算法:
in:CNSA-2.0-recommended-ciphers
值:
  • TLS_AES_256_GCM_SHA384
  • TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
  • TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
NIST-800-52-recommended-ciphers Google Cloud 支持的 NIST SP 800-52 推荐加密方式:
in:NIST-800-52-recommended-ciphers
值:
  • TLS_AES_128_GCM_SHA256
  • TLS_AES_256_GCM_SHA384
  • TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
  • TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
  • TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
  • TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
  • TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
  • TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
  • TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
  • TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384

支持的加密套件

以下是 Google Cloud支持的加密套件列表。

TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
TLS_RSA_WITH_AES_128_GCM_SHA256
TLS_RSA_WITH_AES_128_CBC_SHA
TLS_RSA_WITH_3DES_EDE_CBC_SHA

TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
TLS_RSA_WITH_AES_256_GCM_SHA384
TLS_RSA_WITH_AES_256_CBC_SHA
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA

TLS_AES_128_GCM_SHA256
TLS_AES_256_GCM_SHA384
TLS_CHACHA20_POLY1305_SHA256

错误消息

支持“限制 TLS 加密套件”限制条件的服务会拒绝违反该限制条件的请求。

错误消息示例

错误消息的格式类似于以下示例:

Request is disallowed by organization's constraints/gcp.restrictTLSCipherSuites
constraint for 'projects/PROJECT_NUMBER'.
Access to service
'SERVICE_NAME.googleapis.com' attempted with a disallowed TLS Cipher Suite: 'TLS_Cipher_Suite_X`
To access this resource, please use an allowed TLS Cipher Suite.

此输出包括以下值:

  • PROJECT_NUMBER:托管之前命令中引用的资源的项目编号。
  • SERVICE_NAME:受“限制 TLS 加密套件”政策限制的适用范围内的服务的名称。
  • TLS_Cipher_Suite_X:请求中使用的 TLS 加密套件。

Cloud Audit Log 示例

此外还会生成一个审核日志条目以进一步监控、提醒或调试。审核日志条目类似于以下示例:

{
  logName: "projects/my-project-number/logs/cloudaudit.googleapis.com%2Fpolicy"
  protoPayload: {
    @type: "type.googleapis.com/google.cloud.audit.AuditLog"
    status: {
      code: 7
      message: "Request is disallowed by organization's TLS Cipher Suite Restriction Org Policy for 'projects/my-project-number'. Attempting to use service 'bigquery.googleapis.com' with a disallowed TLS Cipher Suite: 'TLS_Cipher_Suite_X`."
    }
    serviceName: "bigquery.googleapis.com"
    methodName: "google.cloud.bigquery.v2.TableDataService.InsertAll"
    resourceName: "projects/my-project-number"
    authenticationInfo: {
      principalEmail: "user_or_service_account@example.com"
    }
  }
  requestMetadata: {
    callerIp: "123.123.123.123"
  }
  policyViolationInfo: {
    orgPolicyViolationInfo: {
      violationInfo: [
        {
          constraint: "constraints/gcp.restrictTlsCipherSuites"
          errorMessage: "TLS Cipher Suite Restriction Org Policy is violated"
          policyType: "LIST_CONSTRAINT"
        }
      ]
    }
  }
  resource: {
    type: "audited_resource"
    labels: {
      project_id: "my-project-number"
      method: "google.cloud.bigquery.v2.TableDataService.InsertAll"
      service: "bigquery.googleapis.com"
    }
  }
  severity: "ERROR"
  timestamp: "2023-10-27T19:27:24.633477924Z"
  receiveTimestamp: "2023-10-27T19:27:25.071941737Z"
  insertId "42"
}

测试政策

您可以针对任何适用范围内的服务测试 TLS 加密限制政策限制条件。以下示例 curl 命令用于验证 Cloud Key Management Service 密钥环的“限制 TLS 加密套件”设置。

curl --ciphers TLS_CIPHER_SUITE --tls_max 1.2 -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  "https://cloudkms.googleapis.com/v1/projects/PROJECT_ID/locations/global/keyRings" --verbose

执行以下变量替换操作:

  • TLS_CIPHER_SUITE:采用 OpenSSL 命名惯例的 TLS 加密套件名称,例如 ECDHE-ECDSA-AES128-SHATLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 的 OpenSSL 名称。

  • PROJECT_ID:包含密钥环的项目的名称

以下示例 curl 请求显示了 PROJECT_ID 设置为 my-project-idTLS_CIPHER_SUITE 设置为 ECDHE-ECDSA-AES128-SHA

curl --ciphers ECDHE-ECDSA-AES128-SHA --tls-max 1.2 \
  GET -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  "https://cloudkms.googleapis.com/v1/projects/my-project-id/locations/global/keyRings" --verbose

如果“my-project-id”的组织政策配置为拒绝 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,则尝试访问此示例命令中受政策限制的项目中具有相应加密方式的资源的所有操作都会失败。系统会返回类似于以下示例的错误消息,说明失败的原因。

Request is disallowed by organization's constraints/gcp.restrictTLSCipherSuites
constraint for 'projects/my-project-id'.
Access to service cloudkms.googleapis.com attempted with a disallowed TLS Cipher
Suite: `TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA`.
To access this resource, please use an allowed TLS Cipher Suite.

在试运行模式下创建组织政策

处于试运行模式的组织政策是一种组织政策,违反该政策的行为会被记录在审核日志中,但不会被拒绝。您可以使用 TLS 密码套件限制条件以试运行模式创建组织政策,以便在强制执行正式政策之前监控该政策对组织的影响。如需了解详情,请参阅以试运行模式创建组织政策

支持的服务

以下服务支持“限制 TLS 加密套件”。此限制条件适用于 API 端点的所有变体,包括全球端点、位置端点和区域端点。如需了解详情,请参阅 API 端点类型页面。

产品 API 端点
API 网关 apigateway.googleapis.com
API 密钥 apikeys.googleapis.com
Access Context Manager accesscontextmanager.googleapis.com
Apigee apigee.googleapis.com
Apigee API Hub apihub.googleapis.com
Apigee API Management API apim.googleapis.com
Apigee Connect API apigeeconnect.googleapis.com
Apigee portal API apigeeportal.googleapis.com
Apigee Registry API apigeeregistry.googleapis.com
App Config Manager API appconfigmanager.googleapis.com
App Hub apphub.googleapis.com
应用设计中心 designcenter.googleapis.com
Application Integration integrations.googleapis.com
Artifact Analysis containeranalysis.googleapis.com
ondemandscanning.googleapis.com
Artifact Registry artifactregistry.googleapis.com
有保障的开源软件 assuredoss.googleapis.com
Assured Workloads assuredworkloads.googleapis.com
Audit Manager auditmanager.googleapis.com
Authorization Toolkit API authztoolkit.googleapis.com
Batch batch.googleapis.com
Chrome 企业进阶版 beyondcorp.googleapis.com
BigLake biglake.googleapis.com
BigQuery bigquery.googleapis.com
BigQuery 连接 bigqueryconnection.googleapis.com
BigQuery Data Policy bigquerydatapolicy.googleapis.com
BigQuery Data Transfer bigquerydatatransfer.googleapis.com
BigQuery 迁移 bigquerymigration.googleapis.com
BigQuery Reservation bigqueryreservation.googleapis.com
BigQuery Saved Query API bigquery-sq.googleapis.com
BigQuery 存储 bigquerystorage.googleapis.com
Bigtable bigtable.googleapis.com
bigtableadmin.googleapis.com
Binary Authorization binaryauthorization.googleapis.com
区块链分析 blockchain.googleapis.com
Blockchain Node Engine blockchainnodeengine.googleapis.com
Blockchain Validator Manager blockchainvalidatormanager.googleapis.com
容量规划工具 capacityplanner.googleapis.com
Certificate Authority Service privateca.googleapis.com
Certificate Manager certificatemanager.googleapis.com
Cloud Asset Inventory cloudasset.googleapis.com
Cloud Build cloudbuild.googleapis.com
Cloud CDN compute.googleapis.com
Cloud Commerce Producer API cloudcommerceproducer.googleapis.com
Cloud Composer composer.googleapis.com
Cloud Controls Partner API cloudcontrolspartner.googleapis.com
Cloud DNS dns.googleapis.com
Cloud Data Fusion datafusion.googleapis.com
Cloud Deployment Manager runtimeconfig.googleapis.com
deploymentmanager.googleapis.com
Cloud Domains domains.googleapis.com
Cloud Healthcare API healthcare.googleapis.com
Cloud Interconnect compute.googleapis.com
Cloud Intrusion Detection System ids.googleapis.com
Cloud Key Management Service cloudkms.googleapis.com
Cloud Life Sciences lifesciences.googleapis.com
Cloud Load Balancing compute.googleapis.com
Cloud Logging logging.googleapis.com
Cloud Monitoring monitoring.googleapis.com
Cloud NAT compute.googleapis.com
Cloud Natural Language API language.googleapis.com
Cloud 新一代防火墙基本功能版 compute.googleapis.com
networksecurity.googleapis.com
Cloud 新一代防火墙标准版 compute.googleapis.com
networksecurity.googleapis.com
Cloud OS Login API oslogin.googleapis.com
Cloud Router compute.googleapis.com
Cloud Run run.googleapis.com
Cloud SQL sqladmin.googleapis.com
Cloud Service Mesh meshconfig.googleapis.com
networksecurity.googleapis.com
Cloud Support API cloudsupport.googleapis.com
Cloud Tool Results API toolresults.googleapis.com
Cloud VPN compute.googleapis.com
Cloud Workstations workstations.googleapis.com
Commerce Agreement Publishing API commerceagreementpublishing.googleapis.com
Commerce Business Enablement API commercebusinessenablement.googleapis.com
Commerce Price Management API commercepricemanagement.googleapis.com
Compute Engine compute.googleapis.com
机密计算 confidentialcomputing.googleapis.com
连接 gkeconnect.googleapis.com
Connect 网关 connectgateway.googleapis.com
Contact Center AI 平台 API contactcenteraiplatform.googleapis.com
Container Threat Detection containerthreatdetection.googleapis.com
Content Warehouse API contentwarehouse.googleapis.com
Continuous Validation API continuousvalidation.googleapis.com
Data Labeling API datalabeling.googleapis.com
数据安全状况管理 API dspm.googleapis.com
数据库迁移服务 datamigration.googleapis.com
Dataflow dataflow.googleapis.com
Dataproc on GDC dataprocgdc.googleapis.com
Google Distributed Cloud opsconfigmonitoring.googleapis.com
gdcvmmanager.googleapis.com
gdchardwaremanagement.googleapis.com
Distributed Cloud Edge Container API edgecontainer.googleapis.com
Distributed Cloud Edge Network API edgenetwork.googleapis.com
Enterprise Knowledge Graph enterpriseknowledgegraph.googleapis.com
Error Reporting clouderrorreporting.googleapis.com
重要联系人 essentialcontacts.googleapis.com
Eventarc eventarc.googleapis.com
Filestore file.googleapis.com
Financial Services API financialservices.googleapis.com
Firebase App Hosting firebaseapphosting.googleapis.com
Firebase Data Connect firebasedataconnect.googleapis.com
Firebase 安全规则 firebaserules.googleapis.com
GKE Dataplane Management gkedataplanemanagement.googleapis.com
GKE Enterprise Edge API anthosedge.googleapis.com
Hub(舰队) gkehub.googleapis.com
GKE Multi-Cloud gkemulticloud.googleapis.com
GKE On-Prem API gkeonprem.googleapis.com
Gemini for Google Cloud API cloudaicompanion.googleapis.com
Google Cloud API cloud.googleapis.com
Google Cloud Armor compute.googleapis.com
Google Cloud Migration Center migrationcenter.googleapis.com
Google Cloud Observability stackdriver.googleapis.com
Google Kubernetes Engine container.googleapis.com
configdelivery.googleapis.com
Google Security Operations SIEM chronicle.googleapis.com
chronicleservicemanager.googleapis.com
Google Security Operations Partner API chroniclepartner.googleapis.com
Google Workspace 插件 gsuiteaddons.googleapis.com
Identity and Access Management iam.googleapis.com
Identity-Aware Proxy iap.googleapis.com
Immersive Stream stream.googleapis.com
Infrastructure Manager config.googleapis.com
Integration Connectors connectors.googleapis.com
KRM API Hosting krmapihosting.googleapis.com
Live Stream API livestream.googleapis.com
适用于 Apache Flink 的 BigQuery 引擎 managedflink.googleapis.com
Managed Kafka API managedkafka.googleapis.com
服务管理 servicemanagement.googleapis.com
Media Asset Manager mediaasset.googleapis.com
Memorystore for Memcached memcache.googleapis.com
Memorystore for Redis redis.googleapis.com
Message Streams API messagestreams.googleapis.com
Microservices API microservices.googleapis.com
Model Armor modelarmor.googleapis.com
Network Connectivity Center networkconnectivity.googleapis.com
Network Intelligence Center networkmanagement.googleapis.com
Network Service Tiers compute.googleapis.com
Persistent Disk compute.googleapis.com
Oracle Database@Google Cloud oracledatabase.googleapis.com
Parallelstore parallelstore.googleapis.com
政策分析器 policyanalyzer.googleapis.com
政策问题排查工具 policytroubleshooter.googleapis.com
逐步发布 progressiverollout.googleapis.com
Pub/Sub pubsub.googleapis.com
Public Certificate Authority 机构 publicca.googleapis.com
Recommender recommender.googleapis.com
Remote Build Execution remotebuildexecution.googleapis.com
Retail API retail.googleapis.com
网络保险中心 riskmanager.googleapis.com
SaaS Service Management API saasservicemgmt.googleapis.com
SecLM API seclm.googleapis.com
Secret Manager secretmanager.googleapis.com
Security Command Center securitycenter.googleapis.com
securitycentermanagement.googleapis.com
securityposture.googleapis.com
Cloud Data Loss Prevention dlp.googleapis.com
Service Account Credentials API iamcredentials.googleapis.com
Service Directory servicedirectory.googleapis.com
Service Networking servicenetworking.googleapis.com
Spanner spanner.googleapis.com
Speaker ID speakerid.googleapis.com
Speech-to-Text speech.googleapis.com
存储空间分析 storageinsights.googleapis.com
Storage Transfer Service storagebatchoperations.googleapis.com
Text-to-Speech texttospeech.googleapis.com
Timeseries Insights API timeseriesinsights.googleapis.com
Transcoder API transcoder.googleapis.com
Transfer Appliance transferappliance.googleapis.com
虚拟机管理器 osconfig.googleapis.com
Vertex AI API aiplatform.googleapis.com
Vertex AI Workbench notebooks.googleapis.com
Vertex AI in Firebase firebasevertexai.googleapis.com
Virtual Private Cloud (VPC) compute.googleapis.com
Video Search API cloudvideosearch.googleapis.com
Video Stitcher API videostitcher.googleapis.com
Web Risk webrisk.googleapis.com
Web Security Scanner websecurityscanner.googleapis.com
Workflows workflows.googleapis.com
Workload Certificate API workloadcertificate.googleapis.com

不支持的服务

“限制 TLS 加密套件”组织政策限制条件不适用于以下服务:

  • App Engine (*.appspot.com)
  • Cloud Run functions (*.cloudfunctions.net),
  • Cloud Run (*.run.app)
  • Private Service Connect
  • 自定义网域

如需限制这些服务的 TLS 加密套件,请将 Cloud Load BalancingSSL 安全政策搭配使用。

Google Cloud 加密套件偏好设置

受支持的服务的端点优先选择 AES-256,其次是 AES-128,最后是 ChaCha20。支持 AES-256 的客户端应能成功协商使用该加密方式,而无需更改任何配置。