限制 TLS 加密套件

本頁說明如何拒絕使用特定低安全性傳輸層安全標準 (TLS) 加密套件提出的要求,防止存取 Google Cloud 資源。

總覽

Google Cloud 支援多個 傳輸層安全標準 (TLS) 加密套件。 為符合安全性或法規遵循規定,您可能需要拒絕來自使用安全性較低的 TLS 加密套件的用戶端要求。

這項功能是由gcp.restrictTLSCipherSuites 組織政策限制提供。這項限制可套用至資源階層中的機構、資料夾或專案。

您可以將 gcp.restrictTLSCipherSuites 限制做為允許清單或拒絕清單:

  • 允許清單: 允許一組特定的密碼套件。其他要求都會遭到拒絕。
  • 拒絕清單: 拒絕一組特定的密碼編譯套件。允許所有其他使用者。

由於組織政策階層評估的行為,「限制 TLS 加密套件」限制會套用至指定資源節點及其所有子項。舉例來說,如果您只允許特定 TLS 加密套件用於機構,該機構的所有資料夾和專案 (子項) 也會套用這項限制。

事前準備

如要取得設定、變更或刪除機構政策所需的權限,請要求管理員授予您機構的機構政策管理員 (roles/orgpolicy.policyAdmin) IAM 角色。如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和機構的存取權」。

您或許還可透過自訂角色或其他預先定義的角色取得必要權限。

設定機構政策

「限制 TLS 加密套件」限制是一種清單限制。您可以從「限制 TLS 加密套件」限制的 allowed_valuesdenied_values 清單新增及移除加密套件。為避免機構政策過於嚴格,並簡化政策管理作業,請使用值組。值組是 Google 推薦的 TLS 加密套件。

控制台

  1. 在 Google Cloud 控制台中開啟「Organization policies」(機構政策) 頁面。

    前往「機構政策」

  2. 選取頁面頂端的專案挑選器。

  3. 在專案選擇工具中,選取要設定機構政策的資源。

  4. 在「機構政策」頁面的清單中,選取「限制 TLS 加密套件」限制。

  5. 如要更新資源的機構政策,請按一下「管理政策」

  6. 在「Edit」(編輯) 頁面選取 [Customize] (自訂)

  7. 在「Policy enforcement」(強制執行) 下方,選取強制執行選項:

    • 如要合併與評估機構政策,請選取「與上層合併」。如要進一步瞭解繼承和資源階層,請參閱「瞭解階層評估」。

    • 如要覆寫從父項資源繼承的政策,請選取「取代」

  8. 按一下 [新增規則]

  9. 在「Policy values」(政策值) 底下,選取 [Custom] (自訂)。

  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 加密套件。值組包含多個密碼編譯套件,且會隨著時間演進而不斷擴展。您不需要變更機構政策,即可使用新的密碼套件。

如要在機構政策中使用值組,請先輸入 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 稽核記錄範例

系統也會產生稽核記錄項目,以利進一步監控、發出快訊或偵錯。稽核記錄項目與下列範例類似:

{
  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-SHA,這是 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 的 OpenSSL 名稱。

  • PROJECT_ID:包含金鑰環的專案名稱

下列 curl 要求範例顯示 PROJECT_ID 設為 my-project-id,而 TLS_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 Gateway 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 管理 API apim.googleapis.com
Apigee Connect API apigeeconnect.googleapis.com
Apigee 入口網站 API apigeeportal.googleapis.com
Apigee Registry API apigeeregistry.googleapis.com
App Config Manager API appconfigmanager.googleapis.com
App Hub apphub.googleapis.com
Application Design Center designcenter.googleapis.com
應用程式整合 integrations.googleapis.com
Artifact Analysis containeranalysis.googleapis.com
ondemandscanning.googleapis.com
Artifact Registry artifactregistry.googleapis.com
Assured Open Source Software assuredoss.googleapis.com
Assured Workloads assuredworkloads.googleapis.com
Audit Manager auditmanager.googleapis.com
授權工具包 API authztoolkit.googleapis.com
批次 batch.googleapis.com
Chrome Enterprise Premium beyondcorp.googleapis.com
BigLake biglake.googleapis.com
BigQuery bigquery.googleapis.com
BigQuery 連線 bigqueryconnection.googleapis.com
BigQuery 資料政策 bigquerydatapolicy.googleapis.com
BigQuery 資料移轉 bigquerydatatransfer.googleapis.com
BigQuery 遷移 bigquerymigration.googleapis.com
BigQuery 保留項目 bigqueryreservation.googleapis.com
BigQuery Saved Query API bigquery-sq.googleapis.com
BigQuery 儲存空間 bigquerystorage.googleapis.com
Bigtable bigtable.googleapis.com
bigtableadmin.googleapis.com
二進位授權 binaryauthorization.googleapis.com
區塊鏈分析 blockchain.googleapis.com
Blockchain Node Engine blockchainnodeengine.googleapis.com
Blockchain Validator Manager blockchainvalidatormanager.googleapis.com
成效規劃工具 capacityplanner.googleapis.com
憑證授權單位服務 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 入侵偵測系統 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 Next Generation Firewall Essentials compute.googleapis.com
networksecurity.googleapis.com
Cloud Next Generation Firewall Standard 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
連結閘道 connectgateway.googleapis.com
Contact Center AI Platform 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
錯誤報告 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
中樞 (車隊) 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 遷移中心 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
身分與存取權管理 iam.googleapis.com
Identity-Aware Proxy iap.googleapis.com
Immersive Stream stream.googleapis.com
Infrastructure Manager config.googleapis.com
整合連接器 connectors.googleapis.com
KRM API Hosting krmapihosting.googleapis.com
Live Stream API livestream.googleapis.com
BigQuery Engine for Apache Flink managedflink.googleapis.com
Managed Kafka API managedkafka.googleapis.com
服務管理 servicemanagement.googleapis.com
媒體資產管理員 mediaasset.googleapis.com
Memorystore for Memcached memcache.googleapis.com
Memorystore for Redis redis.googleapis.com
Message Streams API messagestreams.googleapis.com
微服務 API microservices.googleapis.com
Model Armor modelarmor.googleapis.com
Network Connectivity Center networkconnectivity.googleapis.com
Network Intelligence Center networkmanagement.googleapis.com
網路服務級別 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
Progressive Rollout progressiverollout.googleapis.com
Pub/Sub pubsub.googleapis.com
公開憑證授權單位 publicca.googleapis.com
建議工具 recommender.googleapis.com
Remote Build Execution remotebuildexecution.googleapis.com
Retail API retail.googleapis.com
Cyber Insurance Hub 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
服務網路 servicenetworking.googleapis.com
Spanner spanner.googleapis.com
Speaker ID speakerid.googleapis.com
語音轉文字 speech.googleapis.com
儲存空間洞察 storageinsights.googleapis.com
Storage 移轉服務 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
VM 管理員 osconfig.googleapis.com
Vertex AI API aiplatform.googleapis.com
Vertex AI Workbench notebooks.googleapis.com
Vertex AI in Firebase firebasevertexai.googleapis.com
虛擬私有雲 (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.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 的用戶端應可順利完成協商,無須變更任何設定。