本頁面說明如何設定及使用虛擬機器威脅偵測,掃描 Amazon Elastic Compute Cloud (EC2) VM 的永久磁碟,找出惡意軟體。
如要為 AWS 啟用 VM 威脅偵測,您需要在 AWS 平台建立 AWS IAM 角色,在 Security Command Center 中啟用 AWS 的 VM 威脅偵測,然後在 AWS 上部署 CloudFormation 範本。
事前準備
如要啟用 VM 威脅偵測功能,以便搭配 AWS 使用,您需要特定 IAM 權限,且 Security Command Center 必須連線至 AWS。
角色和權限
如要完成 AWS 的 VM 威脅偵測設定,您必須在Google Cloud 和 AWS 中獲得具備必要權限的角色。
Google Cloud 個角色
Make sure that you have the following role or roles on the organization:
Security Center
Admin Editor (roles/securitycenter.adminEditor
)
Check for the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the organization.
-
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.
- 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
-
In the Google Cloud console, go to the IAM page.
前往「IAM」頁面 - 選取機構。
- 按一下「授予存取權」 。
-
在「New principals」(新增主體) 欄位中,輸入您的使用者 ID。 這通常是 Google 帳戶的電子郵件地址。
- 在「Select a role」(選取角色) 清單中,選取角色。
- 如要授予其他角色,請按一下 「新增其他角色」,然後新增每個其他角色。
- 按一下 [Save]。
- 使用 AWS 管理員使用者帳戶,前往 AWS 管理主控台的「IAM」角色頁面。
- 在「Service or Use Case」(服務或用途) 選單中,選取「lambda」。
- 新增下列權限政策:
AmazonSSMManagedInstanceCore
AWSLambdaBasicExecutionRole
AWSLambdaVPCAccessExecutionRole
- 依序點選「Add Permission」>「Create Inline policy」,建立新的權限政策:
- 開啟下列頁面並複製政策: AWS 和 VM 威脅偵測安全漏洞評估的角色政策。
- 在 JSON 編輯器中貼上政策。
- 指定政策名稱。
- 儲存政策。
- 開啟「信任關係」分頁。
貼入下列 JSON 物件,並新增至任何現有的陳述式陣列:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "Statement1 or replace with a unique statementId", "Effect": "Allow", "Principal": { "Service": "cloudformation.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }
儲存角色。
前往 Google Cloud 控制台的「Virtual Machine Threat Detection Service Enablement」(虛擬機器威脅偵測服務啟用) 頁面。
選取您的機構。
按一下「Amazon Web Services」分頁標籤。
在「Service Enablement」(服務啟用) 專區的「Status」(狀態) 欄位中,選取「Enable」(啟用)。
在「AWS connector」(AWS 連接器) 部分,確認狀態顯示「AWS Connector added」(已新增 AWS 連接器)。
如果狀態顯示「未新增任何 AWS 連接器」,請按一下「新增 AWS 連接器」。請先完成「連線至 AWS 以收集設定和資源資料」中的步驟,再繼續下一個步驟。
-
ORGANIZATION_ID
:機構的數值 ID -
NEW_STATE
:ENABLED
可啟用 AWS 的虛擬機器威脅偵測;DISABLED
可停用 AWS 的虛擬機器威脅偵測 -
QUOTA_PROJECT
:用於帳單和配額追蹤的專案 ID -
ORGANIZATION_ID
:機構的數值 ID -
NEW_STATE
:ENABLED
可啟用 AWS 的虛擬機器威脅偵測;DISABLED
可停用 AWS 的虛擬機器威脅偵測 前往 Google Cloud 控制台的「Virtual Machine Threat Detection Service Enablement」(虛擬機器威脅偵測服務啟用) 頁面。
選取您的機構。
按一下「Amazon Web Services」分頁標籤。
在「Deploy CloudFormation template」(部署 CloudFormation 範本) 部分,按一下「Download CloudFormation template」(下載 CloudFormation 範本)。系統會將 JSON 範本下載至您的工作站。您需要在每個要掃描的 AWS 帳戶中部署範本。
- 前往 AWS 管理主控台的「AWS CloudFormation Template」(AWS CloudFormation 範本) 頁面。
- 按一下「堆疊」>「使用新資源 (標準)」。
- 在「建立堆疊」頁面中,選取「選擇現有範本」,然後「上傳範本檔案」,即可上傳 CloudFormation 範本。
- 上傳完成後,請輸入不重複的堆疊名稱。請勿修改範本中的任何其他參數。
- 選取「指定堆疊詳細資料」。「設定堆疊選項」頁面隨即開啟。
- 在「Permissions」(權限) 下方,選取您先前建立的 AWS 角色。
- 如果系統出現提示,請勾選方塊表示確認。
- 按一下「提交」即可部署範本。堆疊需要幾分鐘才會開始執行。
前往 Google Cloud 控制台的「模組」頁面。
選取您的機構。
在「模組」分頁的「狀態」欄中,選取要啟用或停用模組的目前狀態,然後選取下列其中一個選項:
- 啟用:啟用模組。
- 停用:停用模組。
-
ORGANIZATION_ID
:機構的數值 ID -
MODULE_NAME
:要啟用或停用的模組名稱,例如MALWARE_DISK_SCAN_YARA_AWS
。有效值僅包含支援 AWS 的「威脅發現」模組。 -
NEW_STATE
:ENABLED
啟用模組;DISABLED
停用模組 -
QUOTA_PROJECT
:用於帳單和配額追蹤的專案 ID -
ORGANIZATION_ID
:機構的數值 ID -
MODULE_NAME
:要啟用或停用的模組名稱,例如MALWARE_DISK_SCAN_YARA_AWS
。有效值僅包含支援 AWS 的「威脅發現」模組。 -
NEW_STATE
:ENABLED
啟用模組;DISABLED
停用模組 前往 Google Cloud 控制台的「模組」頁面。
選取您的機構。
-
ORGANIZATION_ID
:要取得的機構數值 ID。 -
QUOTA_PROJECT
:用於帳單和配額追蹤的專案 ID -
ORGANIZATION_ID
:要取得的機構數值 ID。 - 確認 AWS 連接器設定正確無誤。
- 確認 CloudFormation 範本堆疊已完整部署。在 AWS 帳戶中的狀態應為
CREATION_COMPLETE
。 - 瞭解如何使用 VM 威脅偵測功能。
- 瞭解如何調查 VM 威脅偵測結果。
AWS 角色
在 AWS 中,AWS 管理使用者必須建立啟用掃描所需的 AWS 帳戶。
如要在 AWS 中為 VM 威脅偵測建立角色,請按照下列步驟操作:
稍後在 AWS 安裝 CloudFormation 範本時,您會指派這個角色。
確認 Security Command Center 已連線至 AWS
建立 AWS 連接器時,VM 威脅偵測功能需要存取 Cloud Asset Inventory 維護的 AWS 資源清單。
如果尚未建立連線,啟用 AWS 的 VM 威脅偵測功能時,您必須設定連線。
如要設定連線,請建立 AWS 連接器。
在 Security Command Center 中啟用 AWS 的虛擬機器威脅偵測
您必須在機構層級 Google Cloud 啟用 AWS 的虛擬機器威脅偵測功能。
控制台
gcloud
gcloud scc manage services update
指令會更新 Security Command Center 服務或模組的狀態。
使用下方的任何指令資料之前,請先替換以下項目:
執行
gcloud scc manage services update
指令:
Linux、macOS 或 Cloud Shell
gcloud scc manage services update vm-threat-detection-aws \ --organization=ORGANIZATION_ID \ --enablement-state=NEW_STATE
Windows (PowerShell)
gcloud scc manage services update vm-threat-detection-aws ` --organization=ORGANIZATION_ID ` --enablement-state=NEW_STATE
Windows (cmd.exe)
gcloud scc manage services update vm-threat-detection-aws ^ --organization=ORGANIZATION_ID ^ --enablement-state=NEW_STATE
您應該會收到類似以下的回應:
effectiveEnablementState: ENABLED intendedEnablementState: ENABLED modules: MALWARE_DISK_SCAN_YARA_AWS: effectiveEnablementState: ENABLED intendedEnablementState: ENABLED name: organizations/1234567890/locations/global/securityCenterServices/vm-threat-detection-aws updateTime: '2025-03-21T18:45:52.033110465Z'
REST
Security Command Center Management API 的 organizations.locations.securityCenterServices.patch
方法會更新 Security Command Center 服務或模組的狀態。
使用任何要求資料之前,請先替換以下項目:
HTTP 方法和網址:
PATCH https://securitycentermanagement.googleapis.com/v1/organizations/ORGANIZATION_ID/locations/global/securityCenterServices/vm-threat-detection-aws?updateMask=intendedEnablementState
JSON 要求主體:
{ "intendedEnablementState": "NEW_STATE" }
如要傳送要求,請展開以下其中一個選項:
您應該會收到如下的 JSON 回應:
{ "name": "organizations/1234567890/locations/global/securityCenterServices/vm-threat-detection-aws", "intendedEnablementState": "ENABLED", "effectiveEnablementState": "ENABLED", "modules": { "MALWARE_DISK_SCAN_YARA_AWS": { "intendedEnablementState": "ENABLED", "effectiveEnablementState": "ENABLED" } }, "updateTime": "2025-03-21T18:45:52.033110465Z" }
如果您已啟用 Vulnerability Assessment for AWS 服務,並部署 CloudFormation 範本 (該功能的一部分),則已完成 AWS 虛擬機器威脅偵測的設定。
否則請等待六小時,然後執行下一個工作:下載 CloudFormation 範本。
下載 CloudFormation 範本
請在為 AWS 啟用 VM 威脅偵測至少六小時後,再執行這項工作。
部署 AWS CloudFormation 範本
請在建立 AWS 連接器至少六小時後,執行下列步驟。
如要進一步瞭解如何部署 CloudFormation 範本,請參閱 AWS 文件中的「從 CloudFormation 控制台建立堆疊」。
AWS 控制台會顯示部署狀態。如果 CloudFormation 範本無法部署,請參閱疑難排解。
掃描作業開始執行後,如果偵測到任何威脅,系統會產生相應的發現項目,並顯示在 Google Cloud 控制台的 Security Command Center「發現項目」頁面。詳情請參閱在Google Cloud 控制台中查看結果。
管理模組
本節說明如何啟用或停用模組,以及查看模組設定。
啟用或停用模組
啟用或停用模組後,變更最多可能需要 1 小時才會生效。
如要瞭解所有 VM Threat Detection 威脅調查結果和產生這些結果的模組,請參閱「威脅調查結果」。
控制台
您可以在 Google Cloud 控制台中啟用或停用機構層級的 VM 威脅偵測模組。
gcloud
gcloud scc manage services update
指令會更新 Security Command Center 服務或模組的狀態。
使用下方的任何指令資料之前,請先替換以下項目:
將下列內容儲存到名為 request.json
的檔案:
{ "MODULE_NAME": { "intendedEnablementState": "NEW_STATE" } }
執行
gcloud scc manage services update
指令:
Linux、macOS 或 Cloud Shell
gcloud scc manage services update vm-threat-detection-aws \ --organization=ORGANIZATION_ID \ --enablement-state=ENABLED \ --module-config-file=request.json
Windows (PowerShell)
gcloud scc manage services update vm-threat-detection-aws ` --organization=ORGANIZATION_ID ` --enablement-state=ENABLED \ --module-config-file=request.json
Windows (cmd.exe)
gcloud scc manage services update vm-threat-detection-aws ^ --organization=ORGANIZATION_ID ^ --enablement-state=ENABLED \ --module-config-file=request.json
您應該會收到類似以下的回應:
effectiveEnablementState: ENABLED intendedEnablementState: ENABLED modules: MALWARE_DISK_SCAN_YARA_AWS: effectiveEnablementState: ENABLED intendedEnablementState: ENABLED name: organizations/1234567890/locations/global/securityCenterServices/vm-threat-detection-aws updateTime: '2025-03-21T18:45:52.033110465Z'
REST
Security Command Center Management API 的 organizations.locations.securityCenterServices.patch
方法會更新 Security Command Center 服務或模組的狀態。
使用任何要求資料之前,請先替換以下項目:
HTTP 方法和網址:
PATCH https://securitycentermanagement.googleapis.com/v1/organizations/ORGANIZATION_ID/locations/global/securityCenterServices/vm-threat-detection-aws?updateMask=modules
JSON 要求主體:
{ "modules": { "MODULE_NAME": { "intendedEnablementState": "NEW_STATE" } } }
如要傳送要求,請展開以下其中一個選項:
您應該會收到如下的 JSON 回應:
{ "name": "organizations/1234567890/locations/global/securityCenterServices/vm-threat-detection-aws", "intendedEnablementState": "ENABLED", "effectiveEnablementState": "ENABLED", "modules": { "MALWARE_DISK_SCAN_YARA_AWS": { "intendedEnablementState": "ENABLED", "effectiveEnablementState": "ENABLED" } }, "updateTime": "2025-03-21T18:45:52.033110465Z" }
查看 AWS 模組的虛擬機器威脅偵測設定
如要瞭解所有 VM 威脅偵測威脅調查結果和產生這些結果的模組,請參閱「威脅調查結果」。
控制台
您可以在 Google Cloud 控制台中,查看機構層級的 VM 威脅偵測模組設定。
gcloud
gcloud scc manage services describe
指令會取得 Security Command Center 服務或模組的狀態。
使用下方的任何指令資料之前,請先替換以下項目:
執行
gcloud scc manage services describe
指令:
Linux、macOS 或 Cloud Shell
gcloud scc manage services describe vm-threat-detection-aws \ --organization=ORGANIZATION_ID
Windows (PowerShell)
gcloud scc manage services describe vm-threat-detection-aws ` --organization=ORGANIZATION_ID
Windows (cmd.exe)
gcloud scc manage services describe vm-threat-detection-aws ^ --organization=ORGANIZATION_ID
您應該會收到類似以下的回應:
effectiveEnablementState: ENABLED intendedEnablementState: ENABLED modules: MALWARE_DISK_SCAN_YARA_AWS: effectiveEnablementState: ENABLED intendedEnablementState: ENABLED name: organizations/1234567890/locations/global/securityCenterServices/vm-threat-detection-aws updateTime: '2025-03-21T18:45:52.033110465Z'
REST
Security Command Center Management API 的
organizations.locations.securityCenterServices.get
方法會取得 Security Command Center 服務或模組的狀態。
使用任何要求資料之前,請先替換以下項目:
HTTP 方法和網址:
GET https://securitycentermanagement.googleapis.com/v1/organizations/ORGANIZATION_ID/locations/global/securityCenterServices/vm-threat-detection-aws
如要傳送要求,請展開以下其中一個選項:
您應該會收到如下的 JSON 回應:
{ "name": "organizations/1234567890/locations/global/securityCenterServices/vm-threat-detection-aws", "intendedEnablementState": "ENABLED", "effectiveEnablementState": "ENABLED", "modules": { "MALWARE_DISK_SCAN_YARA_AWS": { "intendedEnablementState": "ENABLED", "effectiveEnablementState": "ENABLED" } }, "updateTime": "2025-03-21T18:45:52.033110465Z" }
疑難排解
如果您已啟用 VM 威脅偵測服務,但掃描作業未執行,請檢查下列事項: