建立及管理自訂攔截安全性設定檔

本頁面說明如何建立及管理自訂攔截安全性設定檔。

事前準備

角色

如要取得建立、查看、更新或刪除自訂攔截安全性設定檔所需的權限,請要求管理員授予您組織必要的 IAM 角色。如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。

如要查看本頁所列作業的進度,請確認您的使用者角色具備下列 Compute 網路使用者角色 (roles/compute.networkUser) 權限:

  • networksecurity.operations.get
  • networksecurity.operations.list

建立自訂攔截安全性設定檔

如果是頻內整合,您只能建立 custom-intercept 類型的安全性設定檔。您可以在組織或專案層級建立安全性設定檔。

控制台

  1. 前往 Google Cloud 控制台的「Security profiles」(安全設定檔) 頁面。

    前往「Security profiles」(安全性設定檔) 頁面

  2. 從專案選取器選單中,選取機構或專案。

  3. 在「安全性設定檔」分頁中,點選「建立設定檔」。

  4. 在「Name」(名稱) 中輸入名稱。

  5. 在「Security profile purpose」(安全設定檔用途) 部分,選取「NSI in-band」(NSI 頻帶內)。

  6. 在「Project」(專案),選取託管攔截端點群組的專案。

  7. 在「Intercept endpoint group」(攔截端點群組) 部分,選取攔截端點群組。

  8. 點選「建立」。

gcloud

如要建立頻內整合的自訂攔截安全性設定檔,請使用 gcloud network-security security-profiles custom-intercept create 指令:

gcloud network-security security-profiles custom-intercept create CUSTOM_INTERCEPT_PROFILE_ID \
    --organization ORGANIZATION_ID | --project PROJECT_ID \
    --location global \
    [--billing-project QUOTA_PROJECT_ID ] \
    --intercept-endpoint-group \
        projects/ENDPOINT_GROUP_PROJECT_ID/locations/global/interceptEndpointGroups/ENDPOINT_GROUP_ID

更改下列內容:

  • CUSTOM_INTERCEPT_PROFILE_ID:安全性 設定檔的名稱。

    如果未以不重複網址 ID 格式指定名稱,則必須指定組織或專案名稱,以及位置。

  • ORGANIZATION_ID:組織 ID。使用這個旗標建立組織層級的安全防護設定檔。

  • PROJECT_ID:您的專案 ID。使用這個旗標,即可建立專案層級的安全性設定檔。

  • QUOTA_PROJECT_ID:配額專案 ID。這個旗標僅適用於組織層級的安全設定檔。

  • ENDPOINT_GROUP_PROJECT_ID:您建立攔截端點群組的專案 ID。

  • ENDPOINT_GROUP_ID:端點群組的 ID。

Terraform

如要建立安全性設定檔,可以使用 google_network_security_security_profile 資源。

以下範例說明如何建立組織層級的安全防護設定檔:

resource "google_network_security_security_profile" "default" {
  name     = "security-profile"
  type     = "CUSTOM_INTERCEPT"
  parent   = "organizations/${data.google_organization.default.org_id}"
  location = "global"

  custom_intercept_profile {
    intercept_endpoint_group = google_network_security_intercept_endpoint_group.default.id
  }
}

以下範例說明如何建立專案層級的安全設定檔:

resource "google_network_security_security_profile" "default" {
  name     = "security-profile"
  type     = "CUSTOM_INTERCEPT"
  parent   = "projects/${data.google_project.default.project_id}"
  location = "global"

  custom_intercept_profile {
    intercept_endpoint_group = google_network_security_intercept_endpoint_group.default.id
  }
}

如要瞭解如何套用或移除 Terraform 設定,請參閱「基本 Terraform 指令」。

列出及查看自訂攔截安全性設定檔的詳細資料

您可以列出組織或專案中的安全性設定檔,並查看設定檔的詳細資料,例如名稱和端點群組 ID。

控制台

  1. 前往 Google Cloud 控制台的「Security profiles」(安全設定檔) 頁面。

    前往「Security profiles」(安全性設定檔) 頁面

  2. 從專案選取器選單中,選取機構或專案。這個分頁會列出所有安全性設定檔。

  3. 在「Security profiles」(安全設定檔) 分頁中,按一下安全設定檔的名稱。

gcloud

如要列出所有自訂攔截安全性設定檔,請使用 gcloud network-security security-profiles custom-intercept list 指令:

gcloud network-security security-profiles custom-intercept list \
    --organization ORGANIZATION_ID | --project PROJECT_ID \
    --location global \
    [--billing-project QUOTA_PROJECT_ID]

如要查看自訂攔截安全性設定檔的詳細資料,請使用 gcloud network-security security-profiles custom-intercept describe 指令:

gcloud network-security security-profiles custom-intercept describe CUSTOM_INTERCEPT_PROFILE_ID \
    --organization ORGANIZATION_ID | --project PROJECT_ID \
    [--billing-project QUOTA_PROJECT_ID] \
    --location global

更改下列內容:

  • CUSTOM_INTERCEPT_PROFILE_ID:安全性 設定檔的名稱。

    如果未以不重複網址 ID 格式指定名稱,則必須指定組織或專案名稱,以及位置。

  • ORGANIZATION_ID:安全性設定檔所在的組織 ID。

  • PROJECT_ID:安全性設定檔所在的專案 ID。

  • QUOTA_PROJECT_ID:配額專案 ID。這個旗標僅適用於組織層級的安全設定檔。

輸出結果會與下列內容相似:

  • 組織層級安全性設定檔:organizations/ORGANIZATION_ID/locations/global/securityProfiles/CUSTOM_INTERCEPT_PROFILE_ID
  • 專案層級安全性設定檔:projects/PROJECT_ID/locations/global/securityProfiles/CUSTOM_INTERCEPT_PROFILE_ID

刪除自訂攔截安全性設定檔

您可以指定自訂攔截安全性設定檔的名稱、位置和組織或專案,藉此刪除該設定檔。刪除安全性設定檔前,請確認該設定檔未用於任何安全性設定檔群組。

控制台

  1. 前往 Google Cloud 控制台的「Security profiles」(安全設定檔) 頁面。

    前往「Security profiles」(安全性設定檔) 頁面

  2. 從專案選取器選單中,選取機構或專案。

  3. 在「Security profiles」(安全性設定檔) 分頁中,勾選安全性設定檔的核取方塊,然後按一下「Delete」(刪除)。

  4. 再按一下 [刪除] 加以確認。

gcloud

如要刪除自訂攔截安全性設定檔,請使用 gcloud network-security security-profiles custom-intercept delete 指令:

gcloud network-security security-profiles custom-intercept delete CUSTOM_INTERCEPT_PROFILE_ID \
    --organization ORGANIZATION_ID | --project PROJECT_ID \
    [--billing-project QUOTA_PROJECT_ID] \
    --location global

更改下列內容:

  • CUSTOM_INTERCEPT_PROFILE_ID:要刪除的自訂攔截安全性設定檔 ID。

    如果未以不重複網址 ID 格式指定名稱,則必須指定組織或專案名稱,以及位置。

  • ORGANIZATION_ID:安全設定檔所在的組織 ID。

  • PROJECT_ID:安全性設定檔所在的專案 ID。

  • QUOTA_PROJECT_ID:配額專案 ID。這個旗標僅適用於組織層級的安全設定檔。

後續步驟