建立及管理安全性設定檔群組

本頁面說明如何使用 Google Cloud CLI,建立及管理含有自訂安全設定檔的安全設定檔群組。

事前準備

角色

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

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

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

建立安全性設定檔群組並設定自訂設定檔

您可以在組織或專案層級建立安全設定檔群組。建立安全性設定檔群組時,只能使用 CUSTOM_MIRRORING 類型的安全性設定檔。

控制台

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

    前往「Security profile groups」(安全性設定檔群組)

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

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

  4. 在「名稱」部分,輸入安全性設定檔群組的名稱。

  5. 在「Security profile group purpose」(安全性設定檔群組用途),選取「NSI out-of-band」(NSI 頻外)。

  6. 在「Custom mirroring profile」(自訂鏡像設定檔) 部分,選取用於頻內整合的自訂安全設定檔。

  7. 點選「建立」。

gcloud

如要建立安全性設定檔群組,請使用 gcloud network-security security-profile-groups create 指令:

 gcloud network-security security-profile-groups \
     create SECURITY_PROFILE_GROUP_NAME \
     --custom-mirroring-profile CUSTOM_MIRRORING_PROFILE_NAME \
     --description DESCRIPTION \
     --organization ORGANIZATION_ID | --project PROJECT_ID \
     --location=global \
     [--billing-project QUOTA_PROJECT_ID]

更改下列內容:

  • SECURITY_PROFILE_GROUP_NAME::安全性 設定檔群組的名稱。

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

  • CUSTOM_MIRRORING_PROFILE_NAME:自訂 鏡像安全性設定檔的名稱。

  • DESCRIPTION:安全性設定檔群組的選用說明。

  • ORGANIZATION_ID:組織 ID。使用這個旗標,即可建立組織層級的安全性設定檔群組。

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

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

Terraform

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

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

resource "google_network_security_security_profile_group" "default" {
  name                     = "security-profile-group"
  parent                   = "organizations/${data.google_organization.default.org_id}"
  location                 = "global"
  custom_mirroring_profile = google_network_security_security_profile.default.id
}

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

resource "google_network_security_security_profile_group" "default" {
  name                     = "security-profile-group"
  parent                   = "projects/${data.google_project.default.project_id}"
  location                 = "global"
  custom_mirroring_profile = google_network_security_security_profile.default.id
}

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

列出及查看安全性設定檔群組的詳細資料

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

控制台

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

    前往「Security profile groups」(安全性設定檔群組)

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

  3. 在「Security profile groups」(安全性設定檔群組) 分頁中,按一下安全性設定檔群組的名稱,即可查看詳細資料。

gcloud

如要列出自訂鏡像安全性設定檔群組,請使用 gcloud network-security security-profile-groups list 指令:

gcloud network-security security-profile-groups list \
    --organization ORGANIZATION_ID | --project PROJECT_ID \
    --location=global \
    --filter CUSTOM_MIRRORING_PROFILE \
    [--billing-project QUOTA_PROJECT_ID]

如要查看安全性設定檔群組的詳細資料,請使用 gcloud network-security security-profile-groups describe 指令:

 gcloud network-security security-profile-groups \
     describe SECURITY_PROFILE_GROUP_NAME \
     --organization ORGANIZATION_ID | --project PROJECT_ID \
     --location=global \
     [--billing-project QUOTA_PROJECT_ID]

更改下列內容:

  • SECURITY_PROFILE_GROUP_NAME::安全性 設定檔群組的名稱。

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

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

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

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

更新安全性設定檔群組

您可以更新安全性設定檔群組中參照的安全性設定檔說明和標籤。

控制台

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

    前往「Security profile groups」(安全性設定檔群組)

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

  3. 按一下安全性設定檔群組。

  4. 按一下 [編輯]。

  5. 編輯規則後,按一下「儲存」。

gcloud

如要更新安全性設定檔群組,請使用 gcloud network-security security-profile-groups update 指令:

gcloud network-security security-profile-groups \
    update SECURITY_PROFILE_GROUP_NAME \
    --organization ORGANIZATION_ID | --project PROJECT_ID \
    --location=global \
    --description DESCRIPTION

更改下列內容:

  • SECURITY_PROFILE_GROUP_NAME:要更新的安全設定檔群組名稱。

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

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

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

  • DESCRIPTION:安全性設定檔群組的選用說明。

刪除安全性設定檔群組

您可以指定安全設定檔群組的名稱、位置和組織,藉此刪除該群組。不過,如果網路防火牆政策參照自訂安全性設定檔,則無法刪除該安全性設定檔群組。

控制台

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

    前往「Security profile groups」(安全性設定檔群組)

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

  3. 在「Security profile groups」(安全性設定檔群組) 分頁中,勾選要刪除的安全性設定檔群組,然後按一下「Delete」(刪除)。

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

gcloud

如要刪除安全性設定檔群組,請使用 gcloud network-security security-profile-groups delete 指令:

gcloud network-security security-profile-groups \
    delete SECURITY_PROFILE_GROUP_NAME \
    --organization ORGANIZATION_ID | --project PROJECT_ID \
    --location=global \
    [--billing-project QUOTA_PROJECT_ID]

更改下列內容:

  • SECURITY_PROFILE_GROUP_NAME:要刪除的安全設定檔群組名稱。

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

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

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

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

後續步驟