本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
配置 EventBridge 自动发送调查结果的规则
您可以在中创建规则 EventBridge 定义了在Security Hub Findings - Imported已收到事件。Security Hub Findings - Imported事件由两者的更新触发。BatchImportFindings
和BatchUpdateFindings
.
每个规则都包含一个事件模式,用于标识触发该规则的事件。事件模式始终包含事件源(aws.securityhub
) 和事件类型 (Security Hub 调查结果-导入)。事件模式还可以指定筛选器来标识规则应用到的结果。
然后,规则标识规则目标。目标是在时要采取的行动 EventBridge收到Security Hub 调查结果-导入事件和查找结果与过滤器匹配。
此处提供的说明使用 EventBridge 控制台。当您使用控制台时, EventBridge自动创建所需的基于资源的策略,以启用 EventBridge 写入 CloudWatch 日志。
您也可以使用PutRule
的 API 操作 EventBridge API。但是,如果您使用 EventBridge 然后,您必须创建基于资源的策略。有关所需策略的详细信息,请参阅。CloudWatch 记录权限中的亚马逊 EventBridge 用户指南.
事件模式的格式
的事件模式的格式Security Hub 调查结果-导入事件如下:
{ "source": [ "aws.securityhub" ], "detail-type": [ "Security Hub Findings - Imported" ], "detail": { "findings": {
<attribute filter values>
} } }
-
source
将 Security Hub 标识为生成事件的服务。 -
detail-type
标识事件的类型。 -
detail
是可选的,并提供事件模式的过滤器值。如果事件模式不包含detail
字段中,则所有发现都触发该规则。
您可以根据任何查找属性过滤调查结果。对于每个属性,您可以提供一个逗号分隔的数组,其中包含一个或多个值。
"
<attribute name>
": [ "<value1>
", "<value2>
"]
如果您为某个属性提供了多个值,则这些值将通过连接OR
. 如果查找结果具有列出的任何值,则查找结果与单个属性的筛选器匹配。例如,如果你同时提供两者INFORMATIONAL
和LOW
作为的值Severity.Label
,那么查找结果如果严重性标签为INFORMATIONAL
要么LOW
.
这些属性是由AND
. 如果结果符合所有提供属性的筛选条件,则会匹配结果。
当您提供属性值时,它必须反映该属性在AmazonSecurity Fin 格式 (ASFF) 结构。
在以下示例中,事件模式为ProductArn
和Severity.Label
,因此如果查找结果是由 Amazon Inspector 生成的,并且其严重性标签为INFORMATIONAL
要么LOW
.
{ "source": [ "aws.securityhub" ], "detail-type": [ "Security Hub Findings - Imported" ], "detail": { "findings": { "ProductArn": ["arn:aws:securityhub:us-east-1::product/aws/inspector"], "Severity": { "Label": ["INFORMATIONAL", "LOW"] } } } }
创建事件规则
您可以使用预定义的事件模式或自定义事件模式在 EventBridge. 如果选择预定义的模式, EventBridge 自动填写source
和detail-type
. EventBridge 还提供了用于为以下查找属性指定筛选器值的字段:
-
AwsAccountId
-
Compliance.Status
-
Criticality
-
ProductArn
-
RecordState
-
ResourceId
-
ResourceType
-
Severity.Label
-
Types
-
Workflow.Status
创建 EventBridge 规则
打开 Amazon EventBridge 控制台https://console.aws.amazon.com/events/
. -
使用以下值创建 EventBridge 监控查找事件的规则:
-
对于 Rule type(规则类型),选择 Rule with an event pattern(具有事件模式的规则)。
-
选择如何构建事件模式。
用... 构建事件模式 请执行此操作... 一个模板
在事件模式选择以下选项:
-
适用于事件源,选择Amazon服务.
-
适用于Amazon服务,选择Security Hub.
-
适用于Event type,选择Security Hub 调查结果-导入.
-
(可选)要使规则更具体,请添加筛选器值。例如,要将规则限制在具有活动记录状态的查找结果中,特定记录状态,选择处于活动状态.
自定义事件模式
(如果要根据未显示在 EventBridge 控制台。)
-
在事件模式部分,选择自定义模式(JSON 编辑器)然后,在文本区域中粘贴以下事件模式:
{ "source": [ "aws.securityhub" ], "detail-type": [ "Security Hub Findings - Imported" ], "detail": { "findings": { "
<attribute name>
": [ "<value1>
", "<value2>
"] } } }
-
更新事件模式以包括要用作筛选器的属性和属性值。
例如,要将规则应用于验证状态为
TRUE_POSITIVE
,使用以下模式示例:{ "source": [ "aws.securityhub" ], "detail-type": [ "Security Hub Findings - Imported" ], "detail": { "findings": { "VerificationState": ["TRUE_POSITIVE"] } } }
-
-
适用于目标类型,选择Amazon服务,以及选择一个目标中,选择一个目标,例如 Amazon SNS 主题或Amazon Lambdafunction. 在收到与规则中定义的事件模式匹配的事件时将触发目标。
有关创建规则的细节,请参阅。创建 Amazon EventBridge 对事件做出反应的规则中的亚马逊 EventBridge 用户指南.
-