允許 Google Cloud 的安全漏洞評估功能存取 VPC Service Controls 範圍

本文說明如何新增輸入和輸出規則,允許 Google Cloud 的弱點評估功能掃描 VPC Service Controls 範圍內的 VM。如果貴機構使用 VPC Service Controls 限制專案中的服務,且您希望 Vulnerability Assessment for Google Cloud 掃描這些專案,請執行這項工作。如要進一步瞭解 Google Cloud的 Vulnerability Assessment,請參閱「為 Google Cloud啟用及使用 Google Cloud 的 Vulnerability Assessment」。

事前準備

Make sure that you have the following role or roles on the organization: Access Context Manager Editor (roles/accesscontextmanager.policyEditor).

Check for the roles

  1. In the Google Cloud console, go to the IAM page.

    Go to IAM
  2. Select the organization.
  3. In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.

  4. For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.

Grant the roles

  1. In the Google Cloud console, go to the IAM page.

    前往「身分與存取權管理」頁面
  2. 選取機構。
  3. 按一下 「授予存取權」
  4. 在「New principals」(新增主體) 欄位中,輸入您的使用者 ID。 這通常是 Google 帳戶的電子郵件地址。

  5. 在「Select a role」(選取角色) 清單中,選取角色。
  6. 如要授予其他角色,請按一下 「新增其他角色」,然後新增每個其他角色。
  7. 按一下 [Save]
  8. 建立輸出和輸入規則

    如要允許 Vulnerability Assessment for Google Cloud 掃描 VPC Service Controls 範圍內的 VM,請在這些範圍中新增必要的輸出和輸入規則。針對要讓 Vulnerability Assessment 掃描的每個周邊,執行下列步驟。 Google Cloud

    詳情請參閱 VPC Service Controls 說明文件中的「更新服務範圍的 Ingress 和 Egress 政策」。

    控制台

    1. 在 Google Cloud 控制台中,前往「VPC Service Controls」頁面。

      前往 VPC Service Controls

    2. 選取您的機構或專案。
    3. 如果您選取機構,請按一下「選取存取權政策」,然後選取要更新的邊界相關存取權政策。
    4. 按一下要更新的邊界名稱。

      如要找出需要修改的服務安全防護範圍,請檢查記錄檔中顯示 RESOURCES_NOT_IN_SAME_SERVICE_PERIMETER 違規事項的項目。在這些項目中,檢查 servicePerimeterName 欄位:

      accessPolicies/ACCESS_POLICY_ID/servicePerimeters/SERVICE_PERIMETER_NAME
    5. 按一下「編輯範圍」
    6. 按一下「輸出政策」
    7. 按一下「新增 egress 規則」
    8. 在「FROM」部分,設定下列詳細資料:

      1. 在「身分」部分,選取「特定身分和群組」
      2. 按一下「新增身分」
      3. 輸入 安全中心服務專員的電子郵件地址。 服務代理人的地址格式如下:

        service-org-ORGANIZATION_ID@security-center-api.iam.gserviceaccount.com

        ORGANIZATION_ID 替換為機構 ID。

      4. 選取服務代理人或按 ENTER 鍵,然後按一下「新增身分」
    9. 在「TO」部分,設定下列詳細資料:

      1. 在「Project」(專案) 部分,選取「All projects」(所有專案)
      2. 在「作業或 IAM 角色」部分,選取「選取作業」
      3. 按一下「新增作業」,然後新增下列作業:

        • 新增 compute.googleapis.com 服務。
          1. 按一下「選取方法」
          2. 選取「DisksService.Insert」DisksService.Insert方法。

          3. 按一下「新增所選方法」
    10. 按一下「輸入政策」
    11. 按一下「新增 Ingress 規則」
    12. 在「FROM」部分,設定下列詳細資料:

      1. 在「身分」部分,選取「特定身分和群組」
      2. 按一下「新增身分」
      3. 輸入 安全中心服務專員的電子郵件地址。 服務代理人的地址格式如下:

        service-org-ORGANIZATION_ID@security-center-api.iam.gserviceaccount.com

        ORGANIZATION_ID 替換為機構 ID。

      4. 選取服務代理人或按 ENTER 鍵,然後按一下「新增身分」
      5. 在「來源」部分,選取「所有來源」
    13. 在「TO」部分,設定下列詳細資料:

      1. 在「Project」(專案) 部分,選取「All projects」(所有專案)
      2. 在「作業或 IAM 角色」部分,選取「選取作業」
      3. 按一下「新增作業」,然後新增下列作業:

        • 新增 compute.googleapis.com 服務。
          1. 按一下「選取方法」
          2. 選取下列方法:

            • DisksService.Insert
            • InstancesService.AggregatedList
            • InstancesService.List
          3. 按一下「新增所選方法」
    14. 按一下「儲存」

    gcloud

    1. 如果尚未設定配額專案,請設定配額專案。選擇已啟用 Access Context Manager API 的專案。

      gcloud config set billing/quota_project QUOTA_PROJECT_ID

      QUOTA_PROJECT_ID 替換為您要用於帳單和配額的專案 ID。

    2. 建立名為 egress-rule.yaml 的檔案,並在當中加入下列內容:

      - egressFrom:
          identities:
          - serviceAccount:service-org-ORGANIZATION_ID@security-center-api.iam.gserviceaccount.com
        egressTo:
          operations:
          - serviceName: compute.googleapis.com
            methodSelectors:
            - method: DisksService.Insert
          resources:
          - '*'

      ORGANIZATION_ID 替換為機構 ID。

    3. 建立名為 ingress-rule.yaml 的檔案,並在當中加入下列內容:

      - ingressFrom:
          identities:
          - serviceAccount:service-org-ORGANIZATION_ID@security-center-api.iam.gserviceaccount.com
          sources:
          - accessLevel: '*'
        ingressTo:
          operations:
          - serviceName: compute.googleapis.com
            methodSelectors:
            - method: DisksService.Insert
            - method: InstancesService.AggregatedList
            - method: InstancesService.List
          resources:
          - '*'

      ORGANIZATION_ID 替換為機構 ID。

    4. 將 Egress 規則新增至範圍:

      gcloud access-context-manager perimeters update PERIMETER_NAME \
          --set-egress-policies=egress-rule.yaml

      更改下列內容:

      • PERIMETER_NAME:perimeter 的名稱。例如: accessPolicies/1234567890/servicePerimeters/example_perimeter

        如要找出需要修改的服務安全防護範圍,請檢查記錄檔中顯示 RESOURCES_NOT_IN_SAME_SERVICE_PERIMETER 違規事項的項目。在這些項目中,檢查 servicePerimeterName 欄位:

        accessPolicies/ACCESS_POLICY_ID/servicePerimeters/SERVICE_PERIMETER_NAME
    5. 將 Ingress 規則新增至範圍:

      gcloud access-context-manager perimeters update PERIMETER_NAME \
          --set-ingress-policies=ingress-rule.yaml

      更改下列內容:

      • PERIMETER_NAME:perimeter 的名稱。例如: accessPolicies/1234567890/servicePerimeters/example_perimeter

        如要找出需要修改的服務安全防護範圍,請檢查記錄檔中顯示 RESOURCES_NOT_IN_SAME_SERVICE_PERIMETER 違規事項的項目。在這些項目中,檢查 servicePerimeterName 欄位:

        accessPolicies/ACCESS_POLICY_ID/servicePerimeters/SERVICE_PERIMETER_NAME

    詳情請參閱「輸入和輸出規則」。