收集 AWS Security Hub 日志
本文档介绍了如何将 AWS Security Hub 日志注入到 Google Security Operations。AWS Security Hub 可全面查看各个 AWS 账号中的安全提醒和发现结果。通过将这些发现结果发送到 Google SecOps,您可以使用 Google SecOps 功能来增强监控和威胁检测。
准备工作
确保您满足以下前提条件:
- Google SecOps 实例
- 对 AWS 的特权访问权限
配置 AWS IAM 和 S3
- 按照以下用户指南创建 Amazon S3 存储桶:创建存储桶。
- 保存相应存储桶的名称和区域以备后用。
- 按照以下用户指南创建用户:创建 IAM 用户。
- 选择创建的用户。
- 选择安全凭据标签页。
- 在访问密钥部分中,点击创建访问密钥。
- 选择第三方服务作为使用情形。
- 点击下一步。
- 可选:添加说明标记。
- 点击创建访问密钥。
- 点击 Download CSV file(下载 CSV 文件),保存访问密钥和不公开的访问密钥以供日后使用。
- 点击完成。
- 选择权限标签页。
- 在权限政策部分中,点击添加权限。
- 选择添加权限。
- 选择直接附加政策。
- 搜索并选择 AmazonS3FullAccess 政策。
- 点击下一步。
- 点击添加权限。
创建 Lambda 函数
- 登录 AWS Management Console。
- 前往 Lambda。
- 点击创建函数,然后选择从头开始编写。
- 为函数命名,例如
SecurityHubToS3
。 - 为运行时选择 Python 3.x。
输入以下 Lambda 代码,该代码可从 EventBridge 获取检测结果并将其写入您的 S3 存储桶:
import json import boto3 from datetime import datetime # Initialize the S3 client s3_client = boto3.client('s3') # S3 bucket where findings will be stored bucket_name = 'aws-security-hub-findings-stream' def lambda_handler(event, context): # Extract Security Hub findings from the event findings = event['detail']['findings'] # Generate a timestamp for the file name to avoid overwriting timestamp = datetime.now().strftime('%Y-%m-%dT%H-%M-%S') # Generate the S3 object key (file name) based on the timestamp object_key = f"security_hub_findings_{timestamp}.json" # Convert findings to JSON format findings_json = json.dumps(findings) # Upload the findings to S3 try: response = s3_client.put_object( Bucket=bucket_name, Key=object_key, Body=findings_json, ContentType='application/json' ) print(f"Successfully uploaded findings to S3: {response}") except Exception as e: print(f"Error uploading findings to S3: {e}") raise e return { 'statusCode': 200, 'body': json.dumps('Successfully processed findings') }
通过向 Lambda 函数添加具有以下政策的 IAM 角色来设置 Lambda 的权限:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::aws-security-hub-findings-stream/*" } ] }
如何配置 AWS Security Hub 以通过 EventBridge 转发发现结果
- 登录 AWS Management Console。
- 在搜索栏中,输入并从服务列表中选择 Security Hub。
- 点击设置。
- 在集成部分下,找到 EventBridge,然后点击启用。
- 在搜索栏中,输入并从服务列表中选择 EventBridge。
- 在 EventBridge 控制台中,依次点击规则 > 创建规则。
- 提供以下规则配置:
- 规则名称:为规则提供一个描述性名称,例如 SendSecurityHubFindingsToS3。
- 事件源:选择 AWS 服务。
- 服务名称:选择 Security Hub。
- 事件类型:选择 Security Hub 检测结果。
- 设置目标:选择 Lambda 函数。
- 选择您刚刚创建的 Lambda 函数 (
SecurityHubToS3
)。
- 点击创建。
设置 Feed
您可以通过两种不同的入口点在 Google SecOps 平台中设置 Feed:
- SIEM 设置 > Feed
- 内容中心 > 内容包
通过“SIEM 设置”>“Feed”设置 Feed
如需为相应产品系列中的不同日志类型配置多个 Feed,请参阅配置多个 Feed。
如需配置单个 Feed,请按以下步骤操作:
- 依次前往 SIEM 设置> Feed。
- 点击添加新 Feed。
- 在下一页上,点击配置单个 Feed。
- 在信息流名称字段中,输入信息流的名称,例如 AWS Security Hub 日志。
- 选择 Amazon S3 作为来源类型。
- 选择 AWS Security Hub 作为日志类型。
- 点击下一步。
为以下输入参数指定值:
- 区域:Amazon S3 存储桶所在的区域。
- S3 URI:存储桶 URI。
s3://your-log-bucket-name/
- 将
your-log-bucket-name
替换为您的 S3 存储桶的实际名称。
- 将
- URI is a:根据您的存储桶结构,选择目录或目录(包括子目录)。
源删除选项:根据您的提取偏好设置选择删除选项。
访问密钥 ID:有权从 S3 存储桶读取数据的用户的访问密钥。
私有访问密钥:具有从 S3 存储桶读取权限的用户的私有密钥。
资源命名空间:资源命名空间。
注入标签:要应用于此 Feed 中事件的标签。
点击下一步。
在最终确定界面中查看新的 Feed 配置,然后点击提交。
设置来自内容中心的 Feed
为以下字段指定值:
- 区域:Amazon S3 存储桶所在的区域。
- S3 URI:存储桶 URI。
s3://your-log-bucket-name/
- 将
your-log-bucket-name
替换为您的 S3 存储桶的实际名称。
- 将
- URI is a:根据您的存储桶结构,选择目录或目录(包括子目录)。
- 源删除选项:根据您的提取偏好设置选择删除选项。
访问密钥 ID:有权从 S3 存储桶读取数据的用户的访问密钥。
私有访问密钥:具有从 S3 存储桶读取权限的用户的私有密钥。
高级选项
- Feed 名称:用于标识 Feed 的预填充值。
- 来源类型:用于将日志收集到 Google SecOps 中的方法。
- 资产命名空间:与 Feed 关联的命名空间。
- 提取标签:应用于相应 Feed 中所有事件的标签。
UDM 映射表
日志字段 | UDM 映射 | 逻辑 |
---|---|---|
account |
principal.group.product_object_id |
与发现关联的 AWS 账号 ID。 |
configurationItem.ARN |
target.resource.id |
配置项的 Amazon 资源名称 (ARN)。 |
configurationItem.awsAccountId |
principal.user.userid |
配置项的 AWS 账号 ID。 |
configurationItem.awsRegion |
target.asset.location.country_or_region |
配置项的 AWS 区域。 |
configurationItem.configuration.complianceType |
security_result.summary |
配置项的合规性类型。 |
configurationItem.configuration.configRuleList[].complianceType |
security_result.summary |
每条配置规则的合规性状态。 |
configurationItem.configuration.configRuleList[].configRuleArn |
security_result.rule_id |
AWS Config 规则的 ARN。 |
configurationItem.configuration.configRuleList[].configRuleId |
security_result.about.labels.configRuleId |
AWS Config 规则的 ID。 |
configurationItem.configuration.configRuleList[].configRuleName |
security_result.rule_name |
AWS Config 规则的名称。 |
configurationItem.configuration.privateIpAddress |
target.ip |
配置项的专用 IP 地址。 |
configurationItem.configuration.publicIpAddress |
target.ip |
配置项的公共 IP 地址。 |
configurationItem.configurationItemCaptureTime |
target.asset.attribute.creation_time |
配置项的捕获时间,已转换为时间戳。 |
configurationItem.configurationItemStatus |
target.asset.attribute.labels.Configuration Item Status |
配置项的状态。 |
configurationItem.relationships[].resourceId |
target.asset.attribute.cloud.vpc.id |
相关资源的资源 ID,如果与 vpc 匹配,则用于 VPC ID。 |
configurationItem.resourceId |
target.resource.id |
配置项的资源 ID。 |
configurationItem.resourceName |
target.resource.name |
资源的名称。 |
configurationItem.resourceType |
target.resource.resource_subtype |
配置项的资源类型。 |
configurationItem.tags.Contact |
principal.user.user_display_name 或 principal.user.email_addresses |
从标记中提取的联系人详细信息,已解析为电子邮件地址和用户名。 |
configurationItem.tags.OS /configurationItem.tags.Os |
target.asset.platform_software.platform |
来自标记的操作系统,如果为 Windows 或 Linux ,则映射到平台。 |
configurationItemDiff.changeType |
metadata.event_type |
更改类型,映射到 RESOURCE_WRITTEN 或 RESOURCE_CREATION。 |
detail.accountId |
principal.group.product_object_id |
与发现关联的 AWS 账号 ID。 |
detail.actionDescription detail.actionName detail.description |
sec_result.description |
调查结果的说明。 |
detail.findings[].AwsAccountId |
principal.group.product_object_id |
与发现关联的 AWS 账号 ID。 |
detail.findings[].CompanyName detail.findings[].CreatedAt detail.findings[].Description |
sec_result.description |
调查结果的说明。 |
detail.findings[].FindingProviderFields.Severity.Label |
sec_result.severity |
发现结果的严重程度标签,会转换为大写。 |
detail.findings[].FindingProviderFields.Types[] detail.findings[].FirstObservedAt detail.findings[].GeneratorId detail.findings[].Id detail.findings[].LastObservedAt detail.findings[].ProductArn detail.findings[].ProductFields. |
如下所示 | 用于其他字段、正文和目标信息的各种字段。 |
detail.findings[].ProductName detail.findings[].RecordState detail.findings[].Region |
target.location.name |
发现结果的 AWS 区域。 |
detail.findings[].Resources[].Details. |
如下所示 | 与发现结果相关的资源的详细信息。 |
detail.findings[].Resources[].Id |
target.resource.product_object_id |
资源的 ID。 |
detail.findings[].Resources[].Partition detail.findings[].Resources[].Region |
target.location.name |
资源的 AWS 区域。 |
detail.findings[].Resources[].Tags detail.findings[].Resources[].Type |
target.resource.resource_type 、target.resource.resource_subtype 、metadata.event_type |
用于资源类型、子类型和事件类型映射的资源类型。 |
detail.findings[].Sample detail.findings[].SchemaVersion detail.findings[].Severity.Label detail.findings[].SourceUrl detail.findings[].Title |
sec_result.summary |
调查结果的标题。 |
detail.findings[].Types[] detail.findings[].UpdatedAt detail.findings[].Workflow.Status detail.findings[].WorkflowState detail-type |
metadata.product_event_type |
事件的详细类型。 |
id |
metadata.product_log_id |
活动的 ID。 |
region |
target.location.name |
活动的 AWS 区域。 |
resources[] source time version (解析器逻辑) |
metadata.event_timestamp |
原始日志条目中的创建时间,用作事件时间戳。 |
(解析器逻辑) | metadata.log_type |
设置为 AWS_SECURITY_HUB 。 |
(解析器逻辑) | metadata.product_name |
设置为 AWS Security Hub 。 |
(解析器逻辑) | metadata.vendor_name |
设置为 AMAZON 。 |
(解析器逻辑) | target.asset.attribute.cloud.environment |
设置为 AMAZON_WEB_SERVICES 。 |
(解析器逻辑) | metadata.event_type |
如果未从 Resources[].Type 或 configurationItemDiff.changeType 进行映射,则默认设置为 USER_RESOURCE_ACCESS 。如果存在 configurationItems 且未设置其他事件类型,则设置为 STATUS_UPDATE 。如果存在 configurationItem 或 configurationItems ,且状态为 OK 或 ResourceDiscovered ,则设置为 RESOURCE_READ 。如果存在 configurationItem 或 configurationItems 且状态为 ResourceDeleted ,则设置为 RESOURCE_DELETION 。 |
(解析器逻辑) | metadata.description |
如果存在 detail.findings[].ProductFields.aws/guardduty/service/serviceName ,则设置为 guardduty 。 |
(解析器逻辑) | target.asset.attribute.cloud.vpc.resource_type |
如果 configurationItems.relationships[].resourceId 与 vpc 匹配,则设置为 VPC_NETWORK 。 |
(解析器逻辑) | target.resource.resource_type |
如果存在 configurationItem 或 configurationItems ,则设置为 VIRTUAL_MACHINE 。如果没有设置其他资源类型,则设置为 UNSPECIFIED 。 |
(解析器逻辑) | target.asset.platform_software.platform |
根据 configurationItem 的消息中是否存在 Windows 或 (Linux|LINUX) ,将此属性设置为 WINDOWS 或 LINUX 。对于 configurationItems ,系统会根据 configItem.tags.OS 或 configItem.tags.Os 进行设置。 |
(解析器逻辑) | disambiguation_key |
当单个日志条目生成多个事件时添加。 |
需要更多帮助?从社区成员和 Google SecOps 专业人士那里获得解答。