本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
使用亚马逊创建对 Amazon Inspector 调查结果的自定义回复 EventBridge
Amazon Inspector EventBridge 针对新生成的调查结果、新汇总的调查结果以及调查结果状态的变化为亚马逊创建一个事件。除了对 updatedAt
和 lastObservedAt
字段进行更改之外,其他任何内容更改都将发布新事件。这意味着,当您采取诸如重启资源或更改与资源关联的标签之类的操作时,就会生成针对调查发现的新事件。但是,id
字段中的调查发现 ID 保持不变。尽最大努力发布事件。
注意
如果您的账户是 Amazon Inspector 授权的管理员,则除了发送事件的成员账户外,还会将事件 EventBridge 发布到您的账户。
当您将 EventBridge 事件与 Amazon Inspector 配合使用时,您可以自动执行任务,以帮助您应对亚马逊检查员发现的安全问题。
Amazon Inspector 会向同一地区的默认事件总线发送事件。这意味着您必须为运行 Amazon Inspector 的每个区域配置事件规则,才能查看该区域的事件。
要接收有关基于 EventBridge 事件的 Amazon Inspector 调查结果的通知,您必须为 Amazon Inspector 创建 EventBridge 规则和目标。该规则允许 EventBridge 将 Amazon Inspector 生成的调查结果通知发送到规则中指定的目标。有关更多信息,请参阅 EventBridge《亚马逊 EventBridge 用户指南》中的亚马逊规则。
事件架构
以下是 EC2 调查发现事件的 Amazon Inspector 事件格式示例。有关其他调查发现类型和事件类型的示例架构,请参阅亚马逊 Inspector EventBridge 事件的亚马逊事件架构。
{ "version": "0", "id": "66a7a279-5f92-971c-6d3e-c92da0950992", "detail-type": "Inspector2 Finding", "source": "aws.inspector2", "account": "111122223333", "time": "2023-01-19T22:46:15Z", "region": "us-east-1", "resources": ["i-0c2a343f1948d5205"], "detail": { "awsAccountId": "111122223333", "description": "\n It was discovered that the sound subsystem in the Linux kernel contained a\n race condition in some situations. A local attacker could use this to cause\n a denial of service (system crash).", "exploitAvailable": "YES", "exploitabilityDetails": { "lastKnownExploitAt": "Oct 24, 2022, 11:08:59 PM" }, "findingArn": "arn:aws:inspector2:us-east-1:111122223333:finding/FINDING_ID", "firstObservedAt": "Jan 19, 2023, 10:46:15 PM", "fixAvailable": "YES", "lastObservedAt": "Jan 19, 2023, 10:46:15 PM", "packageVulnerabilityDetails": { "cvss": [{ "baseScore": 4.7, "scoringVector": "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H", "source": "NVD", "version": "3.1" }], "referenceUrls": ["https://lore.kernel.org/all/CAFcO6XN7JDM4xSXGhtusQfS2mSBcx50VJKwQpCq=WeLt57aaZA@mail.gmail.com/", "https://ubuntu.com/security/notices/USN-5792-1", "https://ubuntu.com/security/notices/USN-5791-2", "https://ubuntu.com/security/notices/USN-5791-1", "https://ubuntu.com/security/notices/USN-5793-2", "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8423f0b6d513b259fdab9c9bf4aaa6188d054c2d", "https://ubuntu.com/security/notices/USN-5793-1", "https://ubuntu.com/security/notices/USN-5792-2", "https://ubuntu.com/security/notices/USN-5791-3", "https://ubuntu.com/security/notices/USN-5793-4", "https://ubuntu.com/security/notices/USN-5793-3", "https://git.kernel.org/linus/8423f0b6d513b259fdab9c9bf4aaa6188d054c2d(6.0-rc5)", "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-3303"], "relatedVulnerabilities": [], "source": "UBUNTU_CVE", "sourceUrl": "https://people.canonical.com/~ubuntu-security/cve/2022/CVE-2022-3303.html", "vendorCreatedAt": "Sep 27, 2022, 11:15:00 PM", "vendorSeverity": "medium", "vulnerabilityId": "CVE-2022-3303", "vulnerablePackages": [{ "arch": "X86_64", "epoch": 0, "fixedInVersion": "0:5.15.0.1027.31~20.04.16", "name": "linux-image-aws", "packageManager": "OS", "remediation": "apt update && apt install --only-upgrade linux-image-aws", "version": "5.15.0.1026.30~20.04.16" }] }, "remediation": { "recommendation": { "text": "None Provided" } }, "resources": [{ "details": { "awsEc2Instance": { "iamInstanceProfileArn": "arn:aws:iam::111122223333:instance-profile/AmazonSSMRoleForInstancesQuickSetup", "imageId": "ami-0b7ff1a8d69f1bb35", "ipV4Addresses": ["172.31.85.212", "44.203.45.27"], "ipV6Addresses": [], "launchedAt": "Jan 19, 2023, 7:53:14 PM", "platform": "UBUNTU_20_04", "subnetId": "subnet-8213f2a3", "type": "t2.micro", "vpcId": "vpc-ab6650d1" } }, "id": "i-0c2a343f1948d5205", "partition": "aws", "region": "us-east-1", "type": "AWS_EC2_INSTANCE" }], "severity": "MEDIUM", "status": "ACTIVE", "title": "CVE-2022-3303 - linux-image-aws", "type": "PACKAGE_VULNERABILITY", "updatedAt": "Jan 19, 2023, 10:46:15 PM" } }
创建 EventBridge 规则以通知您 Amazon Inspector 的调查结果
为了提高 Amazon Inspector 调查结果的可见性,您可以使用 EventBridge 设置发送到消息中心的自动查找提醒。本主题向您展示如何向电子邮件、Slack 或 Amazon Chime 发送严重性为 CRITICAL
和 HIGH
的调查发现提醒。您将学习如何设置 Amazon 简单通知服务主题,然后将该主题关联到 EventBridge 事件规则。
第 1 步。设置 Amazon SNS 主题和端点
要设置自动警报,必须首先在 Amazon Simple Notification Service 中设置一个主题并添加一个端点。有关更多信息,请参阅 SNS 指南。
此过程可确定要将 Amazon Inspector 调查发现数据发送到何处。可以在 EventBridge 事件规则创建期间或之后将 SNS 主题添加到事件规则中。
第 2 步。为 Amazon Inspector 的调查结果创建 EventBridge 规则
打开亚马逊 EventBridge 控制台,网址为 https://console.aws.amazon.com/events/
。 -
从导航窗格中选择规则,然后选择创建规则。
-
输入规则名称,另还可选择输入描述。
-
选择具有事件模式的规则,然后选择下一步。
-
在事件模式窗格中,选择自定义模式(JSON 编辑器)。
-
将下面的 JSON 粘贴到编辑器中。
{ "source": ["aws.inspector2"], "detail-type": ["Inspector2 Finding"], "detail": { "severity": ["HIGH", "CRITICAL"], "status": ["ACTIVE"] } }
注意
此模式会针对 Amazon Inspector 检测到的各种严重性为
CRITICAL
或HIGH
的活动调查发现发送通知。输入完事件模式后,选择下一步。
-
在选择目标页面上,选择 AWS 服务。然后,对于选择目标类型,选择 SNS 主题。
-
对于选择主题,请选择您在第 1 步中创建的 SNS 主题的名称。然后选择下一步。
-
根据需要添加可选标签,然后选择下一步。
-
检查规则,然后选择创建规则。
EventBridge 适用于 Amazon Inspector 多账户环境
如果您是 Amazon Inspector 的授权管理员, EventBridge 则规则会根据您的成员账户中的适用调查结果显示在您的账户上。如果您通过 EventBridge 管理员帐户设置发现通知(如上一节所述),您将收到有关多个账户的通知。换句话说,除了您自己账户生成的调查发现和事件的通知外,您还会收到您的成员账户生成的调查发现和事件的通知。
您可以使用调查发现的 JSON 详细信息中的 accountId
来识别产生 Amazon Inspector 调查发现的成员账户。