本页面介绍了如何设置和使用 Virtual Machine Threat Detection 来扫描 Amazon Elastic Compute Cloud (EC2) 虚拟机的永久性磁盘中的恶意软件。
如需启用 VM Threat Detection for AWS,您需要在 AWS 平台上创建 AWS IAM 角色,在 Security Command Center 内启用 VM Threat Detection for AWS,然后在 AWS 上部署 CloudFormation 模板。
准备工作
如需启用 VM Threat Detection 以与 AWS 搭配使用,您需要具备特定的 IAM 权限,并且 Security Command Center 必须连接到 AWS。
角色与权限
如需完成 VM Threat Detection for AWS 设置,您需要获得在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 - 选择组织。
- 点击 授予访问权限。
-
在新的主账号字段中,输入您的用户标识符。 这通常是 Google 账号的电子邮件地址。
- 在选择角色列表中,选择一个角色。
- 如需授予其他角色,请点击 添加其他角色,然后添加其他各个角色。
- 点击 Save(保存)。
- 使用 AWS 管理员用户账号,前往 AWS 管理控制台中的 IAM 角色页面。
- 从服务或用例菜单中,选择 lambda。
- 添加以下权限政策:
AmazonSSMManagedInstanceCore
AWSLambdaBasicExecutionRole
AWSLambdaVPCAccessExecutionRole
- 点击添加权限 > 创建内嵌政策,以创建新的权限政策:
- 打开以下页面并复制政策:AWS 漏洞评估与 VM Threat Detection 的角色政策。
- 在 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 服务启用页面。
选择您的组织。
点击 Amazon Web Services 标签页。
在服务启用部分的状态字段中,选择启用。
在 AWS 连接器部分,验证状态是否显示为 AWS 连接器已添加。
如果状态显示为未添加 AWS 连接器,请点击添加 AWS 连接器。请先完成连接到 AWS 以收集配置和资源数据中的步骤,然后再执行下一步。
ORGANIZATION_ID
:组织的数字标识符-
NEW_STATE
:ENABLED
用于启用 VM Threat Detection for AWS;DISABLED
用于停用 VM Threat Detection for AWS -
QUOTA_PROJECT
:用于结算和配额跟踪的项目 ID ORGANIZATION_ID
:组织的数字标识符-
NEW_STATE
:ENABLED
用于启用 VM Threat Detection for AWS;DISABLED
用于停用 VM Threat Detection for AWS 在 Google Cloud 控制台中,前往 Virtual Machine Threat Detection 服务启用页面。
选择您的组织。
点击 Amazon Web Services 标签页。
在部署 CloudFormation 模板部分,点击下载 CloudFormation 模板。系统会将一个 JSON 模板下载到您的工作站。您需要为您要扫描的每个 AWS 账号部署该模板。
- 前往 AWS Management Console 中的 AWS CloudFormation 模板页面。
- 依次点击堆栈 > 使用新资源(标准)。
- 在创建堆栈页面上,选择选择现有模板和上传模板文件,以上传 CloudFormation 模板。
- 上传完成后,请输入唯一的堆栈名称。请勿修改模板中的任何其他参数。
- 选择指定堆栈详细信息。系统会打开配置堆栈选项页面。
- 在权限下,选择您之前创建的 AWS 角色。
- 如果出现提示,请选中“确认”复选框。
- 点击提交以部署模板。该堆栈需要几分钟才能开始运行。
在 Google Cloud 控制台中,前往模块页面。
选择您的组织。
在模块标签页的状态列中,选择要启用或停用的模块的当前状态,然后选择以下任一选项:
- 启用:启用该模块。
- 停用:停用该模块。
ORGANIZATION_ID
:组织的数字标识符-
MODULE_NAME
:要启用或停用的模块的名称,例如MALWARE_DISK_SCAN_YARA_AWS
。有效值仅包括支持 AWS 的威胁发现结果中的模块。 -
NEW_STATE
:ENABLED
用于启用模块;DISABLED
用于停用模块 -
QUOTA_PROJECT
:用于结算和配额跟踪的项目 ID ORGANIZATION_ID
:组织的数字标识符-
MODULE_NAME
:要启用或停用的模块的名称,例如MALWARE_DISK_SCAN_YARA_AWS
。有效值仅包括支持 AWS 的威胁发现结果中的模块。 -
NEW_STATE
:ENABLED
用于启用模块;DISABLED
用于停用模块 在 Google Cloud 控制台中,前往模块页面。
选择您的组织。
-
ORGANIZATION_ID
:要获取的组织的数字标识符 -
QUOTA_PROJECT
:用于结算和配额跟踪的项目 ID -
ORGANIZATION_ID
:要获取的组织的数字标识符 - 检查 AWS 连接器是否已正确设置。
- 确认 CloudFormation 模板堆栈已完全部署。其在 AWS 账号中的状态应为
CREATION_COMPLETE
。
AWS 角色
在 AWS 中,AWS 管理员用户必须创建启用扫描所需的 AWS 账号。
如需在 AWS 中为 VM Threat Detection 创建角色,请按以下步骤操作:
稍后,您可以在 AWS 上安装 CloudFormation 模板时分配此角色。
确认 Security Command Center 已连接到 AWS
VM Threat Detection 需要访问您在创建 AWS 连接器时由 Cloud Asset Inventory 维护的 AWS 资源目录。
如果尚未建立连接,则在启用 VM Threat Detection for AWS 时,您需要设置连接。
如需设置连接,请创建 AWS 连接器。
在 Security Command Center 中启用 VM Threat Detection for AWS
必须在 Google Cloud 的组织级别启用 VM Threat Detection for 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" }
如果您已启用 AWS 漏洞评估服务,并已部署 CloudFormation 模板作为该功能的一部分,那么您已完成 VM Threat Detection for AWS 设置。
否则,请等待 6 小时,然后执行下一个任务:下载 CloudFormation 模板。
下载 CloudFormation 模板
在启用 VM Threat Detection for AWS 后至少等待六小时再执行此任务。
部署 AWS CloudFormation 模板
在创建 AWS 连接器后,至少等待六小时再执行这些步骤。
如需详细了解如何部署 CloudFormation 模板,请参阅 AWS 文档中的通过 CloudFormation 控制台创建堆栈。
部署状态会显示在 AWS 控制台中。如果 CloudFormation 模板部署失败,请参阅问题排查。
扫描开始运行后,如果检测到任何威胁,系统就会生成相应的发现结果,并将其显示在 Google Cloud 控制台的 Security Command Center 的“发现结果”页面上。如需了解详情,请参阅Google Cloud 控制台中的“查看发现结果”。
管理模块
本部分介绍了如何启用或停用模块以及查看其设置。
启用或停用模块
在您启用或停用模块后,所做的更改最长可能需要一小时才能生效。
如需了解所有 VM Threat Detection 威胁发现结果以及生成这些发现结果的模块,请参阅威胁发现结果。
控制台
借助 Google Cloud 控制台,您可以在组织级别启用或停用 VM Threat Detection 模块。
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" }
查看 VM Threat Detection for AWS 模块的设置
如需了解所有 VM Threat Detection 威胁发现结果以及生成这些发现结果的模块,请参阅威胁发现结果。
控制台
借助 Google Cloud 控制台,您可以在组织级别查看 VM Threat Detection 模块的设置。
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 Threat Detection 服务,但扫描未运行,请检查以下内容: