Doc AWS SDK Examples GitHub リポジトリには、他にも SDK の例があります。 AWS
翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
を使用した Security Hub の例 AWS CLI
次のコード例は、Security Hub AWS Command Line Interface で を使用してアクションを実行し、一般的なシナリオを実装する方法を示しています。
アクションはより大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。アクションは個々のサービス機能を呼び出す方法を示していますが、コンテキスト内のアクションは、関連するシナリオで確認できます。
各例には、完全なソースコードへのリンクが含まれており、そこからコンテキストにおけるコードの設定方法と実行方法についての手順を確認できます。
トピック
アクション
次のコード例は、accept-administrator-invitation
を使用する方法を示しています。
- AWS CLI
-
管理者アカウントからの招待を受け入れるには
次の
accept-administrator-invitation
の例では、指定された管理者アカウントからの指定された招待を受け入れます。aws securityhub accept-invitation \ --administrator-id
123456789012
\ --invitation-id7ab938c5d52d7904ad09f9e7c20cc4eb
このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「管理者アカウントおよびメンバーアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「AcceptAdministratorInvitation
」を参照してください。
-
次のコード例は、accept-invitation
を使用する方法を示しています。
- AWS CLI
-
管理者アカウントからの招待を受け入れるには
次の
accept-invitation
の例では、指定された管理者アカウントからの指定された招待を受け入れます。aws securityhub accept-invitation \ --master-id
123456789012
\ --invitation-id7ab938c5d52d7904ad09f9e7c20cc4eb
このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「管理者アカウントおよびメンバーアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「AcceptInvitation
」を参照してください。
-
次の例は、batch-delete-automation-rules
を使用する方法を説明しています。
- AWS CLI
-
自動化ルールを削除するには
次の
batch-delete-automation-rules
の例は、指定された自動化ルールを削除します。1 つのコマンドで 1 つ以上のルールを削除できます。Security Hub 管理者アカウントのみ、このコマンドを実行できます。aws securityhub batch-delete-automation-rules \ --automation-rules-arns '
["arn:aws:securityhub:us-east-1:123456789012:automation-rule/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"]
'出力:
{ "ProcessedAutomationRules": [ "arn:aws:securityhub:us-east-1:123456789012:automation-rule/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" ], "UnprocessedAutomationRules": [] }
詳細については、「AWS Security Hub ユーザーガイド」の「自動化ルールの削除」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「BatchDeleteAutomationRules
」を参照してください。
-
次の例は、batch-disable-standards
を使用する方法を説明しています。
- AWS CLI
-
標準を無効にするには
次の
batch-disable-standards
の例では、指定されたサブスクリプション ARN に関連付けられた標準を無効にします。aws securityhub batch-disable-standards \ --standards-subscription-arns
"arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1"
出力:
{ "StandardsSubscriptions": [ { "StandardsArn": "arn:aws:securityhub:eu-central-1::standards/pci-dss/v/3.2.1", "StandardsInput": { }, "StandardsStatus": "DELETING", "StandardsSubscriptionArn": "arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1" } ] }
詳細については、「AWS Security Hub ユーザーガイド」の「セキュリティ標準の無効化または有効化」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「BatchDisableStandards
」を参照してください。
-
次の例は、batch-enable-standards
を使用する方法を説明しています。
- AWS CLI
-
標準を有効にするには
次の
batch-enable-standards
の例では、リクエスト元のアカウントの PCI DSS 標準を有効にします。aws securityhub batch-enable-standards \ --standards-subscription-requests '
{"StandardsArn":"arn:aws:securityhub:us-west-1::standards/pci-dss/v/3.2.1"}
'出力:
{ "StandardsSubscriptions": [ { "StandardsArn": "arn:aws:securityhub:us-west-1::standards/pci-dss/v/3.2.1", "StandardsInput": { }, "StandardsStatus": "PENDING", "StandardsSubscriptionArn": "arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1" } ] }
詳細については、「AWS Security Hub ユーザーガイド」の「セキュリティ標準の無効化または有効化」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「BatchEnableStandards
」を参照してください。
-
次の例は、batch-get-automation-rules
を使用する方法を説明しています。
- AWS CLI
-
自動化ルールの詳細を取得するには
次の
batch-get-automation-rules
の例は、指定された自動化ルールの詳細情報を取得します。1 つのコマンドで 1 つ以上の自動化ルールの詳細情報を取得できます。aws securityhub batch-get-automation-rules \ --automation-rules-arns '
["arn:aws:securityhub:us-east-1:123456789012:automation-rule/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"]
'出力:
{ "Rules": [ { "RuleArn": "arn:aws:securityhub:us-east-1:123456789012:automation-rule/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "RuleStatus": "ENABLED", "RuleOrder": 1, "RuleName": "Suppress informational findings", "Description": "Suppress GuardDuty findings with Informational severity", "IsTerminal": false, "Criteria": { "ProductName": [ { "Value": "GuardDuty", "Comparison": "EQUALS" } ], "SeverityLabel": [ { "Value": "INFORMATIONAL", "Comparison": "EQUALS" } ], "WorkflowStatus": [ { "Value": "NEW", "Comparison": "EQUALS" } ], "RecordState": [ { "Value": "ACTIVE", "Comparison": "EQUALS" } ] }, "Actions": [ { "Type": "FINDING_FIELDS_UPDATE", "FindingFieldsUpdate": { "Note": { "Text": "Automatically suppress GuardDuty findings with Informational severity", "UpdatedBy": "sechub-automation" }, "Workflow": { "Status": "SUPPRESSED" } } } ], "CreatedAt": "2023-05-31T17:56:14.837000+00:00", "UpdatedAt": "2023-05-31T17:59:38.466000+00:00", "CreatedBy": "arn:aws:iam::123456789012:role/Admin" } ], "UnprocessedAutomationRules": [] }
詳細については、「AWS Security Hub ユーザーガイド」の「自動化ルールを表示する」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「BatchGetAutomationRules
」を参照してください。
-
次の例は、batch-get-configuration-policy-associations
を使用する方法を説明しています。
- AWS CLI
-
ターゲットのバッチの設定の関連付けに関する詳細を取得するには
次の
batch-get-configuration-policy-associations
の例では、指定されたターゲットの関連付けに関する詳細情報を取得します。ターゲットのアカウント ID、組織単位 ID、またはルート ID を指定できます。aws securityhub batch-get-configuration-policy-associations \ --target '
{"OrganizationalUnitId": "ou-6hi7-8j91kl2m"}
'出力:
{ "ConfigurationPolicyId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "TargetId": "ou-6hi7-8j91kl2m", "TargetType": "ORGANIZATIONAL_UNIT", "AssociationType": "APPLIED", "UpdatedAt": "2023-09-26T21:13:01.816000+00:00", "AssociationStatus": "SUCCESS", "AssociationStatusMessage": "Association applied successfully on this target." }
詳細については、「AWS Security Hub ユーザーガイド」の「設定ポリシーのステータスと詳細の表示」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「BatchGetConfigurationPolicyAssociations
」を参照してください。
-
次の例は、batch-get-security-controls
を使用する方法を説明しています。
- AWS CLI
-
セキュリティコントロールの詳細を取得するには
次の の
batch-get-security-controls
例では、現在の AWS アカウントと AWS リージョンのセキュリティコントロール ACM.1 と IAM.1 の詳細を取得します。aws securityhub batch-get-security-controls \ --security-control-ids '
["ACM.1", "IAM.1"]
'出力:
{ "SecurityControls": [ { "SecurityControlId": "ACM.1", "SecurityControlArn": "arn:aws:securityhub:us-east-2:123456789012:security-control/ACM.1", "Title": "Imported and ACM-issued certificates should be renewed after a specified time period", "Description": "This control checks whether an AWS Certificate Manager (ACM) certificate is renewed within the specified time period. It checks both imported certificates and certificates provided by ACM. The control fails if the certificate isn't renewed within the specified time period. Unless you provide a custom parameter value for the renewal period, Security Hub uses a default value of 30 days.", "RemediationUrl": "https://docs.aws.amazon.com/console/securityhub/ACM.1/remediation", "SeverityRating": "MEDIUM", "SecurityControlStatus": "ENABLED" "UpdateStatus": "READY", "Parameters": { "daysToExpiration": { "ValueType": CUSTOM, "Value": { "Integer": 15 } } }, "LastUpdateReason": "Updated control parameter" }, { "SecurityControlId": "IAM.1", "SecurityControlArn": "arn:aws:securityhub:us-east-2:123456789012:security-control/IAM.1", "Title": "IAM policies should not allow full \"*\" administrative privileges", "Description": "This AWS control checks whether the default version of AWS Identity and Access Management (IAM) policies (also known as customer managed policies) do not have administrator access with a statement that has \"Effect\": \"Allow\" with \"Action\": \"*\" over \"Resource\": \"*\". It only checks for the Customer Managed Policies that you created, but not inline and AWS Managed Policies.", "RemediationUrl": "https://docs.aws.amazon.com/console/securityhub/IAM.1/remediation", "SeverityRating": "HIGH", "SecurityControlStatus": "ENABLED" "UpdateStatus": "READY", "Parameters": {} } ] }
詳細については、「AWS Security Hub ユーザーガイド」の「コントロールの詳細の表示」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「BatchGetSecurityControls
」を参照してください。
-
次のコード例は、batch-get-standards-control-associations
を使用する方法を示しています。
- AWS CLI
-
コントロールの有効化ステータスを取得するには
次の
batch-get-standards-control-associations
の例では、指定されたコントロールが指定された標準で有効になっているかどうかを示します。aws securityhub batch-get-standards-control-associations \ --standards-control-association-ids '
[{"SecurityControlId": "Config.1","StandardsArn": "arn:aws:securityhub:us-east-1:123456789012:ruleset/cis-aws-foundations-benchmark/v/1.2.0"}, {"SecurityControlId": "IAM.6","StandardsArn": "arn:aws:securityhub:us-east-1:123456789012:standards/aws-foundational-security-best-practices/v/1.0.0"}]
'出力:
{ "StandardsControlAssociationDetails": [ { "StandardsArn": "arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0", "SecurityControlId": "Config.1", "SecurityControlArn": "arn:aws:securityhub:us-east-1:068873283051:security-control/Config.1", "AssociationStatus": "ENABLED", "RelatedRequirements": [ "CIS AWS Foundations 2.5" ], "UpdatedAt": "2022-10-27T16:07:12.960000+00:00", "StandardsControlTitle": "Ensure AWS Config is enabled", "StandardsControlDescription": "AWS Config is a web service that performs configuration management of supported AWS resources within your account and delivers log files to you. The recorded information includes the configuration item (AWS resource), relationships between configuration items (AWS resources), and any configuration changes between resources. It is recommended to enable AWS Config in all regions.", "StandardsControlArns": [ "arn:aws:securityhub:us-east-1:068873283051:control/cis-aws-foundations-benchmark/v/1.2.0/2.5" ] }, { "StandardsArn": "arn:aws:securityhub:us-east-1::standards/aws-foundational-security-best-practices/v/1.0.0", "SecurityControlId": "IAM.6", "SecurityControlArn": "arn:aws:securityhub:us-east-1:068873283051:security-control/IAM.6", "AssociationStatus": "DISABLED", "RelatedRequirements": [], "UpdatedAt": "2022-11-22T21:30:35.080000+00:00", "UpdatedReason": "test", "StandardsControlTitle": "Hardware MFA should be enabled for the root user", "StandardsControlDescription": "This AWS control checks whether your AWS account is enabled to use a hardware multi-factor authentication (MFA) device to sign in with root user credentials.", "StandardsControlArns": [ "arn:aws:securityhub:us-east-1:068873283051:control/aws-foundational-security-best-practices/v/1.0.0/IAM.6" ] } ] }
詳細については、「AWS Security Hub ユーザーガイド」の「特定の標準のコントロールを有効にする」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「BatchGetStandardsControlAssociations
」を参照してください。
-
次の例は、batch-import-findings
を使用する方法を説明しています。
- AWS CLI
-
検出結果を更新するには
次の
batch-import-findings
の例では、検出結果を更新します。aws securityhub batch-import-findings \ --findings '
[{ "AwsAccountId": "123456789012", "CreatedAt": "2020-05-27T17:05:54.832Z", "Description": "Vulnerability in a CloudTrail trail", "FindingProviderFields": { "Severity": { "Label": "LOW", "Original": "10" }, "Types": [ "Software and Configuration Checks/Vulnerabilities/CVE" ] }, "GeneratorId": "TestGeneratorId", "Id": "Id1", "ProductArn": "arn:aws:securityhub:us-west-1:123456789012:product/123456789012/default", "Resources": [ { "Id": "arn:aws:cloudtrail:us-west-1:123456789012:trail/TrailName", "Partition": "aws", "Region": "us-west-1", "Type": "AwsCloudTrailTrail" } ], "SchemaVersion": "2018-10-08", "Title": "CloudTrail trail vulnerability", "UpdatedAt": "2020-06-02T16:05:54.832Z" }]
'出力:
{ "FailedCount": 0, "SuccessCount": 1, "FailedFindings": [] }
詳細については、「AWS Security Hub ユーザーガイド」の「BatchImportFindings を使用して結果を作成および更新する」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「BatchImportFindings
」を参照してください。
-
次の例は、batch-update-automation-rules
を使用する方法を説明しています。
- AWS CLI
-
自動化ルールを更新するには
次の
batch-update-automation-rules
の例では、指定された自動化ルールを更新します。1 つのコマンドで 1 つ以上のルールを更新できます。Security Hub 管理者アカウントのみ、このコマンドを実行できます。aws securityhub batch-update-automation-rules \ --update-automation-rules-request-items '
[ \ { \ "Actions": [{ \ "Type": "FINDING_FIELDS_UPDATE", \ "FindingFieldsUpdate": { \ "Note": { \ "Text": "Known issue that is a risk", \ "UpdatedBy": "sechub-automation" \ }, \ "Workflow": { \ "Status": "NEW" \ } \ } \ }], \ "Criteria": { \ "SeverityLabel": [{ \ "Value": "LOW", \ "Comparison": "EQUALS" \ }] \ }, \ "RuleArn": "arn:aws:securityhub:us-east-1:123456789012:automation-rule/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", \ "RuleOrder": 1, \ "RuleStatus": "DISABLED" \ } \ ]
'出力:
{ "ProcessedAutomationRules": [ "arn:aws:securityhub:us-east-1:123456789012:automation-rule/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" ], "UnprocessedAutomationRules": [] }
詳細については、「AWS Security Hub ユーザーガイド」の「自動化ルールの編集」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「BatchUpdateAutomationRules
」を参照してください。
-
次のコード例は、batch-update-findings
を使用する方法を示しています。
- AWS CLI
-
例 1: 検出結果を更新するには
以下の
batch-update-findings
の例では、2 つの検出結果を更新して、メモを追加し、重要度ラベルを変更してから、それらを解決します。aws securityhub batch-update-findings \ --finding-identifiers '
[{"Id": "arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1/PCI.Lambda.2/finding/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "ProductArn": "arn:aws:securityhub:us-west-1::product/aws/securityhub"}, {"Id": "arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1/PCI.Lambda.2/finding/a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "ProductArn": "arn:aws:securityhub:us-west-1::product/aws/securityhub"}]
' \ --note '{"Text": "Known issue that is not a risk.", "UpdatedBy": "user1"}
' \ --severity '{"Label": "LOW"}
' \ --workflow '{"Status": "RESOLVED"}
'出力:
{ "ProcessedFindings": [ { "Id": "arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1/PCI.Lambda.2/finding/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "ProductArn": "arn:aws:securityhub:us-west-1::product/aws/securityhub" }, { "Id": "arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1/PCI.Lambda.2/finding/a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "ProductArn": "arn:aws:securityhub:us-west-1::product/aws/securityhub" } ], "UnprocessedFindings": [] }
詳細については、「AWS Security Hub ユーザーガイド」の「BatchUpdateFindings を使用して結果を更新する」を参照してください。
例 2: 省略構文を使用して検出結果を更新するには
以下の
batch-update-findings
の例では、省略構文を使用して 2 つの検出結果を更新し、メモを追加して、重要度ラベルを変更してから、それらを解決します。aws securityhub batch-update-findings \ --finding-identifiers Id="arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1/PCI.Lambda.2/finding/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",ProductArn="arn:aws:securityhub:us-west-1::product/aws/securityhub" Id="arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1/PCI.Lambda.2/finding/a1b2c3d4-5678-90ab-cdef-EXAMPLE22222",ProductArn="arn:aws:securityhub:us-west-1::product/aws/securityhub" \ --note Text="Known issue that is not a risk.",UpdatedBy="user1" \ --severity Label="LOW" \ --workflow Status="RESOLVED"
出力:
{ "ProcessedFindings": [ { "Id": "arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1/PCI.Lambda.2/finding/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "ProductArn": "arn:aws:securityhub:us-west-1::product/aws/securityhub" }, { "Id": "arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1/PCI.Lambda.2/finding/a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "ProductArn": "arn:aws:securityhub:us-west-1::product/aws/securityhub" } ], "UnprocessedFindings": [] }
詳細については、「AWS Security Hub ユーザーガイド」の「BatchUpdateFindings を使用して結果を更新する」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「BatchUpdateFindings
」を参照してください。
-
次の例は、batch-update-standards-control-associations
を使用する方法を説明しています。
- AWS CLI
-
有効な標準でコントロールの有効化ステータスを更新するには
次の
batch-update-standards-control-associations
の例では、指定された標準で CloudTrail.1 を無効にします。aws securityhub batch-update-standards-control-associations \ --standards-control-association-updates '
[{"SecurityControlId": "CloudTrail.1", "StandardsArn": "arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0", "AssociationStatus": "DISABLED", "UpdatedReason": "Not applicable to environment"}, {"SecurityControlId": "CloudTrail.1", "StandardsArn": "arn:aws:securityhub:::standards/cis-aws-foundations-benchmark/v/1.4.0", "AssociationStatus": "DISABLED", "UpdatedReason": "Not applicable to environment"}]
'このコマンドが成功した場合、出力は生成されません。
詳細については、「AWS Security Hub ユーザーガイド」の「特定の標準コントロールの有効化と無効化」と「すべての標準におけるコントロールの有効化と無効化」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「BatchUpdateStandardsControlAssociations
」を参照してください。
-
次のコード例は、create-action-target
を使用する方法を示しています。
- AWS CLI
-
カスタムアクションを作成するには
次の
create-action-target
の例では、カスタムアクションを作成します。アクションの名前、説明、識別子を指定します。aws securityhub create-action-target \ --name
"Send to remediation"
\ --description"Action to send the finding for remediation tracking"
\ --id"Remediation"
出力:
{ "ActionTargetArn": "arn:aws:securityhub:us-west-1:123456789012:action/custom/Remediation" }
詳細については、「AWS Security Hub ユーザーガイド」の「カスタムアクションを作成し、CloudWatch Events ルールに関連付ける」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「CreateActionTarget
」を参照してください。
-
次のコード例は、create-automation-rule
を使用する方法を示しています。
- AWS CLI
-
自動化ルールを作成するには
次の の
create-automation-rule
例では、現在の AWS アカウントと AWS リージョンに自動化ルールを作成します。Security Hub は、指定された基準に基づいて検出結果をフィルタリングし、一致する検出結果にアクションを適用します。Security Hub 管理者アカウントのみ、このコマンドを実行できます。aws securityhub create-automation-rule \ --actions '
[{ \ "Type": "FINDING_FIELDS_UPDATE", \ "FindingFieldsUpdate": { \ "Severity": { \ "Label": "HIGH" \ }, \ "Note": { \ "Text": "Known issue that is a risk. Updated by automation rules", \ "UpdatedBy": "sechub-automation" \ } \ } \ }]
' \ --criteria '{ \ "SeverityLabel": [{ \ "Value": "INFORMATIONAL", \ "Comparison": "EQUALS" \ }] \ }
' \ --description"A sample rule"
\ --no-is-terminal \ --rule-name"sample rule"
\ --rule-order1
\ --rule-status"ENABLED"
出力:
{ "RuleArn": "arn:aws:securityhub:us-east-1:123456789012:automation-rule/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" }
詳細については、「AWS Security Hub ユーザーガイド」の「自動化ルールの作成」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「CreateAutomationRule
」を参照してください。
-
次の例は、create-configuration-policy
を使用する方法を説明しています。
- AWS CLI
-
設定ポリシーを作成するには
次の
create-configuration-policy
の例では、指定された設定で設定ポリシーを作成します。aws securityhub create-configuration-policy \ --name
"SampleConfigurationPolicy"
\ --description"SampleDescription"
\ --configuration-policy '{"SecurityHub": {"ServiceEnabled": true, "EnabledStandardIdentifiers": ["arn:aws:securityhub:eu-central-1::standards/aws-foundational-security-best-practices/v/1.0.0","arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0"],"SecurityControlsConfiguration":{"DisabledSecurityControlIdentifiers": ["CloudTrail.2"], "SecurityControlCustomParameters": [{"SecurityControlId": "ACM.1", "Parameters": {"daysToExpiration": {"ValueType": "CUSTOM", "Value": {"Integer": 15}}}}]}}}
' \ --tags '{"Environment": "Prod"}
'出力:
{ "Arn": "arn:aws:securityhub:eu-central-1:123456789012:configuration-policy/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "Id": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "Name": "SampleConfigurationPolicy", "Description": "SampleDescription", "UpdatedAt": "2023-11-28T20:28:04.494000+00:00", "CreatedAt": "2023-11-28T20:28:04.494000+00:00", "ConfigurationPolicy": { "SecurityHub": { "ServiceEnabled": true, "EnabledStandardIdentifiers": [ "arn:aws:securityhub:eu-central-1::standards/aws-foundational-security-best-practices/v/1.0.0", "arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0" ], "SecurityControlsConfiguration": { "DisabledSecurityControlIdentifiers": [ "CloudTrail.2" ], "SecurityControlCustomParameters": [ { "SecurityControlId": "ACM.1", "Parameters": { "daysToExpiration": { "ValueType": "CUSTOM", "Value": { "Integer": 15 } } } } ] } } } }
詳細については、「AWS Security Hub ユーザーガイド」の「Security Hub 設定ポリシーの作成と関連付け」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「CreateConfigurationPolicy
」を参照してください。
-
次のコード例は、create-finding-aggregator
を使用する方法を示しています。
- AWS CLI
-
結果の集約を有効にするには
次の
create-finding-aggregator
の例では、検出結果の集約を設定します。これは、米国東部 (バージニア) を集約リージョンとして指定する米国東部 (バージニア) から実行されます。指定されたリージョンのみをリンクし、新しいリージョンを自動的にリンクしないことを示します。リンクされたリージョンとして、米国西部 (北カリフォルニア) と米国西部 (オレゴン) が選択されます。aws securityhub create-finding-aggregator \ --region
us-east-1
\ --region-linking-modeSPECIFIED_REGIONS
\ --regionsus-west-1,us-west-2
出力:
{ "FindingAggregatorArn": "arn:aws:securityhub:us-east-1:222222222222:finding-aggregator/123e4567-e89b-12d3-a456-426652340000", "FindingAggregationRegion": "us-east-1", "RegionLinkingMode": "SPECIFIED_REGIONS", "Regions": "us-west-1,us-west-2" }
詳細については、「AWS Security Hub ユーザーガイド」の「結果の集約を有効にする」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「CreateFindingAggregator
」を参照してください。
-
次のコード例は、create-insight
を使用する方法を示しています。
- AWS CLI
-
カスタムインサイトを作成するには
次の の
create-insight
例では、 ロールに関連する重要な検出結果を返す「重要な AWS ロールの検出結果」という名前のカスタムインサイトを作成します。aws securityhub create-insight \ --filters '
{"ResourceType": [{ "Comparison": "EQUALS", "Value": "AwsIamRole"}], "SeverityLabel": [{"Comparison": "EQUALS", "Value": "CRITICAL"}]}
' \ --group-by-attribute"ResourceId"
\ --name"Critical role findings"
出力:
{ "InsightArn": "arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" }
詳細については、「AWS Security Hub ユーザーガイド」の「カスタムインサイトの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「CreateInsight
」を参照してください。
-
次の例は、create-members
を使用する方法を説明しています。
- AWS CLI
-
アカウントをメンバーアカウントとして追加するには
次の
create-members
の例では、リクエスト元の管理者アカウントに 2 つのアカウントをメンバーアカウントとして追加します。aws securityhub create-members \ --account-details '
[{"AccountId": "123456789111"}, {"AccountId": "123456789222"}]
'出力:
{ "UnprocessedAccounts": [] }
詳細については、「AWS Security Hub ユーザーガイド」の「管理者アカウントおよびメンバーアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「CreateMembers
」を参照してください。
-
次の例は、decline-invitations
を使用する方法を説明しています。
- AWS CLI
-
メンバーアカウントへの招待を拒否するには
次の
decline-invitations
の例では、指定された管理者アカウントのメンバーアカウントへの招待を拒否します。メンバーアカウントはリクエスト元のアカウントです。aws securityhub decline-invitations \ --account-ids
"123456789012"
出力:
{ "UnprocessedAccounts": [] }
詳細については、「AWS Security Hub ユーザーガイド」の「管理者アカウントおよびメンバーアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DeclineInvitations
」を参照してください。
-
次の例は、delete-action-target
を使用する方法を説明しています。
- AWS CLI
-
カスタムアクションを削除するには
次の
delete-action-target
の例では、指定された ARN によって識別されたカスタムアクションを削除します。aws securityhub delete-action-target \ --action-target-arn
"arn:aws:securityhub:us-west-1:123456789012:action/custom/Remediation"
出力:
{ "ActionTargetArn": "arn:aws:securityhub:us-west-1:123456789012:action/custom/Remediation" }
詳細については、「AWS Security Hub ユーザーガイド」の「カスタムアクションを作成し、CloudWatch Events ルールに関連付ける」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DeleteActionTarget
」を参照してください。
-
次のコード例は、delete-configuration-policy
を使用する方法を示しています。
- AWS CLI
-
設定ポリシーを削除するには
次の
delete-configuration-policy
の例では、指定された設定ポリシーを削除します。aws securityhub delete-configuration-policy \ --identifier
"arn:aws:securityhub:eu-central-1:123456789012:configuration-policy/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"
このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「Security Hub 設定ポリシーの削除と関連付けの解除」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DeleteConfigurationPolicy
」を参照してください。
-
次の例は、delete-finding-aggregator
を使用する方法を説明しています。
- AWS CLI
-
結果の集約を停止するには
次の
delete-finding-aggregator
の例では、検索結果の集約を停止します。コマンドは、現在の集約リージョンである米国東部 (バージニア) から実行されます。aws securityhub delete-finding-aggregator \ --region
us-east-1
\ --finding-aggregator-arnarn:aws:securityhub:us-east-1:222222222222:finding-aggregator/123e4567-e89b-12d3-a456-426652340000
このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「結果の集約を停止する」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DeleteFindingAggregator
」を参照してください。
-
次のコード例は、delete-insight
を使用する方法を示しています。
- AWS CLI
-
カスタムインサイトを削除するには
次の
delete-insight
の例では、指定された ARN を持つカスタムインサイトを削除します。aws securityhub delete-insight \ --insight-arn
"arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"
出力:
{ "InsightArn": "arn:aws:securityhub:eu-central-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" }
詳細については、「AWS Security Hub ユーザーガイド」の「カスタムインサイトの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DeleteInsight
」を参照してください。
-
次の例は、delete-invitations
を使用する方法を説明しています。
- AWS CLI
-
メンバーアカウントへの招待を削除するには
次の
delete-invitations
の例では、指定された管理者アカウントのメンバーアカウントへの招待を削除します。メンバーアカウントはリクエスト元のアカウントです。aws securityhub delete-invitations \ --account-ids
"123456789012"
出力:
{ "UnprocessedAccounts": [] }
詳細については、「AWS Security Hub ユーザーガイド」の「管理者アカウントおよびメンバーアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DeleteInvitations
」を参照してください。
-
次のコード例は、delete-members
を使用する方法を示しています。
- AWS CLI
-
メンバーアカウントを削除するには
次の
delete-members
の例では、リクエスト元の管理者アカウントから指定されたメンバーアカウントを削除します。aws securityhub delete-members \ --account-ids
"123456789111"
"123456789222"
出力:
{ "UnprocessedAccounts": [] }
詳細については、「AWS Security Hub ユーザーガイド」の「管理者アカウントおよびメンバーアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DeleteMembers
」を参照してください。
-
次の例は、describe-action-targets
を使用する方法を説明しています。
- AWS CLI
-
カスタムアクションの詳細情報を取得するには
次の
describe-action-targets
の例では、指定された ARN によって識別されるカスタムアクションに関する情報を取得します。aws securityhub describe-action-targets \ --action-target-arns
"arn:aws:securityhub:us-west-1:123456789012:action/custom/Remediation"
出力:
{ "ActionTargets": [ { "ActionTargetArn": "arn:aws:securityhub:us-west-1:123456789012:action/custom/Remediation", "Description": "Action to send the finding for remediation tracking", "Name": "Send to remediation" } ] }
詳細については、「AWS Security Hub ユーザーガイド」の「カスタムアクションを作成し、CloudWatch Events ルールに関連付ける」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DescribeActionTargets
」を参照してください。
-
次の例は、describe-hub
を使用する方法を説明しています。
- AWS CLI
-
ハブリソースに関する情報を取得するには
次の
describe-hub
の例では、指定されたハブリソースのサブスクリプション日を返します。ハブリソースは ARN によって識別されます。aws securityhub describe-hub \ --hub-arn
"arn:aws:securityhub:us-west-1:123456789012:hub/default"
出力:
{ "HubArn": "arn:aws:securityhub:us-west-1:123456789012:hub/default", "SubscribedAt": "2019-11-19T23:15:10.046Z" }
詳細については、「AWS CloudFormation ユーザーガイド」の「AWS::SecurityHub::Hub」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DescribeHub
」を参照してください。
-
次のコード例は、describe-organization-configuration
を使用する方法を示しています。
- AWS CLI
-
組織の Security Hub の設定方法を表示するには
次の
describe-organization-configuration
の例では、Security Hub で組織を設定する方法に関する情報を返します。この例では、組織は中央設定を使用します。Security Hub 管理者アカウントのみ、このコマンドを実行できます。aws securityhub describe-organization-configuration
出力:
{ "AutoEnable": false, "MemberAccountLimitReached": false, "AutoEnableStandards": "NONE", "OrganizationConfiguration": { "ConfigurationType": "LOCAL", "Status": "ENABLED", "StatusMessage": "Central configuration has been enabled successfully" } }
詳細については、AWS 「 Security Hub ユーザーガイド」のAWS 「Organizations によるアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DescribeOrganizationConfiguration
」を参照してください。
-
次のコード例は、describe-products
を使用する方法を示しています。
- AWS CLI
-
使用可能な製品統合に関する情報を返すには
次の
describe-products
の例では、使用可能な製品統合を一度に 1 つずつ返します。aws securityhub describe-products \ --max-results
1
出力:
{ "NextToken": "U2FsdGVkX18vvPlOqb7RDrWRWVFBJI46MOIAb+nZmRJmR15NoRi2gm13sdQEn3O/pq/78dGs+bKpgA+7HMPHO0qX33/zoRI+uIG/F9yLNhcOrOWzFUdy36JcXLQji3Rpnn/cD1SVkGA98qI3zPOSDg==", "Products": [ { "ProductArn": "arn:aws:securityhub:us-west-1:123456789333:product/crowdstrike/crowdstrike-falcon", "ProductName": "CrowdStrike Falcon", "CompanyName": "CrowdStrike", "Description": "CrowdStrike Falcon's single lightweight sensor unifies next-gen antivirus, endpoint detection and response, and 24/7 managed hunting, via the cloud.", "Categories": [ "Endpoint Detection and Response (EDR)", "AV Scanning and Sandboxing", "Threat Intelligence Feeds and Reports", "Endpoint Forensics", "Network Forensics" ], "IntegrationTypes": [ "SEND_FINDINGS_TO_SECURITY_HUB" ], "MarketplaceUrl": "https://aws.amazon.com/marketplace/seller-profile?id=a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "ActivationUrl": "https://falcon.crowdstrike.com/support/documentation", "ProductSubscriptionResourcePolicy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"123456789333\"},\"Action\":[\"securityhub:BatchImportFindings\"],\"Resource\":\"arn:aws:securityhub:us-west-1:123456789012:product-subscription/crowdstrike/crowdstrike-falcon\",\"Condition\":{\"StringEquals\":{\"securityhub:TargetAccount\":\"123456789012\"}}},{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"123456789012\"},\"Action\":[\"securityhub:BatchImportFindings\"],\"Resource\":\"arn:aws:securityhub:us-west-1:123456789333:product/crowdstrike/crowdstrike-falcon\",\"Condition\":{\"StringEquals\":{\"securityhub:TargetAccount\":\"123456789012\"}}}]}" } ] }
詳細については、「AWS Security Hub ユーザーガイド」の「製品統合の管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DescribeProducts
」を参照してください。
-
次の例は、describe-standards-controls
を使用する方法を説明しています。
- AWS CLI
-
有効な標準のコントロールの一覧をリクエストするには
次の
describe-standards-controls
の例では、リクエスタアカウントの PCI DSS 標準へのサブスクリプション内のコントロール一覧をリクエストします。リクエストは、一度に 2 つのコントロールを返します。aws securityhub describe-standards-controls \ --standards-subscription-arn
"arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1"
\ --max-results2
出力:
{ "Controls": [ { "StandardsControlArn": "arn:aws:securityhub:us-west-1:123456789012:control/pci-dss/v/3.2.1/PCI.AutoScaling.1", "ControlStatus": "ENABLED", "ControlStatusUpdatedAt": "2020-05-15T18:49:04.473000+00:00", "ControlId": "PCI.AutoScaling.1", "Title": "Auto scaling groups associated with a load balancer should use health checks", "Description": "This AWS control checks whether your Auto Scaling groups that are associated with a load balancer are using Elastic Load Balancing health checks.", "RemediationUrl": "https://docs.aws.amazon.com/console/securityhub/PCI.AutoScaling.1/remediation", "SeverityRating": "LOW", "RelatedRequirements": [ "PCI DSS 2.2" ] }, { "StandardsControlArn": "arn:aws:securityhub:us-west-1:123456789012:control/pci-dss/v/3.2.1/PCI.CW.1", "ControlStatus": "ENABLED", "ControlStatusUpdatedAt": "2020-05-15T18:49:04.498000+00:00", "ControlId": "PCI.CW.1", "Title": "A log metric filter and alarm should exist for usage of the \"root\" user", "Description": "This control checks for the CloudWatch metric filters using the following pattern { $.userIdentity.type = \"Root\" && $.userIdentity.invokedBy NOT EXISTS && $.eventType != \"AwsServiceEvent\" } It checks that the log group name is configured for use with active multi-region CloudTrail, that there is at least one Event Selector for a Trail with IncludeManagementEvents set to true and ReadWriteType set to All, and that there is at least one active subscriber to an SNS topic associated with the alarm.", "RemediationUrl": "https://docs.aws.amazon.com/console/securityhub/PCI.CW.1/remediation", "SeverityRating": "MEDIUM", "RelatedRequirements": [ "PCI DSS 7.2.1" ] } ], "NextToken": "U2FsdGVkX1+eNkPoZHVl11ip5HUYQPWSWZGmftcmJiHL8JoKEsCDuaKayiPDyLK+LiTkShveoOdvfxXCkOBaGhohIXhsIedN+LSjQV/l7kfCfJcq4PziNC1N9xe9aq2pjlLVZnznTfSImrodT5bRNHe4fELCQq/z+5ka+5Lzmc11axcwTd5lKgQyQqmUVoeriHZhyIiBgWKf7oNYdBVG8OEortVWvSkoUTt+B2ThcnC7l43kI0UNxlkZ6sc64AsW" }
この標準の詳細については、「AWS Security Hub ユーザーガイド」の「コントロールの詳細の表示」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DescribeStandardsControls
」を参照してください。
-
次の例は、describe-standards
を使用する方法を説明しています。
- AWS CLI
-
使用可能な標準のリストを返すには
次の
describe-standards
の例では、使用可能な標準のリストを返します。aws securityhub describe-standards
出力:
{ "Standards": [ { "StandardsArn": "arn:aws:securityhub:us-west-1::standards/aws-foundational-security-best-practices/v/1.0.0", "Name": "AWS Foundational Security Best Practices v1.0.0", "Description": "The AWS Foundational Security Best Practices standard is a set of automated security checks that detect when AWS accounts and deployed resources do not align to security best practices. The standard is defined by AWS security experts. This curated set of controls helps improve your security posture in AWS, and cover AWS's most popular and foundational services.", "EnabledByDefault": true }, { "StandardsArn": "arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0", "Name": "CIS AWS Foundations Benchmark v1.2.0", "Description": "The Center for Internet Security (CIS) AWS Foundations Benchmark v1.2.0 is a set of security configuration best practices for AWS. This Security Hub standard automatically checks for your compliance readiness against a subset of CIS requirements.", "EnabledByDefault": true }, { "StandardsArn": "arn:aws:securityhub:us-west-1::standards/pci-dss/v/3.2.1", "Name": "PCI DSS v3.2.1", "Description": "The Payment Card Industry Data Security Standard (PCI DSS) v3.2.1 is an information security standard for entities that store, process, and/or transmit cardholder data. This Security Hub standard automatically checks for your compliance readiness against a subset of PCI DSS requirements.", "EnabledByDefault": false } ] }
詳細については、「 Security Hub ユーザーガイド」の「 AWS Security Hub のセキュリティ標準」を参照してください。 AWS
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DescribeStandards
」を参照してください。
-
次のコード例は、disable-import-findings-for-product
を使用する方法を示しています。
- AWS CLI
-
製品統合からの検出結果の受信を停止するには
次の
disable-import-findings-for-product
の例では、製品統合への指定されたサブスクリプションの検出結果の流れを無効にします。aws securityhub disable-import-findings-for-product \ --product-subscription-arn
"arn:aws:securityhub:us-west-1:123456789012:product-subscription/crowdstrike/crowdstrike-falcon"
このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「製品統合の管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DisableImportFindingsForProduct
」を参照してください。
-
次の例は、disable-organization-admin-account
を使用する方法を説明しています。
- AWS CLI
-
Security Hub 管理者アカウントを削除するには
次の の
disable-organization-admin-account
例では、指定されたアカウントの AWS Organizations の Security Hub 管理者アカウントとしての割り当てを取り消します。aws securityhub disable-organization-admin-account \ --admin-account-id
777788889999
このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「Security Hub 管理者アカウントの指定」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DisableOrganizationAdminAccount
」を参照してください。
-
次のコード例は、disable-security-hub
を使用する方法を示しています。
- AWS CLI
-
AWS Security Hub を無効にするには
次の の
disable-security-hub
例では、リクエスト元のアカウントの AWS Security Hub を無効にします。aws securityhub disable-security-hub
このコマンドでは何も出力されません。
詳細については、AWS 「 Security Hub ユーザーガイド」の「Security Hub の無効化」を参照してください。 AWS
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DisableSecurityHub
」を参照してください。
-
次の例は、disassociate-from-administrator-account
を使用する方法を説明しています。
- AWS CLI
-
管理者アカウントから関連付けを解除するには
次の
disassociate-from-administrator-account
の例では、リクエスト元のアカウントと現在の管理者アカウントの関連付けを解除します。aws securityhub disassociate-from-administrator-account
このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「管理者アカウントおよびメンバーアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DisassociateFromAdministratorAccount
」を参照してください。
-
次のコード例は、disassociate-from-master-account
を使用する方法を示しています。
- AWS CLI
-
管理者アカウントから関連付けを解除するには
次の
disassociate-from-master-account
の例では、リクエスト元のアカウントと現在の管理者アカウントの関連付けを解除します。aws securityhub disassociate-from-master-account
このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「管理者アカウントおよびメンバーアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DisassociateFromMasterAccount
」を参照してください。
-
次の例は、disassociate-members
を使用する方法を説明しています。
- AWS CLI
-
メンバーアカウントの関連付けを解除するには
次の
disassociate-members
の例では、リクエスト元の管理者アカウントから指定されたメンバーアカウントの関連付けを解除します。aws securityhub disassociate-members \ --account-ids
"123456789111"
"123456789222"
このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「管理者アカウントおよびメンバーアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DisassociateMembers
」を参照してください。
-
次のコード例は、enable-import-findings-for-product
を使用する方法を示しています。
- AWS CLI
-
製品統合からの検出結果の受け取りを開始するには
次の
enable-import-findings-for-product
の例では、指定された製品統合からの検出結果の流れを有効にします。aws securityhub enable-import-findings-for-product \ --product-arn
"arn:aws:securityhub:us-east-1:123456789333:product/crowdstrike/crowdstrike-falcon"
出力:
{ "ProductSubscriptionArn": "arn:aws:securityhub:us-east-1:123456789012:product-subscription/crowdstrike/crowdstrike-falcon" }
詳細については、「AWS Security Hub ユーザーガイド」の「製品統合の管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「EnableImportFindingsForProduct
」を参照してください。
-
次の例は、enable-organization-admin-account
を使用する方法を説明しています。
- AWS CLI
-
組織アカウントを Security Hub 管理者アカウントとして指定するには
次の
enable-organization-admin-account
の例では、指定されたアカウントを Security Hub 管理者アカウントとして指定します。aws securityhub enable-organization-admin-account \ --admin-account-id
777788889999
このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「Security Hub 管理者アカウントの指定」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「EnableOrganizationAdminAccount
」を参照してください。
-
次の例は、enable-security-hub
を使用する方法を説明しています。
- AWS CLI
-
AWS Security Hub を有効にするには
次の の
enable-security-hub
例では、リクエスト元のアカウントの AWS Security Hub を有効にします。デフォルトの標準が有効になるように Security Hub を設定します。ハブリソースの場合、タグDepartment
に値Security
を割り当てます。aws securityhub enable-security-hub \ --enable-default-standards \ --tags '
{"Department": "Security"}
'このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「Security Hub を有効にする」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「EnableSecurityHub
」を参照してください。
-
次の例は、get-administrator-account
を使用する方法を説明しています。
- AWS CLI
-
管理者アカウントに関する情報を取得するには
次の
get-administrator-account
の例では、リクエスト元アカウントの管理者アカウントに関する情報を取得します。aws securityhub get-administrator-account
出力:
{ "Master": { "AccountId": "123456789012", "InvitationId": "7ab938c5d52d7904ad09f9e7c20cc4eb", "InvitedAt": 2020-06-01T20:21:18.042000+00:00, "MemberStatus": "ASSOCIATED" } }
詳細については、「AWS Security Hub ユーザーガイド」の「管理者アカウントおよびメンバーアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「GetAdministratorAccount
」を参照してください。
-
次のコード例は、get-configuration-policy-association
を使用する方法を示しています。
- AWS CLI
-
ターゲットの設定関連付けの詳細を取得するには
次の
get-configuration-policy-association
の例では、指定されたターゲットの関連付けに関する詳細情報を取得します。ターゲットのアカウント ID、組織単位 ID、またはルート ID を指定できます。aws securityhub get-configuration-policy-association \ --target '
{"OrganizationalUnitId": "ou-6hi7-8j91kl2m"}
'出力:
{ "ConfigurationPolicyId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "TargetId": "ou-6hi7-8j91kl2m", "TargetType": "ORGANIZATIONAL_UNIT", "AssociationType": "APPLIED", "UpdatedAt": "2023-09-26T21:13:01.816000+00:00", "AssociationStatus": "SUCCESS", "AssociationStatusMessage": "Association applied successfully on this target." }
詳細については、「AWS Security Hub ユーザーガイド」の「設定ポリシーのステータスと詳細の表示」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「GetConfigurationPolicyAssociation
」を参照してください。
-
次のコード例は、get-configuration-policy
を使用する方法を示しています。
- AWS CLI
-
設定ポリシーの詳細を表示するには
次の
get-configuration-policy
の例では、指定された設定ポリシーの詳細情報を取得します。aws securityhub get-configuration-policy \ --identifier
"arn:aws:securityhub:eu-central-1:123456789012:configuration-policy/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"
出力:
{ "Arn": "arn:aws:securityhub:eu-central-1:123456789012:configuration-policy/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "Id": "ce5ed1e7-9639-4e2f-9313-fa87fcef944b", "Name": "SampleConfigurationPolicy", "Description": "SampleDescription", "UpdatedAt": "2023-11-28T20:28:04.494000+00:00", "CreatedAt": "2023-11-28T20:28:04.494000+00:00", "ConfigurationPolicy": { "SecurityHub": { "ServiceEnabled": true, "EnabledStandardIdentifiers": [ "arn:aws:securityhub:eu-central-1::standards/aws-foundational-security-best-practices/v/1.0.0", "arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0" ], "SecurityControlsConfiguration": { "DisabledSecurityControlIdentifiers": [ "CloudTrail.2" ], "SecurityControlCustomParameters": [ { "SecurityControlId": "ACM.1", "Parameters": { "daysToExpiration": { "ValueType": "CUSTOM", "Value": { "Integer": 15 } } } } ] } } } }
詳細については、「AWS Security Hub ユーザーガイド」の「設定ポリシーのステータスと詳細の表示」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「GetConfigurationPolicy
」を参照してください。
-
次の例は、get-enabled-standards
を使用する方法を説明しています。
- AWS CLI
-
有効な標準に関する情報を取得するには
次の
get-enabled-standards
の例では、PCI DSS 標準に関する情報を取得します。aws securityhub get-enabled-standards \ --standards-subscription-arn
"arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1"
出力:
{ "StandardsSubscriptions": [ { "StandardsArn": "arn:aws:securityhub:us-west-1::standards/pci-dss/v/3.2.1", "StandardsInput": { }, "StandardsStatus": "READY", "StandardsSubscriptionArn": "arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1" } ] }
詳細については、「 Security Hub ユーザーガイド」の「 AWS Security Hub のセキュリティ標準」を参照してください。 AWS
-
API の詳細については、「AWS CLI コマンドリファレンス」の「GetEnabledStandards
」を参照してください。
-
次のコード例は、get-finding-aggregator
を使用する方法を示しています。
- AWS CLI
-
現在の検索結果の集約設定を取得するには
次の
get-finding-aggregator
の例では、現在の検出結果の集約設定を取得します。aws securityhub get-finding-aggregator \ --finding-aggregator-arn
arn:aws:securityhub:us-east-1:222222222222:finding-aggregator/123e4567-e89b-12d3-a456-426652340000
出力:
{ "FindingAggregatorArn": "arn:aws:securityhub:us-east-1:222222222222:finding-aggregator/123e4567-e89b-12d3-a456-426652340000", "FindingAggregationRegion": "us-east-1", "RegionLinkingMode": "SPECIFIED_REGIONS", "Regions": "us-west-1,us-west-2" }
詳細については、「AWS Security Hub ユーザーガイド」の「現在の結果の集約設定を表示する」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「GetFindingAggregator
」を参照してください。
-
次の例は、get-finding-history
を使用する方法を説明しています。
- AWS CLI
-
検出結果の履歴を取得するには
次の
get-finding-history
の例では、指定された検出結果の過去 90 日間の履歴を取得します。この例では、結果は検出結果履歴の 2 つのレコードに制限されています。aws securityhub get-finding-history \ --finding-identifier Id="arn:aws:securityhub:us-east-1:123456789012:security-control/S3.17/finding/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",ProductArn="arn:aws:securityhub:us-east-1::product/aws/securityhub"
出力:
{ "Records": [ { "FindingIdentifier": { "Id": "arn:aws:securityhub:us-east-1:123456789012:security-control/S3.17/finding/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "ProductArn": "arn:aws:securityhub:us-east-1::product/aws/securityhub" }, "UpdateTime": "2023-06-02T03:15:25.685000+00:00", "FindingCreated": false, "UpdateSource": { "Type": "BATCH_IMPORT_FINDINGS", "Identity": "arn:aws:securityhub:us-east-1::product/aws/securityhub" }, "Updates": [ { "UpdatedField": "Compliance.RelatedRequirements", "OldValue": "[\"NIST.800-53.r5 SC-12(2)\",\"NIST.800-53.r5 SC-12(3)\",\"NIST.800-53.r5 SC-12(6)\",\"NIST.800-53.r5 CM-3(6)\",\"NIST.800-53.r5 SC-13\",\"NIST.800-53.r5 SC-28\",\"NIST.800-53.r5 SC-28(1)\",\"NIST.800-53.r5 SC-7(10)\"]", "NewValue": "[\"NIST.800-53.r5 SC-12(2)\",\"NIST.800-53.r5 CM-3(6)\",\"NIST.800-53.r5 SC-13\",\"NIST.800-53.r5 SC-28\",\"NIST.800-53.r5 SC-28(1)\",\"NIST.800-53.r5 SC-7(10)\",\"NIST.800-53.r5 CA-9(1)\",\"NIST.800-53.r5 SI-7(6)\",\"NIST.800-53.r5 AU-9\"]" }, { "UpdatedField": "LastObservedAt", "OldValue": "2023-06-01T09:15:38.587Z", "NewValue": "2023-06-02T03:15:22.946Z" }, { "UpdatedField": "UpdatedAt", "OldValue": "2023-06-01T09:15:31.049Z", "NewValue": "2023-06-02T03:15:14.861Z" }, { "UpdatedField": "ProcessedAt", "OldValue": "2023-06-01T09:15:41.058Z", "NewValue": "2023-06-02T03:15:25.685Z" } ] }, { "FindingIdentifier": { "Id": "arn:aws:securityhub:us-east-1:123456789012:security-control/S3.17/finding/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "ProductArn": "arn:aws:securityhub:us-east-1::product/aws/securityhub" }, "UpdateTime": "2023-05-23T02:06:51.518000+00:00", "FindingCreated": "true", "UpdateSource": { "Type": "BATCH_IMPORT_FINDINGS", "Identity": "arn:aws:securityhub:us-east-1::product/aws/securityhub" }, "Updates": [] } ] }
詳細については、「AWS Security Hub ユーザーガイド」の「検出結果の履歴」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「GetFindingHistory
」を参照してください。
-
次の例は、get-findings
を使用する方法を説明しています。
- AWS CLI
-
例 1: 特定の標準に対して生成された検出結果を返すには
次の
get-findings
の例では、PCI DSS 標準の検出結果を返します。aws securityhub get-findings \ --filters '
{"GeneratorId":[{"Value": "pci-dss","Comparison":"PREFIX"}]}
' \ --max-items1
出力:
{ "Findings": [ { "SchemaVersion": "2018-10-08", "Id": "arn:aws:securityhub:eu-central-1:123456789012:subscription/pci-dss/v/3.2.1/PCI.Lambda.2/finding/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "ProductArn": "arn:aws:securityhub:us-west-1::product/aws/securityhub", "GeneratorId": "pci-dss/v/3.2.1/PCI.Lambda.2", "AwsAccountId": "123456789012", "Types": [ "Software and Configuration Checks/Industry and Regulatory Standards/PCI-DSS" ], "FindingProviderFields": { "Severity": { "Original": 0, "Label": "INFORMATIONAL" }, "Types": [ "Software and Configuration Checks/Industry and Regulatory Standards/PCI-DSS" ] }, "FirstObservedAt": "2020-06-02T14:02:49.159Z", "LastObservedAt": "2020-06-02T14:02:52.397Z", "CreatedAt": "2020-06-02T14:02:49.159Z", "UpdatedAt": "2020-06-02T14:02:52.397Z", "Severity": { "Original": 0, "Label": "INFORMATIONAL", "Normalized": 0 }, "Title": "PCI.Lambda.2 Lambda functions should be in a VPC", "Description": "This AWS control checks whether a Lambda function is in a VPC.", "Remediation": { "Recommendation": { "Text": "For directions on how to fix this issue, please consult the AWS Security Hub PCI DSS documentation.", "Url": "https://docs.aws.amazon.com/console/securityhub/PCI.Lambda.2/remediation" } }, "ProductFields": { "StandardsArn": "arn:aws:securityhub:::standards/pci-dss/v/3.2.1", "StandardsSubscriptionArn": "arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1", "ControlId": "PCI.Lambda.2", "RecommendationUrl": "https://docs.aws.amazon.com/console/securityhub/PCI.Lambda.2/remediation", "RelatedAWSResources:0/name": "securityhub-lambda-inside-vpc-0e904a3b", "RelatedAWSResources:0/type": "AWS::Config::ConfigRule", "StandardsControlArn": "arn:aws:securityhub:us-west-1:123456789012:control/pci-dss/v/3.2.1/PCI.Lambda.2", "aws/securityhub/SeverityLabel": "INFORMATIONAL", "aws/securityhub/ProductName": "Security Hub", "aws/securityhub/CompanyName": "AWS", "aws/securityhub/FindingId": "arn:aws:securityhub:eu-central-1::product/aws/securityhub/arn:aws:securityhub:eu-central-1:123456789012:subscription/pci-dss/v/3.2.1/PCI.Lambda.2/finding/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" }, "Resources": [ { "Type": "AwsAccount", "Id": "AWS::::Account:123456789012", "Partition": "aws", "Region": "us-west-1" } ], "Compliance": { "Status": "PASSED", "RelatedRequirements": [ "PCI DSS 1.2.1", "PCI DSS 1.3.1", "PCI DSS 1.3.2", "PCI DSS 1.3.4" ] }, "WorkflowState": "NEW", "Workflow": { "Status": "NEW" }, "RecordState": "ARCHIVED" } ], "NextToken": "eyJOZXh0VG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAxfQ==" }
例 2: ワークフローステータスが NOTIFIED である重大な検出結果を返すには
次の
get-findings
の例では、重要度ラベル値が CRITICAL で、ワークフローステータスが NOTIFIED の結果を返します。結果は、信頼度の値で降順でソートされます。aws securityhub get-findings \ --filters '
{"SeverityLabel":[{"Value": "CRITICAL","Comparison":"EQUALS"}],"WorkflowStatus": [{"Value":"NOTIFIED","Comparison":"EQUALS"}]}
' \ --sort-criteria '{ "Field": "Confidence", "SortOrder": "desc"}
' \ --max-items1
出力:
{ "Findings": [ { "SchemaVersion": "2018-10-08", "Id": "arn:aws:securityhub:us-west-1: 123456789012:subscription/cis-aws-foundations-benchmark/v/1.2.0/1.13/finding/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "ProductArn": "arn:aws:securityhub:us-west-2::product/aws/securityhub", "GeneratorId": "arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0/rule/1.13", "AwsAccountId": "123456789012", "Types": [ "Software and Configuration Checks/Industry and Regulatory Standards/CIS AWS Foundations Benchmark" ], "FindingProviderFields" { "Severity": { "Original": 90, "Label": "CRITICAL" }, "Types": [ "Software and Configuration Checks/Industry and Regulatory Standards/CIS AWS Foundations Benchmark" ] }, "FirstObservedAt": "2020-05-21T20:16:34.752Z", "LastObservedAt": "2020-06-09T08:16:37.171Z", "CreatedAt": "2020-05-21T20:16:34.752Z", "UpdatedAt": "2020-06-09T08:16:36.430Z", "Severity": { "Original": 90, "Label": "CRITICAL", "Normalized": 90 }, "Title": "1.13 Ensure MFA is enabled for the \"root\" account", "Description": "The root account is the most privileged user in an AWS account. MFA adds an extra layer of protection on top of a user name and password. With MFA enabled, when a user signs in to an AWS website, they will be prompted for their user name and password as well as for an authentication code from their AWS MFA device.", "Remediation": { "Recommendation": { "Text": "For directions on how to fix this issue, please consult the AWS Security Hub CIS documentation.", "Url": "https://docs.aws.amazon.com/console/securityhub/standards-cis-1.13/remediation" } }, "ProductFields": { "StandardsGuideArn": "arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0", "StandardsGuideSubscriptionArn": "arn:aws:securityhub:us-west-1:123456789012:subscription/cis-aws-foundations-benchmark/v/1.2.0", "RuleId": "1.13", "RecommendationUrl": "https://docs.aws.amazon.com/console/securityhub/standards-cis-1.13/remediation", "RelatedAWSResources:0/name": "securityhub-root-account-mfa-enabled-5pftha", "RelatedAWSResources:0/type": "AWS::Config::ConfigRule", "StandardsControlArn": "arn:aws:securityhub:us-west-1:123456789012:control/cis-aws-foundations-benchmark/v/1.2.0/1.13", "aws/securityhub/SeverityLabel": "CRITICAL", "aws/securityhub/ProductName": "Security Hub", "aws/securityhub/CompanyName": "AWS", "aws/securityhub/FindingId": "arn:aws:securityhub:us-west-1::product/aws/securityhub/arn:aws:securityhub:us-west-1:123456789012:subscription/cis-aws-foundations-benchmark/v/1.2.0/1.13/finding/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" }, "Resources": [ { "Type": "AwsAccount", "Id": "AWS::::Account:123456789012", "Partition": "aws", "Region": "us-west-1" } ], "Compliance": { "Status": "FAILED" }, "WorkflowState": "NEW", "Workflow": { "Status": "NOTIFIED" }, "RecordState": "ACTIVE" } ] }
詳細については、「AWS Security Hub ユーザーガイド」の「検出結果のフィルタリングとグループ化」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「GetFindings
」を参照してください。
-
次の例は、get-insight-results
を使用する方法を説明しています。
- AWS CLI
-
インサイトの結果を取得するには
次の
get-insight-results
の例では、指定された ARN を持つインサイトのインサイト結果のリストを返します。aws securityhub get-insight-results \ --insight-arn
"arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"
出力:
{ "InsightResults": { "GroupByAttribute": "ResourceId", "InsightArn": "arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "ResultValues": [ { "Count": 10, "GroupByAttributeValue": "AWS::::Account:123456789111" }, { "Count": 3, "GroupByAttributeValue": "AWS::::Account:123456789222" } ] } }
詳細については、「AWS Security Hub ユーザーガイド」の「インサイト結果と結果の表示とアクションの実行」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「GetInsightResults
」を参照してください。
-
次のコード例は、get-insights
を使用する方法を示しています。
- AWS CLI
-
インサイトの詳細を取得するには
次の
get-insights
の例では、指定された ARN を使用してインサイトの設定の詳細情報を取得します。aws securityhub get-insights \ --insight-arns
"arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"
出力:
{ "Insights": [ { "Filters": { "ResourceType": [ { "Comparison": "EQUALS", "Value": "AwsIamRole" } ], "SeverityLabel": [ { "Comparison": "EQUALS", "Value": "CRITICAL" } ], }, "GroupByAttribute": "ResourceId", "InsightArn": "arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "Name": "Critical role findings" } ] }
詳細については、AWS 「 Security Hub ユーザーガイド」の「Security Hub のインサイト」を参照してください。 AWS
-
API の詳細については、「AWS CLI コマンドリファレンス」の「GetInsights
」を参照してください。
-
次の例は、get-invitations-count
を使用する方法を説明しています。
- AWS CLI
-
受け入れられなかった招待の数を取得するには
次の
get-invitations-count
の例では、リクエスト元のアカウントが拒否したか応答しなかった招待の数を取得します。aws securityhub get-invitations-count
出力:
{ "InvitationsCount": 3 }
詳細については、「AWS Security Hub ユーザーガイド」の「管理者アカウントおよびメンバーアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「GetInvitationsCount
」を参照してください。
-
次の例は、get-master-account
を使用する方法を説明しています。
- AWS CLI
-
管理者アカウントに関する情報を取得するには
次の
get-master-account
の例では、リクエスト元アカウントの管理者アカウントに関する情報を取得します。aws securityhub get-master-account
出力:
{ "Master": { "AccountId": "123456789012", "InvitationId": "7ab938c5d52d7904ad09f9e7c20cc4eb", "InvitedAt": 2020-06-01T20:21:18.042000+00:00, "MemberStatus": "ASSOCIATED" } }
詳細については、「AWS Security Hub ユーザーガイド」の「管理者アカウントおよびメンバーアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「GetMasterAccount
」を参照してください。
-
次のコード例は、get-members
を使用する方法を示しています。
- AWS CLI
-
選択したメンバーアカウントに関する情報を取得するには
次の
get-members
の例では、選択したメンバーアカウントに関する情報を取得します。aws securityhub get-members \ --account-ids
"444455556666"
"777788889999"
出力:
{ "Members": [ { "AccountId": "123456789111", "AdministratorId": "123456789012", "InvitedAt": 2020-06-01T20:15:15.289000+00:00, "MasterId": "123456789012", "MemberStatus": "ASSOCIATED", "UpdatedAt": 2020-06-01T20:15:15.289000+00:00 }, { "AccountId": "123456789222", "AdministratorId": "123456789012", "InvitedAt": 2020-06-01T20:15:15.289000+00:00, "MasterId": "123456789012", "MemberStatus": "ASSOCIATED", "UpdatedAt": 2020-06-01T20:15:15.289000+00:00 } ], "UnprocessedAccounts": [ ] }
詳細については、「AWS Security Hub ユーザーガイド」の「管理者アカウントおよびメンバーアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「GetMembers
」を参照してください。
-
次のコード例は、get-security-control-definition
を使用する方法を示しています。
- AWS CLI
-
セキュリティコントロール定義の詳細を取得するには
次の
get-security-control-definition
の例では、Security Hub セキュリティコントロールの定義の詳細情報を取得します。詳細には、コントロールタイトル、説明、利用可能なリージョン、パラメータ、その他の情報が含まれます。aws securityhub get-security-control-definition \ --security-control-id
ACM.1
出力:
{ "SecurityControlDefinition": { "SecurityControlId": "ACM.1", "Title": "Imported and ACM-issued certificates should be renewed after a specified time period", "Description": "This control checks whether an AWS Certificate Manager (ACM) certificate is renewed within the specified time period. It checks both imported certificates and certificates provided by ACM. The control fails if the certificate isn't renewed within the specified time period. Unless you provide a custom parameter value for the renewal period, Security Hub uses a default value of 30 days.", "RemediationUrl": "https://docs.aws.amazon.com/console/securityhub/ACM.1/remediation", "SeverityRating": "MEDIUM", "CurrentRegionAvailability": "AVAILABLE", "ParameterDefinitions": { "daysToExpiration": { "Description": "Number of days within which the ACM certificate must be renewed", "ConfigurationOptions": { "Integer": { "DefaultValue": 30, "Min": 14, "Max": 365 } } } } } }
詳細については、「AWS Security Hub ユーザーガイド」の「カスタムコントロールパラメータ」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「GetSecurityControlDefinition
」を参照してください。
-
次のコード例は、invite-members
を使用する方法を示しています。
- AWS CLI
-
メンバーアカウントに招待を送信するには
次の
invite-members
の例では、指定されたメンバーアカウントに招待を送信します。aws securityhub invite-members \ --account-ids
"123456789111"
"123456789222"
出力:
{ "UnprocessedAccounts": [] }
詳細については、「AWS Security Hub ユーザーガイド」の「管理者アカウントおよびメンバーアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「InviteMembers
」を参照してください。
-
次のコード例は、list-automation-rules
を使用する方法を示しています。
- AWS CLI
-
オートメーションルールのリストを表示するには
次の の
list-automation-rules
例では、 AWS アカウントの自動化ルールを一覧表示します。Security Hub 管理者アカウントのみ、このコマンドを実行できます。aws securityhub list-automation-rules \ --max-results
3
\ --next-tokenNULL
出力:
{ "AutomationRulesMetadata": [ { "RuleArn": "arn:aws:securityhub:us-east-1:123456789012:automation-rule/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "RuleStatus": "ENABLED", "RuleOrder": 1, "RuleName": "Suppress informational findings", "Description": "Suppress GuardDuty findings with Informational severity", "IsTerminal": false, "CreatedAt": "2023-05-31T17:56:14.837000+00:00", "UpdatedAt": "2023-05-31T17:59:38.466000+00:00", "CreatedBy": "arn:aws:iam::123456789012:role/Admin" }, { "RuleArn": "arn:aws:securityhub:us-east-1:123456789012:automation-rule/a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "RuleStatus": "ENABLED", "RuleOrder": 1, "RuleName": "sample rule", "Description": "A sample rule", "IsTerminal": false, "CreatedAt": "2023-07-15T23:37:20.223000+00:00", "UpdatedAt": "2023-07-15T23:37:20.223000+00:00", "CreatedBy": "arn:aws:iam::123456789012:role/Admin" }, { "RuleArn": "arn:aws:securityhub:us-east-1:123456789012:automation-rule/a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "RuleStatus": "ENABLED", "RuleOrder": 1, "RuleName": "sample rule", "Description": "A sample rule", "IsTerminal": false, "CreatedAt": "2023-07-15T23:45:25.126000+00:00", "UpdatedAt": "2023-07-15T23:45:25.126000+00:00", "CreatedBy": "arn:aws:iam::123456789012:role/Admin" } ] }
詳細については、「AWS Security Hub ユーザーガイド」の「自動化ルールを表示する」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「ListAutomationRules
」を参照してください。
-
次のコード例は、list-configuration-policies
を使用する方法を示しています。
- AWS CLI
-
設定ポリシーの概要を一覧表示するには
次の
list-configuration-policies
の例は、組織の設定ポリシーの概要を示しています。aws securityhub list-configuration-policies \ --max-items
3
出力:
{ "ConfigurationPolicySummaries": [ { "Arn": "arn:aws:securityhub:eu-central-1:123456789012:configuration-policy/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "Id": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "Name": "SampleConfigurationPolicy1", "Description": "SampleDescription1", "UpdatedAt": "2023-09-26T21:08:36.214000+00:00", "ServiceEnabled": true }, { "Arn": "arn:aws:securityhub:eu-central-1:123456789012:configuration-policy/a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "Id": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "Name": "SampleConfigurationPolicy2", "Description": "SampleDescription2" "UpdatedAt": "2023-11-28T19:26:25.207000+00:00", "ServiceEnabled": true }, { "Arn": "arn:aws:securityhub:eu-central-1:123456789012:configuration-policy/a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "Id": "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "Name": "SampleConfigurationPolicy3", "Description": "SampleDescription3", "UpdatedAt": "2023-11-28T20:28:04.494000+00:00", "ServiceEnabled": true } }
詳細については、「AWS Security Hub ユーザーガイド」の「設定ポリシーのステータスと詳細の表示」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「ListConfigurationPolicies
」を参照してください。
-
次の例は、list-configuration-policy-associations
を使用する方法を説明しています。
- AWS CLI
-
設定の関連付けを一覧表示するには
次の
list-configuration-policy-associations
の例では、組織の設定関連付けの概要を一覧表示します。レスポンスには、設定ポリシーとセルフマネージド動作との関連付けが含まれます。aws securityhub list-configuration-policy-associations \ --filters '
{"AssociationType": "APPLIED"}
' \ --max-items4
出力:
{ "ConfigurationPolicyAssociationSummaries": [ { "ConfigurationPolicyId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "TargetId": "r-1ab2", "TargetType": "ROOT", "AssociationType": "APPLIED", "UpdatedAt": "2023-11-28T19:26:49.417000+00:00", "AssociationStatus": "FAILED", "AssociationStatusMessage": "Policy association failed because 2 organizational units or accounts under this root failed." }, { "ConfigurationPolicyId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "TargetId": "ou-1ab2-c3de4f5g", "TargetType": "ORGANIZATIONAL_UNIT", "AssociationType": "APPLIED", "UpdatedAt": "2023-09-26T21:14:05.283000+00:00", "AssociationStatus": "FAILED", "AssociationStatusMessage": "One or more children under this target failed association." }, { "ConfigurationPolicyId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "TargetId": "ou-6hi7-8j91kl2m", "TargetType": "ORGANIZATIONAL_UNIT", "AssociationType": "APPLIED", "UpdatedAt": "2023-09-26T21:13:01.816000+00:00", "AssociationStatus": "SUCCESS", "AssociationStatusMessage": "Association applied successfully on this target." }, { "ConfigurationPolicyId": "SELF_MANAGED_SECURITY_HUB", "TargetId": "111122223333", "TargetType": "ACCOUNT", "AssociationType": "APPLIED", "UpdatedAt": "2023-11-28T22:01:26.409000+00:00", "AssociationStatus": "SUCCESS" } }
詳細については、AWS 「 Security Hub ユーザーガイド」の「設定ポリシーのステータスと詳細の表示」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「ListConfigurationPolicyAssociations
」を参照してください。
-
次のコード例は、list-enabled-products-for-import
を使用する方法を示しています。
- AWS CLI
-
有効な製品統合のリストを返すには
次の
list-enabled-products-for-import
の例では、現在有効な製品統合のサブスクリプション ARNS のリストを返します。aws securityhub list-enabled-products-for-import
出力:
{ "ProductSubscriptions": [ "arn:aws:securityhub:us-west-1:123456789012:product-subscription/crowdstrike/crowdstrike-falcon", "arn:aws:securityhub:us-west-1:123456789012:product-subscription/aws/securityhub" ] }
詳細については、「AWS Security Hub ユーザーガイド」の「製品統合の管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「ListEnabledProductsForImport
」を参照してください。
-
次の例は、list-finding-aggregators
を使用する方法を説明しています。
- AWS CLI
-
使用可能なウィジェットを一覧表示するには
次の
list-finding-aggregators
の例では、検出結果集約設定の ARN を返します。aws securityhub list-finding-aggregators
出力:
{ "FindingAggregatorArn": "arn:aws:securityhub:us-east-1:222222222222:finding-aggregator/123e4567-e89b-12d3-a456-426652340000" }
詳細については、「AWS Security Hub ユーザーガイド」の「現在の結果の集約設定を表示する」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「ListFindingAggregators
」を参照してください。
-
次の例は、list-invitations
を使用する方法を説明しています。
- AWS CLI
-
招待のリストを表示するには
次の
list-invitations
の例では、リクエスト元のアカウントに送信された招待のリストを取得します。aws securityhub list-invitations
出力:
{ "Invitations": [ { "AccountId": "123456789012", "InvitationId": "7ab938c5d52d7904ad09f9e7c20cc4eb", "InvitedAt": 2020-06-01T20:21:18.042000+00:00, "MemberStatus": "ASSOCIATED" } ], }
詳細については、「AWS Security Hub ユーザーガイド」の「管理者アカウントおよびメンバーアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「ListInvitations
」を参照してください。
-
次のコード例は、list-members
を使用する方法を示しています。
- AWS CLI
-
メンバーアカウントのリストを取得するには
次の
list-members
の例では、リクエストする管理者アカウントのメンバーアカウントのリストを返します。aws securityhub list-members
出力:
{ "Members": [ { "AccountId": "123456789111", "AdministratorId": "123456789012", "InvitedAt": 2020-06-01T20:15:15.289000+00:00, "MasterId": "123456789012", "MemberStatus": "ASSOCIATED", "UpdatedAt": 2020-06-01T20:15:15.289000+00:00 }, { "AccountId": "123456789222", "AdministratorId": "123456789012", "InvitedAt": 2020-06-01T20:15:15.289000+00:00, "MasterId": "123456789012", "MemberStatus": "ASSOCIATED", "UpdatedAt": 2020-06-01T20:15:15.289000+00:00 } ], }
詳細については、「AWS Security Hub ユーザーガイド」の「管理者アカウントおよびメンバーアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「ListMembers
」を参照してください。
-
次の例は、list-organization-admin-accounts
を使用する方法を説明しています。
- AWS CLI
-
指定された Security Hub 管理者アカウントを一覧表示するには
次の
list-organization-admin-accounts
の例では、組織の Security Hub 管理者アカウントを一覧表示します。aws securityhub list-organization-admin-accounts
出力:
{ AdminAccounts": [ { "AccountId": "777788889999" }, { "Status": "ENABLED" } ] }
詳細については、「AWS Security Hub ユーザーガイド」の「Security Hub 管理者アカウントの指定」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「ListOrganizationAdminAccounts
」を参照してください。
-
次の例は、list-security-control-definitions
を使用する方法を説明しています。
- AWS CLI
-
例 1: 使用可能なすべてのセキュリティコントロールを一覧表示するには
次の
list-security-control-definitions
の例では、すべての Security Hub 標準で使用可能なセキュリティコントロールを一覧表示します。この例では、結果を 3 つのコントロールに制限します。aws securityhub list-security-control-definitions \ --max-items
3
出力:
{ "SecurityControlDefinitions": [ { "SecurityControlId": "ACM.1", "Title": "Imported and ACM-issued certificates should be renewed after a specified time period", "Description": "This control checks whether an AWS Certificate Manager (ACM) certificate is renewed within the specified time period. It checks both imported certificates and certificates provided by ACM. The control fails if the certificate isn't renewed within the specified time period. Unless you provide a custom parameter value for the renewal period, Security Hub uses a default value of 30 days.", "RemediationUrl": "https://docs.aws.amazon.com/console/securityhub/ACM.1/remediation", "SeverityRating": "MEDIUM", "CurrentRegionAvailability": "AVAILABLE", "CustomizableProperties": [ "Parameters" ] }, { "SecurityControlId": "ACM.2", "Title": "RSA certificates managed by ACM should use a key length of at least 2,048 bits", "Description": "This control checks whether RSA certificates managed by AWS Certificate Manager use a key length of at least 2,048 bits. The control fails if the key length is smaller than 2,048 bits.", "RemediationUrl": "https://docs.aws.amazon.com/console/securityhub/ACM.2/remediation", "SeverityRating": "HIGH", "CurrentRegionAvailability": "AVAILABLE", "CustomizableProperties": [] }, { "SecurityControlId": "APIGateway.1", "Title": "API Gateway REST and WebSocket API execution logging should be enabled", "Description": "This control checks whether all stages of an Amazon API Gateway REST or WebSocket API have logging enabled. The control fails if the 'loggingLevel' isn't 'ERROR' or 'INFO' for all stages of the API. Unless you provide custom parameter values to indicate that a specific log type should be enabled, Security Hub produces a passed finding if the logging level is either 'ERROR' or 'INFO'.", "RemediationUrl": "https://docs.aws.amazon.com/console/securityhub/APIGateway.1/remediation", "SeverityRating": "MEDIUM", "CurrentRegionAvailability": "AVAILABLE", "CustomizableProperties": [ "Parameters" ] } ], "NextToken": "U2FsdGVkX1/UprCPzxVbkDeHikDXbDxfgJZ1w2RG1XWsFPTMTIQPVE0m/FduIGxS7ObRtAbaUt/8/RCQcg2PU0YXI20hH/GrhoOTgv+TSm0qvQVFhkJepWmqh+NYawjocVBeos6xzn/8qnbF9IuwGg==" }
詳細については、「AWS Security Hub ユーザーガイド」の「標準の詳細の表示」を参照してください。
例 2: 特定の標準で使用可能なセキュリティコントロールを一覧表示するには
次の の
list-security-control-definitions
例では、CIS AWS Foundations Benchmark v1.4.0 で使用可能なセキュリティコントロールを一覧表示します。この例では、結果を 3 つのコントロールに制限します。aws securityhub list-security-control-definitions \ --standards-arn
"arn:aws:securityhub:us-east-1::standards/cis-aws-foundations-benchmark/v/1.4.0"
\ --max-items3
出力:
{ "SecurityControlDefinitions": [ { "SecurityControlId": "CloudTrail.1", "Title": "CloudTrail should be enabled and configured with at least one multi-Region trail that includes read and write management events", "Description": "This AWS control checks that there is at least one multi-region AWS CloudTrail trail includes read and write management events.", "RemediationUrl": "https://docs.aws.amazon.com/console/securityhub/CloudTrail.1/remediation", "SeverityRating": "HIGH", "CurrentRegionAvailability": "AVAILABLE", "CustomizableProperties": [] }, { "SecurityControlId": "CloudTrail.2", "Title": "CloudTrail should have encryption at-rest enabled", "Description": "This AWS control checks whether AWS CloudTrail is configured to use the server side encryption (SSE) AWS Key Management Service (AWS KMS) customer master key (CMK) encryption. The check will pass if the KmsKeyId is defined.", "RemediationUrl": "https://docs.aws.amazon.com/console/securityhub/CloudTrail.2/remediation", "SeverityRating": "MEDIUM", "CurrentRegionAvailability": "AVAILABLE", "CustomizableProperties": [] }, { "SecurityControlId": "CloudTrail.4", "Title": "CloudTrail log file validation should be enabled", "Description": "This AWS control checks whether CloudTrail log file validation is enabled.", "RemediationUrl": "https://docs.aws.amazon.com/console/securityhub/CloudTrail.4/remediation", "SeverityRating": "MEDIUM", "CurrentRegionAvailability": "AVAILABLE", "CustomizableProperties": [] } ], "NextToken": "eyJOZXh0VG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAzfQ==" }
詳細については、「AWS Security Hub ユーザーガイド」の「標準の詳細の表示」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「ListSecurityControlDefinitions
」を参照してください。
-
次の例は、list-standards-control-associations
を使用する方法を説明しています。
- AWS CLI
-
有効な各標準でコントロールの有効化ステータスを取得するには
次の
list-standards-control-associations
の例では、有効な各標準における CloudTrail.1 の有効化ステータスを一覧表示します。aws securityhub list-standards-control-associations \ --security-control-id
CloudTrail.1
出力:
{ "StandardsControlAssociationSummaries": [ { "StandardsArn": "arn:aws:securityhub:us-east-2::standards/nist-800-53/v/5.0.0", "SecurityControlId": "CloudTrail.1", "SecurityControlArn": "arn:aws:securityhub:us-east-2:123456789012:security-control/CloudTrail.1", "AssociationStatus": "ENABLED", "RelatedRequirements": [ "NIST.800-53.r5 AC-2(4)", "NIST.800-53.r5 AC-4(26)", "NIST.800-53.r5 AC-6(9)", "NIST.800-53.r5 AU-10", "NIST.800-53.r5 AU-12", "NIST.800-53.r5 AU-2", "NIST.800-53.r5 AU-3", "NIST.800-53.r5 AU-6(3)", "NIST.800-53.r5 AU-6(4)", "NIST.800-53.r5 AU-14(1)", "NIST.800-53.r5 CA-7", "NIST.800-53.r5 SC-7(9)", "NIST.800-53.r5 SI-3(8)", "NIST.800-53.r5 SI-4(20)", "NIST.800-53.r5 SI-7(8)", "NIST.800-53.r5 SA-8(22)" ], "UpdatedAt": "2023-05-15T17:52:21.304000+00:00", "StandardsControlTitle": "CloudTrail should be enabled and configured with at least one multi-Region trail that includes read and write management events", "StandardsControlDescription": "This AWS control checks that there is at least one multi-region AWS CloudTrail trail includes read and write management events." }, { "StandardsArn": "arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0", "SecurityControlId": "CloudTrail.1", "SecurityControlArn": "arn:aws:securityhub:us-east-2:123456789012:security-control/CloudTrail.1", "AssociationStatus": "ENABLED", "RelatedRequirements": [ "CIS AWS Foundations 2.1" ], "UpdatedAt": "2020-02-10T21:22:53.998000+00:00", "StandardsControlTitle": "Ensure CloudTrail is enabled in all regions", "StandardsControlDescription": "AWS CloudTrail is a web service that records AWS API calls for your account and delivers log files to you. The recorded information includes the identity of the API caller, the time of the API call, the source IP address of the API caller, the request parameters, and the response elements returned by the AWS service." }, { "StandardsArn": "arn:aws:securityhub:us-east-2::standards/aws-foundational-security-best-practices/v/1.0.0", "SecurityControlId": "CloudTrail.1", "SecurityControlArn": "arn:aws:securityhub:us-east-2:123456789012:security-control/CloudTrail.1", "AssociationStatus": "DISABLED", "RelatedRequirements": [], "UpdatedAt": "2023-05-15T19:31:52.671000+00:00", "UpdatedReason": "Alternative compensating controls are in place", "StandardsControlTitle": "CloudTrail should be enabled and configured with at least one multi-Region trail that includes read and write management events", "StandardsControlDescription": "This AWS control checks that there is at least one multi-region AWS CloudTrail trail includes read and write management events." }, { "StandardsArn": "arn:aws:securityhub:us-east-2::standards/cis-aws-foundations-benchmark/v/1.4.0", "SecurityControlId": "CloudTrail.1", "SecurityControlArn": "arn:aws:securityhub:us-east-2:123456789012:security-control/CloudTrail.1", "AssociationStatus": "ENABLED", "RelatedRequirements": [ "CIS AWS Foundations Benchmark v1.4.0/3.1" ], "UpdatedAt": "2022-11-10T15:40:36.021000+00:00", "StandardsControlTitle": "Ensure CloudTrail is enabled in all regions", "StandardsControlDescription": "AWS CloudTrail is a web service that records AWS API calls for your account and delivers log files to you. The recorded information includes the identity of the API caller, the time of the API call, the source IP address of the API caller, the request parameters, and the response elements returned by the AWS service. CloudTrail provides a history of AWS API calls for an account, including API calls made via the Management Console, SDKs, command line tools, and higher-level AWS services (such as CloudFormation)." } ] }
詳細については、「AWS Security Hub ユーザーガイド」の「特定の標準のコントロールを有効にする」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「ListStandardsControlAssociations
」を参照してください。
-
次のコード例は、list-tags-for-resource
を使用する方法を示しています。
- AWS CLI
-
リソースに割り当てられたタグを取得するには
次の
list-tags-for-resource
の例では、指定されたハブリソースに割り当てられたタグを返します。aws securityhub list-tags-for-resource \ --resource-arn
"arn:aws:securityhub:us-west-1:123456789012:hub/default"
出力:
{ "Tags": { "Department" : "Operations", "Area" : "USMidwest" } }
詳細については、「AWS CloudFormation ユーザーガイド」の「AWS::SecurityHub::Hub」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「ListTagsForResource
」を参照してください。
-
次の例は、start-configuration-policy-association
を使用する方法を説明しています。
- AWS CLI
-
例 1: 設定ポリシーを関連付けるには
次の
start-configuration-policy-association
の例では、指定された設定ポリシーを指定された組織単位に関連付けます。設定は、ターゲットアカウント、組織単位、またはルートに関連付けることができます。aws securityhub start-configuration-policy-association \ --configuration-policy-identifier
"arn:aws:securityhub:eu-central-1:123456789012:configuration-policy/a1b2c3d4-5678-90ab-cdef-EXAMPLE33333"
\ --target '{"OrganizationalUnitId": "ou-6hi7-8j91kl2m"}
'出力:
{ "ConfigurationPolicyId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "TargetId": "ou-6hi7-8j91kl2m", "TargetType": "ORGANIZATIONAL_UNIT", "AssociationType": "APPLIED", "UpdatedAt": "2023-11-29T17:40:52.468000+00:00", "AssociationStatus": "PENDING" }
詳細については、「AWS Security Hub ユーザーガイド」の「Security Hub 設定ポリシーの作成と関連付け」を参照してください。
例 2: セルフマネージド設定を関連付けるには
次の
start-configuration-policy-association
の例では、セルフマネージド設定を指定されたアカウントと関連付けます。aws securityhub start-configuration-policy-association \ --configuration-policy-identifier
"SELF_MANAGED_SECURITY_HUB"
\ --target '{"OrganizationalUnitId": "123456789012"}
'出力:
{ "ConfigurationPolicyId": "SELF_MANAGED_SECURITY_HUB", "TargetId": "123456789012", "TargetType": "ACCOUNT", "AssociationType": "APPLIED", "UpdatedAt": "2023-11-29T17:40:52.468000+00:00", "AssociationStatus": "PENDING" }
詳細については、「AWS Security Hub ユーザーガイド」の「Security Hub 設定ポリシーの作成と関連付け」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「StartConfigurationPolicyAssociation
」を参照してください。
-
次のコード例は、start-configuration-policy-disassociation
を使用する方法を示しています。
- AWS CLI
-
例 1: 設定ポリシーの関連付けを解除するには
次の
start-configuration-policy-disassociation
の例では、指定された組織単位から設定ポリシーの関連付けを解除します。設定は、ターゲットアカウント、組織単位、またはルートからの関連付けを解除できます。aws securityhub start-configuration-policy-disassociation \ --configuration-policy-identifier
"arn:aws:securityhub:eu-central-1:123456789012:configuration-policy/a1b2c3d4-5678-90ab-cdef-EXAMPLE33333"
\ --target '{"OrganizationalUnitId": "ou-6hi7-8j91kl2m"}
'このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「アカウントと OU からの設定の関連付けの解除」を参照してください。
例 2: セルフマネージド設定の関連付けを解除するには
次の
start-configuration-policy-disassociation
の例では、指定されたアカウントからセルフマネージド設定の関連付けを解除します。aws securityhub start-configuration-policy-disassociation \ --configuration-policy-identifier
"SELF_MANAGED_SECURITY_HUB"
\ --target '{"AccountId": "123456789012"}
'このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「アカウントと OU からの設定の関連付けの解除」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「StartConfigurationPolicyDisassociation
」を参照してください。
-
次のコード例は、tag-resource
を使用する方法を示しています。
- AWS CLI
-
リソースにタグを割り当てるには
次の
tag-resource
の例では、指定されたハブリソースに部署およびエリアタグを割り当てます。aws securityhub tag-resource \ --resource-arn
"arn:aws:securityhub:us-west-1:123456789012:hub/default"
\ --tags '{"Department":"Operations", "Area":"USMidwest"}
'このコマンドでは何も出力されません。
詳細については、「AWS CloudFormation ユーザーガイド」の「AWS::SecurityHub::Hub」を参照してください。
-
API の詳細については、AWS CLI コマンドリファレンスの「TagResource
」を参照してください。
-
次の例は、untag-resource
を使用する方法を説明しています。
- AWS CLI
-
リソースからタグ値を削除するには
次の
untag-resource
の例では、指定されたリソースから部署タグを削除しています。aws securityhub untag-resource \ --resource-arn
"arn:aws:securityhub:us-west-1:123456789012:hub/default"
\ --tag-keys"Department"
このコマンドでは何も出力されません。
詳細については、「AWS CloudFormation ユーザーガイド」の「AWS::SecurityHub::Hub」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「UntagResource
」を参照してください。
-
次の例は、update-action-target
を使用する方法を説明しています。
- AWS CLI
-
カスタムアクションを更新するには
次の
update-action-target
の例では、指定された ARN によって識別されるカスタムアクションの名前を更新します。aws securityhub update-action-target \ --action-target-arn
"arn:aws:securityhub:us-west-1:123456789012:action/custom/Remediation"
\ --name"Send to remediation"
このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「カスタムアクションを作成し、CloudWatch Events ルールに関連付ける」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「UpdateActionTarget
」を参照してください。
-
次のコード例は、update-configuration-policy
を使用する方法を示しています。
- AWS CLI
-
設定ポリシーを更新するには
次の
update-configuration-policy
の例では、既存の設定ポリシーを更新して、指定された設定を使用します。aws securityhub update-configuration-policy \ --identifier
"arn:aws:securityhub:eu-central-1:508236694226:configuration-policy/09f37766-57d8-4ede-9d33-5d8b0fecf70e"
\ --name"SampleConfigurationPolicyUpdated"
\ --description"SampleDescriptionUpdated"
\ --configuration-policy '{"SecurityHub": {"ServiceEnabled": true, "EnabledStandardIdentifiers": ["arn:aws:securityhub:eu-central-1::standards/aws-foundational-security-best-practices/v/1.0.0","arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0"],"SecurityControlsConfiguration":{"DisabledSecurityControlIdentifiers": ["CloudWatch.1"], "SecurityControlCustomParameters": [{"SecurityControlId": "ACM.1", "Parameters": {"daysToExpiration": {"ValueType": "CUSTOM", "Value": {"Integer": 21}}}}]}}}
' \ --updated-reason"Disabling CloudWatch.1 and changing parameter value"
出力:
{ "Arn": "arn:aws:securityhub:eu-central-1:123456789012:configuration-policy/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "Id": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "Name": "SampleConfigurationPolicyUpdated", "Description": "SampleDescriptionUpdated", "UpdatedAt": "2023-11-28T20:28:04.494000+00:00", "CreatedAt": "2023-11-28T20:28:04.494000+00:00", "ConfigurationPolicy": { "SecurityHub": { "ServiceEnabled": true, "EnabledStandardIdentifiers": [ "arn:aws:securityhub:eu-central-1::standards/aws-foundational-security-best-practices/v/1.0.0", "arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0" ], "SecurityControlsConfiguration": { "DisabledSecurityControlIdentifiers": [ "CloudWatch.1" ], "SecurityControlCustomParameters": [ { "SecurityControlId": "ACM.1", "Parameters": { "daysToExpiration": { "ValueType": "CUSTOM", "Value": { "Integer": 21 } } } } ] } } } }
詳細については、「AWS Security Hub ユーザーガイド」の「設定ポリシーのステータスと詳細の更新」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「UpdateConfigurationPolicy
」を参照してください。
-
次のコード例は、update-finding-aggregator
を使用する方法を示しています。
- AWS CLI
-
現在の検索結果の集約設定を更新するには
次の
update-finding-aggregator
の例では、選択したリージョンからリンクするように検出結果集約設定を変更します。コマンドは、現在の集約リージョンである米国東部 (バージニア) から実行されます。リンクされたリージョンとして、米国西部 (北カリフォルニア) と米国西部 (オレゴン) が選択されます。aws securityhub update-finding-aggregator \ --region
us-east-1
\ --finding-aggregator-arnarn:aws:securityhub:us-east-1:222222222222:finding-aggregator/123e4567-e89b-12d3-a456-426652340000
\ --region-linking-modeSPECIFIED_REGIONS
\ --regionsus-west-1,us-west-2
このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「結果の集約設定を更新する」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「UpdateFindingAggregator
」を参照してください。
-
次のコード例は、update-insight
を使用する方法を示しています。
- AWS CLI
-
例 1: カスタムインサイトのフィルターを変更するには
次の
update-insight
の例では、カスタムインサイトのフィルターを変更します。更新されたインサイトは、 AWS ロールに関連する重要度の高い結果を検索します。aws securityhub update-insight \ --insight-arn
"arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"
\ --filters '{"ResourceType": [{ "Comparison": "EQUALS", "Value": "AwsIamRole"}], "SeverityLabel": [{"Comparison": "EQUALS", "Value": "HIGH"}]}
' \ --name"High severity role findings"
例 2: カスタムインサイトのグループ化属性を変更するには
次の
update-insight
の例では、指定された ARN を使用してカスタムインサイトのグループ化属性を変更します。新しいグループ化属性はリソース ID です。aws securityhub update-insight \ --insight-arn
"arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"
\ --group-by-attribute"ResourceId"
\ --name"Critical role findings"
出力:
{ "Insights": [ { "InsightArn": "arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "Name": "Critical role findings", "Filters": { "SeverityLabel": [ { "Value": "CRITICAL", "Comparison": "EQUALS" } ], "ResourceType": [ { "Value": "AwsIamRole", "Comparison": "EQUALS" } ] }, "GroupByAttribute": "ResourceId" } ] }
詳細については、「AWS Security Hub ユーザーガイド」の「カスタムインサイトの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「UpdateInsight
」を参照してください。
-
次のコード例は、update-organization-configuration
を使用する方法を示しています。
- AWS CLI
-
組織の Security Hub の設定方法を更新するには
次の
update-organization-configuration
の例では、Security Hub が中央設定を使用して組織を設定するように指定しています。このコマンド実行後、委任 Security Hub 管理者は、組織を設定するための設定ポリシーを作成できます。委任された管理者は、このコマンドを使用して中央設定からローカル設定に切り替えることもできます。ローカル設定が設定タイプの場合、委任された管理者が、新しい組織アカウントで Security Hub とデフォルトのセキュリティ標準を自動的に有効にするかどうか選択できます。aws securityhub update-organization-configuration \ --no-auto-enable \ --organization-configuration '
{"ConfigurationType": "CENTRAL"}
'このコマンドでは何も出力されません。
詳細については、AWS 「 Security Hub ユーザーガイド」のAWS 「Organizations によるアカウントの管理」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「UpdateOrganizationConfiguration
」を参照してください。
-
次の例は、update-security-control
を使用する方法を説明しています。
- AWS CLI
-
セキュリティコントロールのプロパティを更新するには
次の
update-security-control
例では、Security Hub セキュリティコントロールパラメータのカスタム値を指定します。aws securityhub update-security-control \ --security-control-id
ACM.1
\ --parameters '{"daysToExpiration": {"ValueType": "CUSTOM", "Value": {"Integer": 15}}}
' \ --last-update-reason"Internal compliance requirement"
このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「カスタムコントロールパラメータ」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「UpdateSecurityControl
」を参照してください。
-
次のコード例は、update-security-hub-configuration
を使用する方法を示しています。
- AWS CLI
-
Security Hub 設定を更新するには
次の
update-security-hub-configuration
例では、Security Hub を設定して、有効な標準に対して新しいコントロールを自動的に有効にします。aws securityhub update-security-hub-configuration \ --auto-enable-controls
このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「新しいコントロールを自動的に有効にする」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「UpdateSecurityHubConfiguration
」を参照してください。
-
次のコード例は、update-standards-control
を使用する方法を示しています。
- AWS CLI
-
例 1: コントロールを無効にするには
次の
update-standards-control
の例では、PCI.AutoScaling.1 コントロールを無効にします。aws securityhub update-standards-control \ --standards-control-arn
"arn:aws:securityhub:us-west-1:123456789012:control/pci-dss/v/3.2.1/PCI.AutoScaling.1"
\ --control-status"DISABLED"
\ --disabled-reason"Not applicable for my service"
このコマンドでは何も出力されません。
例 2: コントロールを有効にするには
次の
update-standards-control
の例では、PCI.AutoScaling.1 コントロールを有効にします。aws securityhub update-standards-control \ --standards-control-arn
"arn:aws:securityhub:us-west-1:123456789012:control/pci-dss/v/3.2.1/PCI.AutoScaling.1"
\ --control-status"ENABLED"
このコマンドでは何も出力されません。
詳細については、「AWS Security Hub ユーザーガイド」の「個々のコントロールの無効化と有効化」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「UpdateStandardsControl
」を参照してください。
-