軟體安全漏洞是指可能導致系統意外故障或惡意活動的弱點。詳情請參閱「安全漏洞報告」。
本文說明如何使用 VM 管理員設定 VM,以及查看作業系統的安全漏洞報告。
事前準備
- 查看 OS 設定配額。
- 設定 VM 管理員。
-
如果尚未設定驗證,請先完成設定。
「驗證」是指驗證身分的程序,確認您有權存取 Google Cloud 服務和 API。如要從本機開發環境執行程式碼或範例,請選取下列其中一個選項,向 Compute Engine 進行驗證:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
-
After installing the Google Cloud CLI, initialize it by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
- Set a default region and zone.
-
如要使用 gcloud CLI 或 API 查看安全漏洞報告,請執行下列操作:
OS Config 安全漏洞報告檢視者 (
roles/osconfig.vulnerabilityReportViewer
) -
如要使用 Google Cloud 控制台查看安全漏洞報表,請按照下列步驟操作:
-
OS Config Vulnerability Report Viewer (
roles/osconfig.vulnerabilityReportViewer
) -
OS 庫存檢視者 (
roles/osconfig.inventoryViewer
)
-
OS Config Vulnerability Report Viewer (
- 如要在「Patch」(修補程式) 頁面的「VM instance details」(VM 執行個體詳細資料) 對話方塊中查看 CVE 資訊,請按照下列步驟操作:
- 使用Google Cloud 控制台、gcloud CLI 或 API。
- 如果您是 Security Command Center 進階方案使用者,請使用 Security Command Center 資訊主頁。
- 使用 Cloud Asset Inventory。
- 前往 Google Cloud 控制台的「VM instances」(VM 執行個體) 頁面。
- 按一下要查看 OS 資訊的執行個體名稱。「執行個體詳細資料」頁面隨即顯示。
- 按一下「OS 資訊」分頁標籤。
如要查看 OS 庫存資料,請啟用 VM 管理員。 如果 Google Cloud 控制台提示您啟用 VM 管理員, 請選取下列其中一個選項:- 為目前的專案啟用:為所選專案中的所有 VM 啟用 VM 管理員
- 為這個 VM 啟用:僅為所選 VM 啟用 VM 管理員
- 在「OS 資訊」分頁中查看 OS 安全漏洞清單。
如要查看特定區域中 VM 的安全漏洞報表,請使用
os-config vulnerability-reports list
指令。舉例來說,如要列出有庫存資料的所有 VM,請執行下列指令:
gcloud compute os-config vulnerability-reports list \ --location=ZONE
將
ZONE
替換為 VM 所在區域。示例
gcloud compute os-config vulnerability-reports list \ --location=us-west2-a
輸出範例
INSTANCE_ID VULNERABILITY_COUNT UPDATE_TIME 29255009728795105 2 2021-04-13T19:10:10.303046Z 307058717116242358 1 2021-04-13T19:10:10.303046Z
如要查看特定 VM 的安全漏洞報告,請執行
os-config vulnerability-reports describe
指令,並指定上一步傳回的INSTANCE_ID
或INSTANCE_NAME
。gcloud compute os-config vulnerability-reports describe VM_NAME \ --location=ZONE
更改下列內容:
VM_NAME
:VM 的名稱ZONE
:VM 執行個體所在的可用區
示例
gcloud compute os-config vulnerability-reports describe vm1-centos \ --location=us-west2-a
輸出範例
┌───────────────────────────────────────────────────────────────────┐ │ Vulnerabilities │ ├──────────────────┬──────────┬───────────────┬─────────────────────┤ │ CVE │ SEVERITY │ CVSS_V3_SCORE │ CREATE_TIME │ ├──────────────────┼──────────┼───────────────┼─────────────────────┤ │ CVE-2012-6655 │ LOW │ 3.3 │ 2021-04-29T22:19:53 │ │ CVE-2016-1585 │ MEDIUM │ 9.8 │ 2021-04-29T22:19:53 │ │ CVE-2016-2781 │ LOW │ 6.5 │ 2021-04-29T22:19:53 │ │ CVE-2019-7306 │ LOW │ 7.5 │ 2021-04-29T22:19:53 │ │ CVE-2020-13776 │ LOW │ 6.7 │ 2021-04-29T22:19:53 │ │ CVE-2021-31879 │ MEDIUM │ 6.1 │ 2021-05-05T06:11:53 │ └──────────────────┴──────────┴───────────────┴─────────────────────┘ name: projects/384587888288/locations/us-west2-a/instances/29255009728795105/vulnerabilityReport updateTime: '2021-05-11T22:29:50'
如要查看特定可用區中 VM 的安全漏洞報告,請對
projects.locations.instances.vulnerabilityReports
方法建立GET
要求。GET https://osconfig.googleapis.com/v1/projects/PROJECT_ID/locations/ZONE/instances/–/vulnerabilityReports
更改下列內容:
PROJECT_ID
:您的專案 IDZONE
:VM 所在的可用區
如要查看特定 VM 的安全漏洞報告,請對
projects.locations.instances.getVulnerabilityReport
方法建立GET
要求。GET https://osconfig.googleapis.com/v1/projects/PROJECT_ID/locations/ZONE/instances/INSTANCE/vulnerabilityReport
更改下列內容:
PROJECT_ID
:您的專案 IDZONE
:VM 執行個體所在的可用區INSTANCE
:指定 VM 的執行個體 ID 或名稱
- 設定 VM 管理員。
- 在 Google Cloud 專案中,啟用 Cloud Asset Inventory API、Google Cloud CLI,並指派權限。
- 進一步瞭解 OS 廣告空間管理。
REST
如要在本機開發環境中使用本頁的 REST API 範例,請使用您提供給 gcloud CLI 的憑證。
After installing the Google Cloud CLI, initialize it by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
詳情請參閱 Google Cloud 驗證說明文件中的「Authenticate for using REST」。
支援的作業系統
如要查看可使用 VM 管理員取得安全漏洞報告的作業系統和版本完整清單,請參閱「作業系統詳細資料」。
必要角色和權限
如要取得查看安全漏洞報告所需的權限,請要求管理員授予您專案的下列 IAM 角色:
如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和機構的存取權」。
除了這些角色,如要使用 Google Cloud 主控台存取 Compute Engine 資源,您必須在專案中擁有包含
compute.projects.get
權限的角色。查看安全漏洞報告
如要查看安全漏洞報告,請使用下列任一選項:
使用 gcloud CLI 或 API 查看安全漏洞報告
如要查看 VM 的安全漏洞報告,請使用下列其中一種方法。
主控台
如要使用 Google Cloud 控制台查看 VM 的 OS 安全漏洞報告,請執行下列步驟:
gcloud
REST
使用 Security Command Center 資訊主頁查看安全漏洞報告
Security Command Center 是 Google Cloud的集中式安全漏洞與威脅回報服務。
如果您是 Security Command Center Premium 級使用者,可以存取貴機構中 VM 執行的作業系統安全漏洞報表資料。在 Security Command Center 資訊主頁的「發現項目」頁面中,您可以查看分類為
HIGH
或CRITICAL
嚴重程度的安全漏洞的常見弱點與漏洞 (CVE) ID。如要瞭解如何使用 Security Command Center 資訊主頁存取及查看作業系統安全漏洞資料,請參閱 VM 管理員。
查看 Cloud Asset Inventory 的安全漏洞報告資料
OS 庫存管理服務會儲存庫存和安全漏洞報告資料,並轉送至 Cloud Asset Inventory。Cloud Asset Inventory 是一項中繼資料儲存庫服務,可讓您檢視、監控及分析各項資產 Google Cloud。您可以透過 Cloud Asset Inventory 輪詢資訊,並查看資料變更。
如要從 Cloud Asset Inventory 存取 OS 庫存和安全漏洞報告資料,請完成下列設定:
詳情請參閱「查看 VM 管理員資料」。
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-10 (世界標準時間)。
-