implementing-aws-security-hub-compliance について
AWS OrganizationsでAWS Security Hubを運用するセキュリティチーム向けの導入ガイドです。複数アカウントの検出結果集約、コンプライアンス評価、カスタムインサイト、自動修復、レポート作成を扱います。
主な機能
- 01コンプライアンス基準の有効化
- 02複数アカウントの検出結果集約
- 03コンプライアンス統制の確認
- 04カスタムセキュリティインサイトの作成
- 05自動修復の設定
- 06検出結果のエクスポートとレポート作成
活用シーン
- 01複数のAWSアカウントのセキュリティ状態管理
- 02CIS、PCI DSS、NIST準拠の継続監視
- 03検出結果を起点とした修復の実行
- 04組織全体のコンプライアンス状況の報告
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ mukul975/ anthropic-cybersecurity-skills --skill implementing-aws-security-hub-complianceインストール後、Claude Code で/implementing-aws-security-hub-complianceを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
LICENSEreferences/api-reference.mdscripts/agent.py詳細
AWS Security Hub コンプライアンスの実装
使用するタイミング
- 複数の AWS アカウントにまたがって、セキュリティ態勢を一元管理する仕組みを構築するとき
- CIS、PCI DSS、NIST 800-53 の各標準に対して継続的な監視が求められるコンプライアンス要件があるとき
- GuardDuty、Inspector、Macie、Firewall Manager、およびサードパーティツールからの検出結果を集約するとき
- セキュリティ検出結果をトリガーとして、自動修復ワークフローを構築するとき
- 経営層が組織全体のセキュリティコンプライアンスダッシュボードを必要とするとき
使用しないこと: リアルタイムの脅威検出には (GuardDuty を使用)、脆弱性スキャンには (Inspector を使用)、データ分類には (Macie を使用)してください。Security Hub はこれらのサービスからの検出結果を集約しますが、それらを置き換えるものではありません。
前提条件
- Security Hub の委任管理者を設定した AWS Organizations
securityhub:*、config:*、events:*、lambda:*に対する IAM 権限- 対象となるすべてのアカウントとリージョンで AWS Config が有効になっていること (Security Hub の要件)
- マルチアカウントへのデプロイ用の CloudFormation StackSets または Terraform
- セキュリティチームへのアラート配信用に設定された SNS トピック
ワークフロー
ステップ 1: コンプライアンス標準を指定して Security Hub を有効化する
管理アカウントで Security Hub を有効にし、評価するコンプライアンス標準を選択します。
# Enable Security Hub in the current account/region
aws securityhub enable-security-hub \
--enable-default-standards \
--control-finding-generator SECURITY_CONTROL
# Enable specific compliance standards
aws securityhub batch-enable-standards --standards-subscription-requests \
'[
{"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/cis-aws-foundations-benchmark/v/1.4.0"},
{"StandardsArn": "arn:aws:securityhub:us-east-1::standards/pci-dss/v/3.2.1"},
{"StandardsArn": "arn:aws:securityhub:us-east-1::standards/nist-800-53/v/5.0.0"}
]'
# Verify enabled standards
aws securityhub get-enabled-standards \
--query 'StandardsSubscriptions[*].[StandardsArn,StandardsStatus]' --output table
ステップ 2: マルチアカウントの集約を設定する
委任管理者を設定し、組織内のすべてのアカウントから検出結果を集約します。
# Designate a delegated admin (run from management account)
aws securityhub enable-organization-admin-account \
--admin-account-id 111122223333
# From the delegated admin account, enable auto-enrollment
aws securityhub update-organization-configuration \
--auto-enable \
--auto-enable-standards DEFAULT
# Create a finding aggregator for cross-region aggregation
aws securityhub create-finding-aggregator \
--region-linking-mode ALL_REGIONS
# List member accounts
aws securityhub list-members \
--query 'Members[*].[AccountId,MemberStatus]' --output table
ステップ 3: コンプライアンススコアと失敗したコントロールを確認する
有効な標準全体にわたるコンプライアンス態勢を Security Hub に問い合わせ、失敗しているコントロールを特定します。
# Get overall compliance score for CIS benchmark
aws securityhub get-standards-control-associations \
--security-control-id "IAM.1" \
--query 'StandardsControlAssociationSummaries[*].[StandardsArn,AssociationStatus]' \
--output table
# List all failed controls
aws securityhub get-findings \
--filters '{
"ComplianceStatus": [{"Value": "FAILED", "Comparison": "EQUALS"}],
"RecordState": [{"Value": "ACTIVE", "Comparison": "EQUALS"}],
"WorkflowStatus": [{"Value": "NEW", "Comparison": "EQUALS"}]
}' \
--sort-criteria '{"Field": "SeverityNormalized", "SortOrder": "desc"}' \
--max-items 50 \
--query 'Findings[*].[Title,Severity.Label,Compliance.Status,Resources[0].Id]' \
--output table
# Get finding counts by severity
aws securityhub get-insight-results \
--insight-arn "arn:aws:securityhub:us-east-1:111122223333:insight/111122223333/default/2"
ステップ 4: カスタムのセキュリティインサイトを作成する
組織固有のセキュリティ上の優先事項を追跡するために、カスタムインサイトを構築します。
# Create insight for publicly accessible resources
aws securityhub create-insight \
--name "Publicly Accessible Resources" \
--filters '{
"ResourceType": [
{"Value": "AwsS3Bucket", "Comparison": "EQUALS"},
{"Value": "AwsEc2SecurityGroup", "Comparison": "EQUALS"},
{"Value": "AwsRdsDbInstance", "Comparison": "EQUALS"}
],
"ComplianceStatus": [{"Value": "FAILED", "Comparison": "EQUALS"}],
"SeverityLabel": [{"Value": "CRITICAL", "Comparison": "EQUALS"}, {"Value": "HIGH", "Comparison": "EQUALS"}]
}' \
--group-by-attribute "ResourceType"
# Create insight for unencrypted resources
aws securityhub create-insight \
--name "Unencrypted Resources Across Accounts" \
--filters '{
"Title": [{"Value": "encryption", "Comparison": "CONTAINS"}],
"ComplianceStatus": [{"Value": "FAILED", "Comparison": "EQUALS"}]
}' \
--group-by-attribute "AwsAccountId"
ステップ 5: EventBridge による自動修復を設定する
特定の検出結果タイプに対して Lambda ベースの自動修復をトリガーする EventBridge ルールを設定します。
# Create EventBridge rule for Security Hub findings
aws events put-rule \
--name "security-hub-critical-findings" \
--event-pattern '{
"source": ["aws.securityhub"],
"detail-type": ["Security Hub Findings - Imported"],
"detail": {
"findings": {
"Severity": {"Label": ["CRITICAL"]},
"Compliance": {"Status": ["FAILED"]},
"Workflow": {"Status": ["NEW"]}
}
}
}'
# Example Lambda auto-remediation for S3 public access (Python)
cat > /tmp/remediate_s3.py << 'PYEOF'
import boto3
import json
def lambda_handler(event, context):
s3 = boto3.client('s3')
securityhub = boto3.client('securityhub')
for finding in event['detail']['findings']:
if 'S3' in finding.get('Title', '') and 'public' in finding.get('Title', '').lower():
bucket_arn = finding['Resources'][0]['Id']
bucket_name = bucket_arn.split(':::')[-1]
s3.put_public_access_block(
Bucket=bucket_name,
PublicAccessBlockConfiguration={
'BlockPublicAcls': True,
'IgnorePublicAcls': True,
'BlockPublicPolicy': True,
'RestrictPublicBuckets': True
}
)
securityhub.batch_update_findings(
FindingIdentifiers=[{
'Id': finding['Id'],
'ProductArn': finding['ProductArn']
}],
Workflow={'Status': 'RESOLVED'},
Note={
'Text': 'Auto-remediated: Block Public Access enabled',
'UpdatedBy': 'security-hub-auto-remediation'
}
)
return {'statusCode': 200}
PYEOF
ステップ 6: 検出結果のエクスポートとコンプライアンスレポートの生成
レポート作成や外部の SIEM または GRC プラットフォームとの連携のために、Security Hub の検出結果をエクスポートします。
# Export all findings to S3 via a custom script
aws securityhub get-findings \
--filters '{
"RecordState": [{"Value": "ACTIVE", "Comparison": "EQUALS"}]
}' \
--max-items 1000 \
--output json > security-hub-findings-export.json
# Send critical findings to SNS
aws sns publish \
--topic-arn arn:aws:sns:us-east-1:111122223333:security-alerts \
--subject "Security Hub Daily Summary" \
--message file://daily-summary.json
# Integrate with third-party SIEM via EventBridge
aws events put-targets \
--rule security-hub-critical-findings \
--targets '[{
"Id": "splunk-hec",
"Arn": "arn:aws:events:us-east-1:111122223333:api-destination/splunk-hec",
"HttpParameters": {
"HeaderParameters": {"Authorization": "Splunk HEC_TOKEN"}
}
}]'
主要な概念
| 用語 | 定義 |
|---|---|
| Security Hub | AWS サービスおよびサードパーティツールからのセキュリティ検出結果を集約し、標準に照らしてコンプライアンスを評価して、統合されたセキュリティダッシュボードを提供する AWS サービス |
| Security Standard | Security Hub が AWS の構成に対して評価する、事前定義されたセキュリティコントロールのセット (CIS、PCI DSS、NIST 800-53 など) |
| Security Control | 標準内の個々のチェック項目で、S3 バケットがパブリックアクセスをブロックしているかどうかなど、特定の AWS リソース構成を評価する |
| Finding | Security Hub または連携サービスによって検出されたセキュリティ上の問題で、AWS Security Finding Format (ASFF) で表現される |
| Insight | 特定の属性による、カスタムまたは管理された検出結果のグループ化で、セキュリティ分析のための集計ビューを提供する |
| ASFF | AWS Security Finding Format。すべての Security Hub 連携で使用される、検出結果を一貫して表現するための標準化された JSON スキーマ |
ツールとシステム
- AWS Security Hub: AWS アカウント全体のセキュリティ検出結果を集約し、コンプライアンスを評価する中核プラットフォーム
- AWS Config: リソースのコンプライアンスを評価するために Security Hub が必要とする、構成記録サービス
- Amazon EventBridge: Security Hub の検出結果を Lambda、SNS、または外部の修復システムへルーティングするイベントバス
- AWS Lambda: Security Hub の検出結果によってトリガーされる自動修復関数のためのサーバーレスコンピューティング
- Prowler: ASFF 連携を通じて検出結果を Security Hub に送信できる、オープンソースのツール
一般的なシナリオ
シナリオ: 50 アカウントの組織への Security Hub の展開
背景: セキュリティチームは、AWS Organizations 内のすべてのアカウントで CIS および FSBP 標準を有効にした Security Hub を展開する必要があります。検出結果は一元的に集約し、自動アラートを設定します。
手順:
- 管理アカウントで Security Hub を有効にし、セキュリティアカウントを委任管理者に指定する
update-organization-configurationを使用して、既存のすべてのメンバーアカウントと新規メンバーアカウントで自動有効化を設定する- クロスリージョンの検出結果アグリゲーターを作成し、すべてのリージョンの検出結果を管理者アカウントに集約する
- すべてのアカウントで CIS AWS Foundations 1.4 および AWS FSBP 標準を有効にする
- EventBridge ルールを作成し、CRITICAL の検出結果は PagerDuty へ、すべての検出結果は Splunk へルーティングする
- 組織における主要なリスク(公開リソース、暗号化の欠如、未使用の認証情報)に対応するカスタムインサイトを構築する
- Lambda と SES を使用して、ステークホルダー向けの週次コンプライアンスレポートをスケジュール設定する
注意点: Security Hub を正しく機能させるには、すべてのアカウントとすべてのリージョンで AWS Config が有効になっている必要があります。Config を有効にしないと、コントロールは PASSED や FAILED ではなく「No data」と表示されます。Config が無効になっているメンバーアカウントは、コンプライアンススコアが不完全なまま、エラーなしで集計されてしまいます。
出力形式
AWS Security Hub Compliance Report
=====================================
Organization: acme-corp (50 accounts)
Region: us-east-1 (aggregated from all regions)
Report Date: 2026-02-23
Standards Enabled: CIS 1.4, FSBP v1.0, PCI DSS 3.2.1
COMPLIANCE SCORES:
CIS AWS Foundations 1.4: 78% (142/182 controls passing)
AWS FSBP v1.0.0: 85% (198/233 controls passing)
PCI DSS 3.2.1: 72% (89/124 controls passing)
CRITICAL FINDINGS: 23
HIGH FINDINGS: 87
MEDIUM FINDINGS: 245
LOW FINDINGS: 412
TOP FAILING CONTROLS:
[IAM.6] MFA not enabled for root account 12 accounts
[S3.2] S3 Block Public Access not enabled 8 accounts
[EC2.19] Security groups allow unrestricted access 15 accounts
[RDS.3] RDS encryption at rest not enabled 6 accounts
AUTO-REMEDIATION ACTIONS (Last 30 Days):
S3 Block Public Access enabled: 14
Security Group rules restricted: 8
CloudTrail logging re-enabled: 3
Total auto-remediated findings: 25