軟體安全漏洞是指可能導致系統意外故障或惡意活動的弱點。詳情請參閱「漏洞報告」。
本文件說明如何使用 VM 管理員設定 VM,以及查看作業系統的安全漏洞報告。
事前準備
- 查看 OS Config 配額。
- 設定 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.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the 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.
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
-
支援的作業系統
如需使用 VM 管理員取得漏洞報告時,可用的作業系統和版本完整清單,請參閱「作業系統詳細資料」。
必要角色和權限
如要取得查看安全漏洞報告所需的權限,請要求管理員為您授予專案的下列 IAM 角色:
-
如要使用 gcloud CLI 或 API 查看安全漏洞報告,請按照下列步驟操作:
OS Config Vulnerability Report Viewer (
roles/osconfig.vulnerabilityReportViewer
) -
如要使用 Google Cloud 控制台查看漏洞報告,請按照下列步驟操作:
-
OS Config Vulnerability Report Viewer (
roles/osconfig.vulnerabilityReportViewer
) -
OS 庫存檢視器 (
roles/osconfig.inventoryViewer
)
-
OS Config Vulnerability Report Viewer (
-
如要在「Patch」頁面的「VM 執行個體詳細資料」對話方塊中查看 CVE 資訊,請按照下列步驟操作:
-
Patch Deployment Viewer (
roles/osconfig.patchDeploymentViewer
) -
修補工作檢視器 (
roles/osconfig.patchJobViewer
)
-
Patch Deployment Viewer (
如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和機構的存取權」。
除了這些角色之外,如要使用 Google Cloud 主控台存取 Compute Engine 資源,您的角色必須包含專案的 compute.projects.get
權限。
查看安全漏洞報告
如要查看安全漏洞報告,請使用下列任一選項:
- 使用 Google Cloud 控制台、gcloud CLI 或 API。
- 如果您是 Security Command Center 進階級使用者,請使用 Security Command Center 資訊主頁。
- 使用 Cloud Asset Inventory。
使用 gcloud CLI 或 API 查看安全漏洞報告
請使用下列其中一種方法,查看 VM 的漏洞報告。
主控台
如要使用 Google Cloud 控制台查看 VM 的 OS 漏洞報告,請執行下列步驟:
- 前往 Google Cloud 控制台的「VM instances」(VM 執行個體) 頁面。
- 按一下要查看 OS 資訊的執行個體名稱。「Instance details」(執行個體詳細資料) 頁面隨即顯示。
- 按一下「OS 資訊」分頁標籤。
如要查看 OS 庫存資料,您必須啟用 VM 管理工具。如果 Google Cloud 控制台提示您啟用 VM Manager,請選取下列任一選項:- 為目前專案啟用:為所選專案中的所有 VM 啟用 VM 管理員
- 為此 VM 啟用:僅為所選 VM 啟用 VM 管理員
- 在「OS 資訊」分頁中查看 OS 安全漏洞清單。
gcloud
如要查看特定區域中 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'
REST
如要查看特定區域中 VM 的安全漏洞報告,請建立
GET
要求,並傳送至projects.locations.instances.vulnerabilityReports
方法。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 或名稱
使用 Security Command Center 資訊主頁查看安全漏洞報告
Security Command Center 是 Google Cloud的集中式安全漏洞與威脅回報服務。
如果您是 Security Command Center Premium 級使用者,即可存取貴機構 VM 上執行的作業系統的安全漏洞報表資料。
在 Security Command Center 資訊主頁的「發現項目」頁面中,您可以查看所有已識別的作業系統安全漏洞,以及相關的 Common Vulnerabilities and Exposures (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 管理員。
- 在 Google Cloud 專案中啟用 Cloud Asset Inventory API、Google Cloud CLI 和指派權限。
詳情請參閱「查看 VM 管理員資料」。
後續步驟
- 進一步瞭解OS 廣告空間管理。