Deploys AWS Security Hub for centralized cloud security: aggregates findings from GuardDuty/Inspector/Macie/third-parties, enables CIS benchmarks, configures auto-remediation, builds multi-account compliance dashboards.
npx claudepluginhub killvxk/cybersecurity-skills-zhThis skill uses the workspace's default tool permissions.
- 在多个 AWS 账户之间建立集中式安全发现结果仪表盘时
Implements AWS Security Hub for aggregating security findings across AWS accounts, enables CIS/PCI DSS compliance standards, configures EventBridge/Lambda auto-remediation, and creates custom organizational risk insights.
Deploys AWS Security Hub for aggregating findings from GuardDuty, Inspector, Macie; enables CIS benchmarks, automated remediation, and compliance dashboards across multi-account AWS organizations.
Deploys AWS Security Hub to aggregate security findings from GuardDuty, Inspector, Macie across multi-account organizations. Enables CIS benchmarks, automated remediation, and compliance dashboards.
Share bugs, ideas, or general feedback.
不适用于:实时威胁检测(参见 detecting-cloud-threats-with-guardduty)、Azure 合规监控(参见 securing-azure-with-microsoft-defender),或对容器镜像进行深度漏洞扫描(参见 securing-container-registry)。
securityhub:* 和 config:* IAM 权限在委派管理员账户中激活 Security Hub 并启用安全标准。AWS Security Hub CSPM(云安全态势管理)支持 CIS AWS Foundations Benchmark v5.0、AWS 基础安全最佳实践(FSBP)、PCI DSS v3.2.1 和 NIST SP 800-53。
# 启用 Security Hub 并加载默认标准
aws securityhub enable-security-hub \
--enable-default-standards \
--tags '{"Environment":"production","ManagedBy":"security-team"}'
# 启用 CIS AWS Foundations Benchmark v5.0
aws securityhub batch-enable-standards \
--standards-subscription-requests '[
{"StandardsArn": "arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/5.0.0"},
{"StandardsArn": "arn:aws:securityhub:us-east-1::standards/aws-foundational-security-best-practices/v/1.0.0"},
{"StandardsArn": "arn:aws:securityhub:us-east-1::standards/pci-dss/v/3.2.1"}
]'
# 验证已启用的标准
aws securityhub get-enabled-standards \
--query 'StandardsSubscriptions[*].[StandardsArn,StandardsStatus]' --output table
指定 Security Hub 管理员并自动注册所有组织成员账户。配置跨区域聚合,将发现结果整合到单一区域。
# 指定委派管理员
aws securityhub enable-organization-admin-account \
--admin-account-id 111122223333
# 为所有组织成员自动启用
aws securityhub update-organization-configuration \
--auto-enable \
--organization-configuration '{"ConfigurationType": "CENTRAL"}'
# 启用跨区域聚合
aws securityhub create-finding-aggregator \
--region-linking-mode ALL_REGIONS
配置产品集成,接收来自 AWS 服务和合作伙伴安全工具的发现结果。将第三方发现结果映射到 AWS Security Finding Format(ASFF)。
# 列出可用的产品集成
aws securityhub describe-products \
--query 'Products[*].[ProductName,CompanyName,ProductSubscriptionResourcePolicy]' --output table
# 启用特定集成
aws securityhub enable-import-findings-for-product \
--product-arn "arn:aws:securityhub:us-east-1::product/aws/guardduty"
aws securityhub enable-import-findings-for-product \
--product-arn "arn:aws:securityhub:us-east-1::product/aws/inspector"
# 使用 ASFF 格式导入自定义发现结果
aws securityhub batch-import-findings --findings '[{
"SchemaVersion": "2018-10-08",
"Id": "custom-finding-001",
"ProductArn": "arn:aws:securityhub:us-east-1:123456789012:product/123456789012/default",
"GeneratorId": "custom-scanner",
"AwsAccountId": "123456789012",
"Types": ["Software and Configuration Checks/Vulnerabilities/CVE"],
"Title": "生产 ALB 后端存在未修补的 OpenSSL 漏洞",
"Description": "后端实例检测到 CVE-2024-12345",
"Severity": {"Label": "HIGH"},
"Resources": [{"Type": "AwsEc2Instance", "Id": "arn:aws:ec2:us-east-1:123456789012:instance/i-0abc123"}]
}]'
创建与 EventBridge 规则和 Lambda 函数关联的 Security Hub 自定义操作,实现对常见发现结果的一键式或全自动修复。
# 创建修复自定义操作
aws securityhub create-action-target \
--name "IsolateInstance" \
--description "通过替换安全组隔离 EC2 实例" \
--id "IsolateInstance"
# 针对特定控制项自动修复的 EventBridge 规则
aws events put-rule \
--name SecurityHubAutoRemediate \
--event-pattern '{
"source": ["aws.securityhub"],
"detail-type": ["Security Hub Findings - Imported"],
"detail": {
"findings": {
"Compliance": {"Status": ["FAILED"]},
"Severity": {"Label": ["CRITICAL", "HIGH"]},
"GeneratorId": ["aws-foundational-security-best-practices/v/1.0.0/S3.1"]
}
}
}'
跟踪各标准的安全评分,监控合规漂移趋势,并生成用于审计证据的报告。
# 获取某个标准的安全评分
aws securityhub get-security-control-definition \
--security-control-id "S3.1"
# 列出所有失败控制项及其数量
aws securityhub get-findings \
--filters '{
"ComplianceStatus": [{"Value": "FAILED", "Comparison": "EQUALS"}],
"RecordState": [{"Value": "ACTIVE", "Comparison": "EQUALS"}]
}' \
--sort-criteria '{"Field": "SeverityLabel", "SortOrder": "desc"}' \
--max-items 50
| 术语 | 定义 |
|---|---|
| 安全标准(Security Standard) | 映射到 CIS、PCI-DSS、NIST 800-53 和 AWS 最佳实践等合规框架的预打包控制集 |
| 安全控制(Security Control) | 针对特定安全要求评估 AWS 资源配置的单个自动化检查项 |
| ASFF | AWS Security Finding Format,用于规范化所有集成安全产品发现结果的标准化 JSON 模式 |
| 合规评分(Compliance Score) | 给定安全标准中处于通过状态的控制项百分比,按账户计算并在组织层面聚合 |
| 发现结果聚合器(Finding Aggregator) | 将所有已启用区域的发现结果整合到单一管理员区域的跨区域机制 |
| 自定义操作(Custom Action) | 可从 Security Hub 控制台触发的用户定义操作,用于调用 EventBridge 规则进行手动或自动响应 |
场景背景:一家企业启用 CIS AWS Foundations Benchmark v5.0 后,在 50 个账户中发现 340 个失败的控制项,主要集中在 IAM 密码策略、CloudTrail 配置和 VPC 流日志启用方面。
方法:
常见陷阱:一次性为所有控制项启用自动修复可能会破坏合法需要公开 S3 访问或特定网络配置的生产工作负载。务必先在预发布账户中测试修复操作。
AWS Security Hub 合规报告
====================================
组织: acme-corp
管理员账户: 111122223333
报告日期: 2025-02-23
已启用标准: CIS v5.0, AWS FSBP v1.0, PCI DSS v3.2.1
合规评分:
CIS AWS Foundations Benchmark v5.0: 78%
AWS 基础安全最佳实践: 85%
PCI DSS v3.2.1: 72%
失败控制项 TOP 排行(按账户数量):
[S3.1] 已启用阻止公开访问设置 - 50 个账户中 23 个失败
[CT.1] 已启用 CloudTrail 多区域 - 50 个账户中 12 个失败
[IAM.4] Root 账户无访问密钥 - 50 个账户中 3 个失败
[EC2.19] 安全组限制未受限端口 - 50 个账户中 31 个失败
[RDS.3] 已启用 RDS 静态加密 - 50 个账户中 18 个失败
发现结果摘要:
活跃发现结果总计: 1,247
严重: 34 | 高: 189 | 中: 567 | 低: 457
本月自动修复: 89
已抑制: 23