本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
使用 Amazon EventBridge 创建对 Amazon Inspector 调查发现的自定义响应
Amazon Inspector 会针对新生成的调查发现、新汇总的调查发现以及调查发现状态的变化,为 Amazon EventBridge 创建一个事件。除了对 updatedAt
和 lastObservedAt
字段进行更改之外,其他任何内容更改都将发布新事件。这意味着,当您采取诸如重启资源或更改与资源关联的标签之类的操作时,就会生成针对调查发现的新事件。但是,id
字段中的调查发现 ID 保持不变。尽最大努力发布事件。
注意
如果您的账户是 Amazon Inspector 委托管理员,EventBridge 除了会将事件发布到事件产生的成员账户外,还会将事件发布到您的账户。
将 EventBridge 事件与 Amazon Inspector 结合使用时,您可以自动执行任务,帮助您响应通过 Amazon Inspector 调查发现揭示的安全问题。
Amazon Inspector 会向同一地区的默认事件总线发送事件。这意味着您必须为运行 Amazon Inspector 的每个区域配置事件规则,才能查看该区域的事件。
要接收有关基于 EventBridge 事件的 Amazon Inspector 调查发现的通知,您必须为 Amazon Inspector 创建 EventBridge 规则和目标。此规则允许 EventBridge 将 Amazon Inspector 生成的调查发现的通知发送到在规则中指定的目标。有关更多信息,请参阅 Amazon EventBridge 用户指南中的 Amazon EventBridge 规则。
事件架构
以下是 EC2 调查发现事件的 Amazon Inspector 事件格式示例。有关其他调查发现类型和事件类型的示例架构,请参阅用于 Amazon Inspector 事件的 Amazon 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 Simple Notification Service 主题,然后将该主题关联到 EventBridge 事件规则。
第 1 步。设置 Amazon SNS 主题和端点
要设置自动警报,必须首先在 Amazon Simple Notification Service 中设置一个主题并添加一个端点。有关更多信息,请参阅 SNS 指南。
此过程可确定要将 Amazon Inspector 调查发现数据发送到何处。SNS 主题可在创建事件规则期间或之后添加到 EventBridge 事件规则中。
第 2 步。为 Amazon Inspector 调查发现创建 EventBridge 规则
访问 https://console.aws.amazon.com/events/
,打开 Amazon EventBridge 控制台。 -
从导航窗格中选择规则,然后选择创建规则。
-
输入规则名称,另还可选择输入描述。
-
选择具有事件模式的规则,然后选择下一步。
-
在事件模式窗格中,选择自定义模式(JSON 编辑器)。
-
将下面的 JSON 粘贴到编辑器中。
{ "source": ["aws.inspector2"], "detail-type": ["Inspector2 Finding"], "detail": { "severity": ["HIGH", "CRITICAL"], "status": ["ACTIVE"] } }
注意
此模式会针对 Amazon Inspector 检测到的各种严重性为
CRITICAL
或HIGH
的活动调查发现发送通知。输入完事件模式后,选择下一步。
-
在选择目标页面上,选择 Amazon Web Service。然后,对于选择目标类型,选择 SNS 主题。
-
对于选择主题,请选择您在第 1 步中创建的 SNS 主题的名称。然后选择下一步。
-
根据需要添加可选标签,然后选择下一步。
-
检查规则,然后选择创建规则。
适用于 Amazon Inspector 多账户环境的 EventBridge
如果您是 Amazon Inspector 委托管理员,则您的账户中显示的 EventBridge 规则取决于您的成员账户的适用调查发现。如果您在管理员账户中通过 EventBridge 设置了调查发现通知(如上一部分所述),您将收到有关多个账户的通知。换句话说,除了您自己账户生成的调查发现和事件的通知外,您还会收到您的成员账户生成的调查发现和事件的通知。
您可以使用调查发现的 JSON 详细信息中的 accountId
来识别产生 Amazon Inspector 调查发现的成员账户。