Beispiele für die Verwendung der AWS CLI mit Security Hub - AWS Command Line Interface

Beispiele für die Verwendung der AWS CLI mit Security Hub

Die folgenden Codebeispiele zeigen, wie Sie Aktionen durchführen und gängige Szenarien implementieren, indem Sie AWS Command Line Interface mit Security Hub nutzen.

Aktionen sind Codeauszüge aus größeren Programmen und müssen im Kontext ausgeführt werden. Während Aktionen Ihnen zeigen, wie Sie einzelne Service-Funktionen aufrufen, können Sie Aktionen im Kontext der zugehörigen Szenarien anzeigen.

Jedes Beispiel enthält einen Link zum vollständigen Quellcode, wo Sie Anleitungen zum Einrichten und Ausführen des Codes im Kontext finden.

Themen

Aktionen

Das folgende Codebeispiel zeigt, wie accept-administrator-invitation verwendet wird.

AWS CLI

So akzeptieren Sie eine Einladung von einem Administratorkonto

Im folgenden Beispiel für accept-administrator-invitation wird die angegebene Einladung vom angegebenen Administratorkonto akzeptiert.

aws securityhub accept-invitation \ --administrator-id 123456789012 \ --invitation-id 7ab938c5d52d7904ad09f9e7c20cc4eb

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Verwaltung von Administrator- und Mitgliedskonten im AWSSecurity-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie accept-invitation verwendet wird.

AWS CLI

So akzeptieren Sie eine Einladung von einem Administratorkonto

Im folgenden Beispiel für accept-invitation wird die angegebene Einladung vom angegebenen Administratorkonto akzeptiert.

aws securityhub accept-invitation \ --master-id 123456789012 \ --invitation-id 7ab938c5d52d7904ad09f9e7c20cc4eb

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Verwaltung von Administrator- und Mitgliedskonten im AWSSecurity-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie batch-delete-automation-rules verwendet wird.

AWS CLI

So löschen Sie Automatisierungsregeln

Im folgenden Beispiel für batch-delete-automation-rules wird die angegebene Automatisierungsregel gelöscht. Sie können eine oder mehrere Regeln mit einem einzigen Befehl löschen. Nur das Security-Hub-Administratorkonto kann diesen Befehl ausführen.

aws securityhub batch-delete-automation-rules \ --automation-rules-arns '["arn:aws:securityhub:us-east-1:123456789012:automation-rule/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"]'

Ausgabe:

{ "ProcessedAutomationRules": [ "arn:aws:securityhub:us-east-1:123456789012:automation-rule/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" ], "UnprocessedAutomationRules": [] }

Weitere Informationen finden Sie unter Löschen von Automatisierungsregeln im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie batch-disable-standards verwendet wird.

AWS CLI

Deaktivieren eines Standards

Im folgenden Beispiel für batch-disable-standards wird der Standard deaktiviert, der dem angegebenen Abonnement-ARN zugeordnet ist.

aws securityhub batch-disable-standards \ --standards-subscription-arns "arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1"

Ausgabe:

{ "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" } ] }

Weitere Informationen finden Sie unter Aktivieren oder Deaktivieren eines Sicherheitsstandards im AWSSecurity-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie batch-enable-standards verwendet wird.

AWS CLI

So aktivieren Sie einen Standard

Im folgenden Beispiel für batch-enable-standards wird der PCI-DSS-Standard für das anfragende Konto aktiviert.

aws securityhub batch-enable-standards \ --standards-subscription-requests '{"StandardsArn":"arn:aws:securityhub:us-west-1::standards/pci-dss/v/3.2.1"}'

Ausgabe:

{ "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" } ] }

Weitere Informationen finden Sie unter Aktivieren oder Deaktivieren eines Sicherheitsstandards im AWSSecurity-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie batch-get-automation-rules verwendet wird.

AWS CLI

So rufen Sie Details zu Automatisierungsregeln ab

Im folgenden Beispiel für batch-get-automation-rules werden Details für die angegebene Automatisierungsregel abgerufen. Sie können Details für eine oder mehrere Automatisierungsregeln mit einem einzigen Befehl abrufen.

aws securityhub batch-get-automation-rules \ --automation-rules-arns '["arn:aws:securityhub:us-east-1:123456789012:automation-rule/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"]'

Ausgabe:

{ "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": [] }

Weitere Informationen finden Sie unter Anzeigen von Automatisierungsregeln im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie batch-get-configuration-policy-associations verwendet wird.

AWS CLI

So rufen Sie Details zur Konfigurationszuweisung für einen Stapel von Zielen ab

Im folgenden Beispiel für batch-get-configuration-policy-associations werden Zuweisungsdetails für die angegebenen Ziele abgerufen. Sie können Konto-IDs, Organisationseinheiten-IDs oder die Stamm-ID für das Ziel angeben.

aws securityhub batch-get-configuration-policy-associations \ --target '{"OrganizationalUnitId": "ou-6hi7-8j91kl2m"}'

Ausgabe:

{ "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." }

Weitere Informationen finden Sie unter Anzeigen von Security-Hub-Konfigurationsrichtlinien im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie batch-get-security-controls verwendet wird.

AWS CLI

So rufen Sie Details zur Sicherheitskontrolle ab

Im folgenden Beispiel für batch-get-security-controls werden Details zu den Sicherheitskontrollen ACM.1 und IAM.1 für das aktuelle AWS-Konto und die AWS-Region abgerufen.

aws securityhub batch-get-security-controls \ --security-control-ids '["ACM.1", "IAM.1"]'

Ausgabe:

{ "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": {} } ] }

Weitere Informationen finden Sie unter Anzeigen von Details für eine Kontrolle im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie batch-get-standards-control-associations verwendet wird.

AWS CLI

So rufen Sie den Aktivierungsstatus einer Kontrolle ab

Das folgende batch-get-standards-control-associations Beispiel identifiziert, ob die angegebenen Kontrollen in den angegebenen Standards aktiviert sind.

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"}]'

Ausgabe:

{ "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" ] } ] }

Weitere Informationen finden Sie unter Aktivieren und Deaktivieren von Kontrollen in bestimmten Standards im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie batch-import-findings verwendet wird.

AWS CLI

So aktualisieren Sie ein Ergebnis

Im folgenden Beispiel für batch-import-findings wird ein Ergebnis aktualisiert.

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" }]'

Ausgabe:

{ "FailedCount": 0, "SuccessCount": 1, "FailedFindings": [] }

Weitere Informationen finden Sie unter Verwenden von BatchImportFindings zum Erstellen und Aktualisieren von Ergebnissen im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie batch-update-automation-rules verwendet wird.

AWS CLI

So aktualisieren Sie Automatisierungsregeln

Im folgenden Beispiel für batch-update-automation-rules wird die angegebene Automatisierungsregel aktualisiert. Sie können eine oder mehrere Regeln mit einem einzigen Befehl aktualisieren. Nur das Security-Hub-Administratorkonto kann diesen Befehl ausführen.

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" \ } \ ]'

Ausgabe:

{ "ProcessedAutomationRules": [ "arn:aws:securityhub:us-east-1:123456789012:automation-rule/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" ], "UnprocessedAutomationRules": [] }

Weitere Informationen finden Sie unter Automatisierungsregeln bearbeiten im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie batch-update-findings verwendet wird.

AWS CLI

Beispiel 1: So aktualisieren Sie ein Ergebnis

Im folgenden Beispiel für batch-update-findings werden zwei Ergebnisse aktualisiert, um eine Notiz hinzuzufügen, die Bezeichnung für den Schweregrad zu ändern und das Problem zu beheben.

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"}'

Ausgabe:

{ "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": [] }

Weitere Informationen finden Sie unter Verwenden von BatchUpdateFindings zum Aktualisieren eines Ergebnisses im AWS-Security-Hub-Benutzerhandbuch.

Beispiel 2: So aktualisieren Sie ein Ergebnis mithilfe einer Kurznotationssyntax

Im folgenden Beispiel für batch-update-findings werden zwei Ergebnisse aktualisiert, um eine Notiz hinzuzufügen, die Bezeichnung für den Schweregrad zu ändern und das Problem mithilfe einer Kurznotationssyntax aufzulösen.

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"

Ausgabe:

{ "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": [] }

Weitere Informationen finden Sie unter Verwenden von BatchUpdateFindings zum Aktualisieren eines Ergebnisses im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie batch-update-standards-control-associations verwendet wird.

AWS CLI

So aktualisieren Sie den Aktivierungsstatus einer Kontrolle in aktivierten Standards

Im folgenden Beispiel für batch-update-standards-control-associations wird CloudTrail.1 in den angegebenen Standards deaktiviert.

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"}]'

Dieser Befehl erzeugt keine Ausgabe, wenn er erfolgreich ist.

Weitere Informationen finden Sie unter Aktivieren und Deaktivieren von Kontrollen in bestimmten Standards und Aktivieren und Deaktivieren von Kontrollen in allen Standards im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie create-action-target verwendet wird.

AWS CLI

So erstellen Sie eine benutzerdefinierte Aktion

Im folgenden Beispiel für create-action-target wird eine benutzerdefinierte Aktion erstellt. Der Name, die Beschreibung und die ID werden für die Aktion bereitgestellt.

aws securityhub create-action-target \ --name "Send to remediation" \ --description "Action to send the finding for remediation tracking" \ --id "Remediation"

Ausgabe:

{ "ActionTargetArn": "arn:aws:securityhub:us-west-1:123456789012:action/custom/Remediation" }

Weitere Informationen finden Sie unter Erstellen einer benutzerdefinierten Aktion und Verknüpfung mit einer CloudWatch-Regel im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie create-automation-rule verwendet wird.

AWS CLI

So erstellen Sie eine Automatisierungsregel

Im folgenden Beispiel für create-automation-rule wird eine Automatisierungsregel für das aktuelle AWS-Konto und die AWS-Region erstellt. Security Hub filtert Ihre Ergebnisse anhand der angegebenen Kriterien und wendet die Aktionen auf übereinstimmende Ergebnisse an. Nur das Security-Hub-Administratorkonto kann diesen Befehl ausführen.

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-order 1 \ --rule-status "ENABLED"

Ausgabe:

{ "RuleArn": "arn:aws:securityhub:us-east-1:123456789012:automation-rule/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" }

Weitere Informationen finden Sie unter Automatisierungsregeln erstellen im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie create-configuration-policy verwendet wird.

AWS CLI

So erstellen Sie eine Konfigurationsrichtlinie

Im folgenden Beispiel für create-configuration-policy wird eine Konfigurationsrichtlinie mit den angegebenen Einstellungen erstellt.

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"}'

Ausgabe:

{ "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 } } } } ] } } } }

Weitere Informationen finden Sie unter Erstellen und Zuordnen von Security-Hub-Konfigurationsrichtlinien im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie create-finding-aggregator verwendet wird.

AWS CLI

So aktivieren Sie die Ergebnisaggregation

Im folgenden Beispiel für create-finding-aggregator wird die Ergebnisaggregation konfiguriert. Diese wird von US East (Virginia) aus ausgeführt, was US East (Virginia) als Aggregationsregion ausweist. Sie gibt an, dass nur bestimmte Regionen verknüpft werden und neue Regionen nicht automatisch verknüpft werden. Sie wählt USA West (Nordkalifornien) und USA West (Oregon) als die verknüpften Regionen aus.

aws securityhub create-finding-aggregator \ --region us-east-1 \ --region-linking-mode SPECIFIED_REGIONS \ --regions us-west-1,us-west-2

Ausgabe:

{ "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" }

Weitere Informationen finden Sie unter Aktivieren der Ergebnisaggregation im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie create-insight verwendet wird.

AWS CLI

So erstellen Sie einen benutzerdefinierten Insight

Im folgenden Beispiel für create-insight wird ein benutzerdefinierter Insight mit dem Namen 'Critical role findings' erstellt, der kritische Ergebnisse zurückgibt, die sich auf AWS-Rollen beziehen.

aws securityhub create-insight \ --filters '{"ResourceType": [{ "Comparison": "EQUALS", "Value": "AwsIamRole"}], "SeverityLabel": [{"Comparison": "EQUALS", "Value": "CRITICAL"}]}' \ --group-by-attribute "ResourceId" \ --name "Critical role findings"

Ausgabe:

{ "InsightArn": "arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" }

Weitere Informationen finden Sie unter Verwalten benutzerdefinierter Insights im AWS-Security-Hub-Benutzerhandbuch.

  • API-Details finden Sie unter CreateInsight in der AWS CLI-Befehlsreferenz.

Das folgende Codebeispiel zeigt, wie create-members verwendet wird.

AWS CLI

So fügen Sie Konten als Mitgliedskonten hinzu

Im folgenden Beispiel für create-members werden dem anfragenden Administratorkonto zwei Konten als Mitgliedskonten hinzugefügt.

aws securityhub create-members \ --account-details '[{"AccountId": "123456789111"}, {"AccountId": "123456789222"}]'

Ausgabe:

{ "UnprocessedAccounts": [] }

Weitere Informationen finden Sie unter Verwaltung von Administrator- und Mitgliedskonten im AWSSecurity-Hub-Benutzerhandbuch.

  • API-Details finden Sie unter CreateMembers in der AWS CLI-Befehlsreferenz.

Das folgende Codebeispiel zeigt, wie decline-invitations verwendet wird.

AWS CLI

So lehnen Sie eine Einladung als Mitgliedskonto ab

Im folgenden Beispiel für decline-invitations wird eine Einladung abgelehnt, Mitglied des angegebenen Administratorkontos zu werden. Das Mitgliedskonto ist das anfragende Konto.

aws securityhub decline-invitations \ --account-ids "123456789012"

Ausgabe:

{ "UnprocessedAccounts": [] }

Weitere Informationen finden Sie unter Verwaltung von Administrator- und Mitgliedskonten im AWSSecurity-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie delete-action-target verwendet wird.

AWS CLI

So löschen Sie eine benutzerdefinierte Aktion

Im folgenden Beispiel für delete-action-target wird die benutzerdefinierte Aktion gelöscht, die durch den angegebenen ARN identifiziert wurde.

aws securityhub delete-action-target \ --action-target-arn "arn:aws:securityhub:us-west-1:123456789012:action/custom/Remediation"

Ausgabe:

{ "ActionTargetArn": "arn:aws:securityhub:us-west-1:123456789012:action/custom/Remediation" }

Weitere Informationen finden Sie unter Erstellen einer benutzerdefinierten Aktion und Verknüpfung mit einer CloudWatch-Regel im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie delete-configuration-policy verwendet wird.

AWS CLI

So löschen Sie eine Konfigurationsrichtlinie

Im folgenden Beispiel für delete-configuration-policy wird die angegebene Konfigurationsrichtlinie gelöscht.

aws securityhub delete-configuration-policy \ --identifier "arn:aws:securityhub:eu-central-1:123456789012:configuration-policy/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Löschen von Security-Hub-Konfigurationsrichtlinien und Aufheben ihrer Zuordnung im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie delete-finding-aggregator verwendet wird.

AWS CLI

So beenden Sie die Ergebnisaggregation

Im folgenden Beispiel für delete-finding-aggregator wird die Ergebnisaggregation beendet. Dies wird von der Aggregationsregion US East (Virginia) aus ausgeführt.

aws securityhub delete-finding-aggregator \ --region us-east-1 \ --finding-aggregator-arn arn:aws:securityhub:us-east-1:222222222222:finding-aggregator/123e4567-e89b-12d3-a456-426652340000

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Beenden der Ergebnisaggregation im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie delete-insight verwendet wird.

AWS CLI

Löschen eines benutzerdefinierten Insight

Das folgende Beispiel für delete-insight beendet den benutzerdefinierten Insight mit dem angegebenen ARN.

aws securityhub delete-insight \ --insight-arn "arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"

Ausgabe:

{ "InsightArn": "arn:aws:securityhub:eu-central-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" }

Weitere Informationen finden Sie unter Verwalten benutzerdefinierter Insights im AWS-Security-Hub-Benutzerhandbuch.

  • API-Details finden Sie unter DeleteInsight in der AWS CLI-Befehlsreferenz.

Das folgende Codebeispiel zeigt, wie delete-invitations verwendet wird.

AWS CLI

So löschen Sie eine Einladung als Mitgliedskonto

Im folgenden Beispiel für delete-invitations wird eine Einladung gelöscht, ein Mitgliedskonto für das angegebene Administratorkonto zu werden. Das Mitgliedskonto ist das anfragende Konto.

aws securityhub delete-invitations \ --account-ids "123456789012"

Ausgabe:

{ "UnprocessedAccounts": [] }

Weitere Informationen finden Sie unter Verwaltung von Administrator- und Mitgliedskonten im AWSSecurity-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie delete-members verwendet wird.

AWS CLI

So löschen Sie Mitgliedskonten

Im folgenden Beispiel für delete-members werden die angegebenen Mitgliedskonten aus dem anfragenden Administratorkonto gelöscht.

aws securityhub delete-members \ --account-ids "123456789111" "123456789222"

Ausgabe:

{ "UnprocessedAccounts": [] }

Weitere Informationen finden Sie unter Verwaltung von Administrator- und Mitgliedskonten im AWSSecurity-Hub-Benutzerhandbuch.

  • API-Details finden Sie unter DeleteMembers in der AWS CLI-Befehlsreferenz.

Das folgende Codebeispiel zeigt, wie describe-action-targets verwendet wird.

AWS CLI

So rufen Sie Details zu benutzerdefinierten Aktionen ab

Im folgenden Beispiel für describe-action-targets werden Informationen über die benutzerdefinierte Aktion abgerufen, die durch den angegebenen ARN identifiziert wird.

aws securityhub describe-action-targets \ --action-target-arns "arn:aws:securityhub:us-west-1:123456789012:action/custom/Remediation"

Ausgabe:

{ "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" } ] }

Weitere Informationen finden Sie unter Erstellen einer benutzerdefinierten Aktion und Verknüpfung mit einer CloudWatch-Regel im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie describe-hub verwendet wird.

AWS CLI

So rufen Sie Informationen über eine Hub-Ressource ab

Im folgenden Beispiel für describe-hub wird das Abonnementdatum der angegebenen Hub-Ressource zurückgegeben. Die Hub-Ressource wird durch ihren ARN identifiziert.

aws securityhub describe-hub \ --hub-arn "arn:aws:securityhub:us-west-1:123456789012:hub/default"

Ausgabe:

{ "HubArn": "arn:aws:securityhub:us-west-1:123456789012:hub/default", "SubscribedAt": "2019-11-19T23:15:10.046Z" }

Weitere Informationen finden Sie unter AWS::SecurityHub::Hub im AWS-CloudFormation-Benutzerhandbuch.

  • API-Details finden Sie unter DescribeHub in der AWS CLI-Befehlsreferenz.

Das folgende Codebeispiel zeigt, wie describe-organization-configuration verwendet wird.

AWS CLI

So sehen Sie, wie Security Hub für eine Organisation konfiguriert ist

Im folgenden Beispiel für describe-organization-configuration werden Informationen darüber zurückgegeben, wie eine Organisation in Security Hub konfiguriert ist. In diesem Beispiel verwendet die Organisation die zentrale Konfiguration. Nur das Security-Hub-Administratorkonto kann diesen Befehl ausführen.

aws securityhub describe-organization-configuration

Ausgabe:

{ "AutoEnable": false, "MemberAccountLimitReached": false, "AutoEnableStandards": "NONE", "OrganizationConfiguration": { "ConfigurationType": "LOCAL", "Status": "ENABLED", "StatusMessage": "Central configuration has been enabled successfully" } }

Weitere Informationen finden Sie unter Verwalten von Konten mit AWS-Organisationen im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie describe-products verwendet wird.

AWS CLI

So geben Sie Informationen über verfügbare Produktintegrationen zurückzugeben

Im folgenden Beispiel für describe-products werden die verfügbaren Produktintegrationen nacheinander zurückgegeben.

aws securityhub describe-products \ --max-results 1

Ausgabe:

{ "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\"}}}]}" } ] }

Weitere Informationen finden Sie unter Verwalten von Produktintegrationen im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie describe-standards-controls verwendet wird.

AWS CLI

So rufen Sie die Liste der Kontrollen in einem aktivierten Standard ab

Im folgenden Beispiel für describe-standards-controls wird die Liste der Kontrollen abgerufen, die im Abonnement des PCI DSS-Standards des Anfordererkontos enthalten sind. Die Anforderung gibt jeweils zwei Kontrollen gleichzeitig zurück.

aws securityhub describe-standards-controls \ --standards-subscription-arn "arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1" \ --max-results 2

Ausgabe:

{ "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" }

Weitere Informationen finden Sie unter Anzeigen der Details von Kontrollen im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie describe-standards verwendet wird.

AWS CLI

So geben Sie eine Liste der verfügbaren Standards zurück

Im folgenden Beispiel für describe-standards wird die Liste der verfügbaren Standards zurückgegeben.

aws securityhub describe-standards

Ausgabe:

{ "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 } ] }

Weitere Informationen finden Sie unter Sicherheitsstandards in AWS-Security Hub im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie disable-import-findings-for-product verwendet wird.

AWS CLI

So beenden Sie den Empfang von Erkenntnissen aus einer Produktintegration

Im folgenden Beispiel für disable-import-findings-for-product wird der Ergebnisfluss für das angegebene Abonnement einer Produktintegration deaktiviert.

aws securityhub disable-import-findings-for-product \ --product-subscription-arn "arn:aws:securityhub:us-west-1:123456789012:product-subscription/crowdstrike/crowdstrike-falcon"

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Verwalten von Produktintegrationen im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie disable-organization-admin-account verwendet wird.

AWS CLI

So entfernen Sie ein Security-Hub-Administratorkonto

Im folgenden Beispiel für disable-organization-admin-account wird die Zuweisung des angegebenen Kontos als Security-Hub-Administratorkonto für AWS-Organizations widerrufen.

aws securityhub disable-organization-admin-account \ --admin-account-id 777788889999

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Festlegen eines Security-Hub-Administratorkontos im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie disable-security-hub verwendet wird.

AWS CLI

So deaktivieren Sie AWS-Security Hub

Im folgenden Beispiel für disable-security-hub wird AWS-Security Hub für das anfordernde Konto deaktiviert.

aws securityhub disable-security-hub

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Deaktivieren des AWS-Security Hub im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie disassociate-from-administrator-account verwendet wird.

AWS CLI

So trennen Sie die Verbindung zu einem Administratorkonto

Im folgenden Beispiel für disassociate-from-administrator-account wird das anfragende Konto von seinem aktuellen Administratorkonto getrennt.

aws securityhub disassociate-from-administrator-account

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Verwaltung von Administrator- und Mitgliedskonten im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie disassociate-from-master-account verwendet wird.

AWS CLI

So trennen Sie die Verbindung zu einem Administratorkonto

Im folgenden Beispiel für disassociate-from-master-account wird das anfragende Konto von seinem aktuellen Administratorkonto getrennt.

aws securityhub disassociate-from-master-account

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Verwaltung von Administrator- und Mitgliedskonten im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie disassociate-members verwendet wird.

AWS CLI

So trennen Sie die Zuordnung von Mitgliedskonten

Im folgenden Beispiel für disassociate-members werden die angegebenen Mitgliedskonten von dem anfragenden Administratorkonto getrennt.

aws securityhub disassociate-members \ --account-ids "123456789111" "123456789222"

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Verwaltung von Administrator- und Mitgliedskonten im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie enable-import-findings-for-product verwendet wird.

AWS CLI

So beginnen Sie den Empfang von Erkenntnissen aus einer Produktintegration

Im folgenden Beispiel für enable-import-findings-for-product wird der Ergebnisfluss aus der angegebenen Produktintegration aktiviert.

aws securityhub enable-import-findings-for-product \ --product-arn "arn:aws:securityhub:us-east-1:123456789333:product/crowdstrike/crowdstrike-falcon"

Ausgabe:

{ "ProductSubscriptionArn": "arn:aws:securityhub:us-east-1:123456789012:product-subscription/crowdstrike/crowdstrike-falcon" }

Weitere Informationen finden Sie unter Verwalten von Produktintegrationen im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie enable-organization-admin-account verwendet wird.

AWS CLI

So legen Sie ein Organisationskonto als Security-Hub-Administratorkonto fest

Im folgenden Beispiel für enable-organization-admin-account wird das angegebene Konto als Security-Hub-Administratorkonto festgelegt.

aws securityhub enable-organization-admin-account \ --admin-account-id 777788889999

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Festlegen eines Security-Hub-Administratorkontos im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie enable-security-hub verwendet wird.

AWS CLI

So aktivieren Sie AWS-Security Hub

Im folgenden Beispiel für enable-security-hub wird AWS-Security Hub für das anfordernde Konto aktiviert. Security Hub wird so konfiguriert, dass die Standardstandards aktiviert werden. Für die Hub-Ressource der Wert Security zum Tag Department zugewiesen.

aws securityhub enable-security-hub \ --enable-default-standards \ --tags '{"Department": "Security"}'

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Aktivierung von Security Hub im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie get-administrator-account verwendet wird.

AWS CLI

So rufen Sie Informationen über ein Administratorkonto ab

Im folgenden Beispiel für get-administrator-account werden Informationen zum Administratorkonto für das anfordernde Konto abgerufen.

aws securityhub get-administrator-account

Ausgabe:

{ "Master": { "AccountId": "123456789012", "InvitationId": "7ab938c5d52d7904ad09f9e7c20cc4eb", "InvitedAt": 2020-06-01T20:21:18.042000+00:00, "MemberStatus": "ASSOCIATED" } }

Weitere Informationen finden Sie unter Verwaltung von Administrator- und Mitgliedskonten im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie get-configuration-policy-association verwendet wird.

AWS CLI

So rufen Sie Details zur Konfigurationszuweisung für ein Ziel ab

Im folgenden Beispiel für get-configuration-policy-association werden Zuweisungsdetails für das angegebene Ziel abgerufen. Sie können eine Konto-ID, Organisationseinheiten-ID oder die Stamm-ID für das Ziel angeben.

aws securityhub get-configuration-policy-association \ --target '{"OrganizationalUnitId": "ou-6hi7-8j91kl2m"}'

Ausgabe:

{ "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." }

Weitere Informationen finden Sie unter Anzeigen von Security-Hub-Konfigurationsrichtlinien im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie get-configuration-policy verwendet wird.

AWS CLI

So zeigen Sie Details zur Konfigurationsrichtlinie an

Im folgenden Beispiel für get-configuration-policy werden Details zur angegebenen Konfigurationsrichtlinie abgerufen.

aws securityhub get-configuration-policy \ --identifier "arn:aws:securityhub:eu-central-1:123456789012:configuration-policy/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"

Ausgabe:

{ "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 } } } } ] } } } }

Weitere Informationen finden Sie unter Anzeigen von Security-Hub-Konfigurationsrichtlinien im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie get-enabled-standards verwendet wird.

AWS CLI

So rufen Sie Informationen über einen aktivierten Standard ab

Im folgenden Beispiel für get-enabled-standards werden Informationen über den PCI DSS-Standard abgerufen.

aws securityhub get-enabled-standards \ --standards-subscription-arn "arn:aws:securityhub:us-west-1:123456789012:subscription/pci-dss/v/3.2.1"

Ausgabe:

{ "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" } ] }

Weitere Informationen finden Sie unter Sicherheitsstandards in AWS-Security Hub im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie get-finding-aggregator verwendet wird.

AWS CLI

So rufen Sie die aktuelle Konfiguration der Ergebnisaggregation ab

Im folgenden Beispiel für get-finding-aggregator wird die aktuelle Ergebnisaggregationskonfiguration abgerufen.

aws securityhub get-finding-aggregator \ --finding-aggregator-arn arn:aws:securityhub:us-east-1:222222222222:finding-aggregator/123e4567-e89b-12d3-a456-426652340000

Ausgabe:

{ "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" }

Weitere Informationen finden Sie unter Anzeigen der aktuellen Ergebnisaggregationskonfiguration im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie get-finding-history verwendet wird.

AWS CLI

So rufen Sie den Suchverlauf ab

Im folgenden Beispiel für get-finding-history wird der Verlauf der maximal letzten 90 Tage für das angegebene Ergebnis abgerufen. In diesem Beispiel sind die Ergebnisse auf zwei Datensätze mit Ergebnisverlauf beschränkt.

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"

Ausgabe:

{ "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": [] } ] }

Weitere Informationen finden Sie unter Ergebnisverlauf im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie get-findings verwendet wird.

AWS CLI

Beispiel 1: So geben Sie Ergebnisse zurück, die für einen bestimmten Standard generiert wurden

Im folgenden Beispiel für get-findings werden Ergebnisse für den PCI-DSS-Standard zurückgegeben.

aws securityhub get-findings \ --filters '{"GeneratorId":[{"Value": "pci-dss","Comparison":"PREFIX"}]}' \ --max-items 1

Ausgabe:

{ "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==" }

Beispiel 2: So geben Sie Ergebnisse mit kritischem Schweregrad zurück, die den Workflow-Status NOTIFIED haben

Im folgenden Beispiel für get-findings werden Ergebnisse zurückgegeben, deren Schweregrad den Wert CRITICAL und den Workflow-Status NOTIFIED haben. Die Ergebnisse sind in absteigender Reihenfolge nach dem Wert 'Wahrscheinlichkeit' sortiert.

aws securityhub get-findings \ --filters '{"SeverityLabel":[{"Value": "CRITICAL","Comparison":"EQUALS"}],"WorkflowStatus": [{"Value":"NOTIFIED","Comparison":"EQUALS"}]}' \ --sort-criteria '{ "Field": "Confidence", "SortOrder": "desc"}' \ --max-items 1

Ausgabe:

{ "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" } ] }

Weitere Informationen finden Sie unter Ergebnisse filtern und gruppieren im AWS-Security-Hub-Benutzerhandbuch.

  • API-Details finden Sie unter GetFindings in der AWS CLI-Befehlsreferenz.

Das folgende Codebeispiel zeigt, wie get-insight-results verwendet wird.

AWS CLI

So rufen Sie die Ergebnisse eines Insights ab

Im folgenden Beispiel für get-insight-results wird die Liste der Insight-Ergebnisse für den Insight mit dem angegebenen ARN zurückgegeben.

aws securityhub get-insight-results \ --insight-arn "arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"

Ausgabe:

{ "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" } ] } }

Weitere Informationen finden Sie unter Anzeigen von Insight-Ergebnissen und -Resultaten und Ergreifen geeigneter Maßnahmen im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie get-insights verwendet wird.

AWS CLI

So rufen Sie Details zu einem Insight ab

Im folgenden Beispiel für get-insights werden die Konfigurationsdetails zu dem angegebenen Insight mit dem angegebenen ARN abgerufen.

aws securityhub get-insights \ --insight-arns "arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"

Ausgabe:

{ "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" } ] }

Weitere Informationen finden Sie unter Insights im AWS-Security Hub im AWS-Security-Hub-Benutzerhandbuch.

  • API-Details finden Sie unter GetInsights in der AWS CLI-Befehlsreferenz.

Das folgende Codebeispiel zeigt, wie get-invitations-count verwendet wird.

AWS CLI

So rufen Sie die Anzahl der Einladungen ab, die nicht akzeptiert wurden

Im folgenden Beispiel für get-invitations-count wird die Anzahl der Einladungen abgerufen, die das anfragende Konto abgelehnt hat oder auf die es nicht geantwortet hat.

aws securityhub get-invitations-count

Ausgabe:

{ "InvitationsCount": 3 }

Weitere Informationen finden Sie unter Verwaltung von Administrator- und Mitgliedskonten im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie get-master-account verwendet wird.

AWS CLI

So rufen Sie Informationen über ein Administratorkonto ab

Im folgenden Beispiel für get-master-account werden Informationen zum Administratorkonto für das anfordernde Konto abgerufen.

aws securityhub get-master-account

Ausgabe:

{ "Master": { "AccountId": "123456789012", "InvitationId": "7ab938c5d52d7904ad09f9e7c20cc4eb", "InvitedAt": 2020-06-01T20:21:18.042000+00:00, "MemberStatus": "ASSOCIATED" } }

Weitere Informationen finden Sie unter Verwaltung von Administrator- und Mitgliedskonten im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie get-members verwendet wird.

AWS CLI

So rufen Sie Informationen über ausgewählte Mitgliedskonten ab

Im folgenden Beispiel für get-members werden Informationen zu den angegebenen Mitgliedskonten abgerufen.

aws securityhub get-members \ --account-ids "444455556666" "777788889999"

Ausgabe:

{ "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": [ ] }

Weitere Informationen finden Sie unter Verwaltung von Administrator- und Mitgliedskonten im AWS-Security-Hub-Benutzerhandbuch.

  • API-Details finden Sie unter GetMembers in der AWS CLI-Befehlsreferenz.

Das folgende Codebeispiel zeigt, wie get-security-control-definition verwendet wird.

AWS CLI

So rufen Sie Definitionen der Sicherheitskontrolle ab

Im folgenden Beispiel für get-security-control-definition werden Definitionsdetails für eine Security-Hub-Sicherheitskontrolle abgerufen. Zu den Details gehören der Titel der Kontrolle, deren Beschreibung, Verfügbarkeit in der Region, Parameter und andere Informationen.

aws securityhub get-security-control-definition \ --security-control-id ACM.1

Ausgabe:

{ "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 } } } } } }

Weitere Informationen finden Sie unter Benutzerdefinierte Kontrollparameter im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie invite-members verwendet wird.

AWS CLI

So senden Sie Einladungen an Mitgliedskonten

Im folgenden Beispiel für invite-members werden Einladungen an die angegebenen Mitgliedskonten gesendet.

aws securityhub invite-members \ --account-ids "123456789111" "123456789222"

Ausgabe:

{ "UnprocessedAccounts": [] }

Weitere Informationen finden Sie unter Verwaltung von Administrator- und Mitgliedskonten im AWS-Security-Hub-Benutzerhandbuch.

  • API-Details finden Sie unter InviteMembers in der AWS CLI-Befehlsreferenz.

Das folgende Codebeispiel zeigt, wie list-automation-rules verwendet wird.

AWS CLI

So zeigen Sie eine Liste von Automatisierungsregeln an

Im folgenden Beispiel für list-automation-rules werden die Automatisierungsregeln für ein AWS-Konto aufgelistet. Nur das Security-Hub-Administratorkonto kann diesen Befehl ausführen.

aws securityhub list-automation-rules \ --max-results 3 \ --next-token NULL

Ausgabe:

{ "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" } ] }

Weitere Informationen finden Sie unter Anzeigen von Automatisierungsregeln im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie list-configuration-policies verwendet wird.

AWS CLI

So listen Sie Zusammenfassungen der Konfigurationsrichtlinien auf

Im folgenden Beispiel für list-configuration-policies wird eine Zusammenfassung der Konfigurationsrichtlinien für die Organisation aufgelistet.

aws securityhub list-configuration-policies \ --max-items 3

Ausgabe:

{ "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 } }

Weitere Informationen finden Sie unter Anzeigen von Security-Hub-Konfigurationsrichtlinien im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie list-configuration-policy-associations verwendet wird.

AWS CLI

So listen Sie die Konfigurationszuordnungen auf

Im folgenden Beispiel für list-configuration-policy-associations wird eine Zusammenfassung der Konfigurationszuordnungen für die Organisation aufgelistet. Die Antwort beinhaltet Verknüpfungen zu Konfigurationsrichtlinien und selbstverwaltetem Verhalten.

aws securityhub list-configuration-policy-associations \ --filters '{"AssociationType": "APPLIED"}' \ --max-items 4

Ausgabe:

{ "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" } }

Weitere Informationen finden Sie unter Status und Details der Konfigurationsrichtlinie anzeigen im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie list-enabled-products-for-import verwendet wird.

AWS CLI

So geben Sie die Liste der aktivierten Produktintegrationen zurück

Im folgenden Beispiel für list-enabled-products-for-import wird die Liste der Abonnement-ARNS für die aktuell aktivierten Produktintegrationen zurückgegeben.

aws securityhub list-enabled-products-for-import

Ausgabe:

{ "ProductSubscriptions": [ "arn:aws:securityhub:us-west-1:123456789012:product-subscription/crowdstrike/crowdstrike-falcon", "arn:aws:securityhub:us-west-1:123456789012:product-subscription/aws/securityhub" ] }

Weitere Informationen finden Sie unter Verwalten von Produktintegrationen im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie list-finding-aggregators verwendet wird.

AWS CLI

So listen Sie die verfügbaren Widgets auf

Im folgenden Beispiel für list-finding-aggregators wird der ARN der Ergebnisaggregation zurückgegeben.

aws securityhub list-finding-aggregators

Ausgabe:

{ "FindingAggregatorArn": "arn:aws:securityhub:us-east-1:222222222222:finding-aggregator/123e4567-e89b-12d3-a456-426652340000" }

Weitere Informationen finden Sie unter Anzeigen der aktuellen Ergebnisaggregationskonfiguration im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie list-invitations verwendet wird.

AWS CLI

So zeigen Sie eine Liste mit Einladungen an

Im folgenden Beispiel für list-invitations wird die Liste der Einladungen abgerufen, die an das anfragende Konto gesendet wurden.

aws securityhub list-invitations

Ausgabe:

{ "Invitations": [ { "AccountId": "123456789012", "InvitationId": "7ab938c5d52d7904ad09f9e7c20cc4eb", "InvitedAt": 2020-06-01T20:21:18.042000+00:00, "MemberStatus": "ASSOCIATED" } ], }

Weitere Informationen finden Sie unter Verwaltung von Administrator- und Mitgliedskonten im AWS-Security-Hub-Benutzerhandbuch.

  • API-Details finden Sie unter ListInvitations in der AWS CLI-Befehlsreferenz.

Das folgende Codebeispiel zeigt, wie list-members verwendet wird.

AWS CLI

So rufen Sie eine Liste von Mitgliedskonten ab

Im folgenden Beispiel für list-members wird die Liste der Mitgliedskonten für das anfragende Administratorkonto zurückgegeben.

aws securityhub list-members

Ausgabe:

{ "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 } ], }

Weitere Informationen finden Sie unter Verwaltung von Administrator- und Mitgliedskonten im AWS-Security-Hub-Benutzerhandbuch.

  • API-Details finden Sie unter ListMembers in der AWS CLI-Befehlsreferenz.

Das folgende Codebeispiel zeigt, wie list-organization-admin-accounts verwendet wird.

AWS CLI

So listen Sie die designierten Security-Hub-Administratorkonten auf

Im folgenden Beispiel für list-organization-admin-accounts werden die Security-Hub-Administratorkonten für eine Organisation aufgelistet.

aws securityhub list-organization-admin-accounts

Ausgabe:

{ AdminAccounts": [ { "AccountId": "777788889999" }, { "Status": "ENABLED" } ] }

Weitere Informationen finden Sie unter Festlegen eines Security-Hub-Administratorkontos im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie list-security-control-definitions verwendet wird.

AWS CLI

Beispiel 1: So listen Sie alle verfügbaren Sicherheitskontrollen auf

Im folgenden Beispiel für list-security-control-definitions werden die verfügbaren Sicherheitskontrollen für alle Security-Hub-Standards aufgelistet. In diesem Beispiel werden die Ergebnisse auf drei Kontrollen beschränkt.

aws securityhub list-security-control-definitions \ --max-items 3

Ausgabe:

{ "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==" }

Weitere Informationen finden Sie unter Anzeigen von Details für einen Standard im AWS-Security-Hub-Benutzerhandbuch.

Beispiel 2: So listen Sie die verfügbaren Sicherheitskontrollen für einen bestimmten Standard auf

Im folgenden Beispiel für list-security-control-definitions werden die verfügbaren Sicherheitskontrollen für den CIS-AWS-Foundations Benchmark v1.4.0 aufgelistet In diesem Beispiel werden die Ergebnisse auf drei Kontrollen beschränkt.

aws securityhub list-security-control-definitions \ --standards-arn "arn:aws:securityhub:us-east-1::standards/cis-aws-foundations-benchmark/v/1.4.0" \ --max-items 3

Ausgabe:

{ "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==" }

Weitere Informationen finden Sie unter Anzeigen von Details für einen Standard im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie list-standards-control-associations verwendet wird.

AWS CLI

So rufen Sie den Aktivierungsstatus einer Kontrolle in jedem aktivierten Standards ab

Im folgenden Beispiel für list-standards-control-associations wird der Aktivierungsstatus von CloudTrail.1 in jedem aktivierten Standard aufgelistet.

aws securityhub list-standards-control-associations \ --security-control-id CloudTrail.1

Ausgabe:

{ "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)." } ] }

Weitere Informationen finden Sie unter Aktivieren und Deaktivieren von Kontrollen in bestimmten Standards im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie list-tags-for-resource verwendet wird.

AWS CLI

So rufen Sie Tags ab, die einer Ressource zugewiesen sind

Im folgenden Beispiel für list-tags-for-resource werden die Tags abgerufen, die der angegebenen Hub-Ressource zugeordnet sind.

aws securityhub list-tags-for-resource \ --resource-arn "arn:aws:securityhub:us-west-1:123456789012:hub/default"

Ausgabe:

{ "Tags": { "Department" : "Operations", "Area" : "USMidwest" } }

Weitere Informationen finden Sie unter AWS::SecurityHub::Hub im AWS-CloudFormation-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie start-configuration-policy-association verwendet wird.

AWS CLI

Beispiel 1: So ordnen Sie eine Konfigurationsrichtlinie zu

Im folgenden Beispiel für start-configuration-policy-association wird die angegebene Konfigurationsrichtlinie der angegebenen Organisationseinheit zugeordnet. Eine Konfiguration kann einem Zielkonto, einer Organisationseinheit oder dem Stammkonto zugeordnet werden.

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"}'

Ausgabe:

{ "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" }

Weitere Informationen finden Sie unter Erstellen und Zuordnen von Security-Hub-Konfigurationsrichtlinien im AWS-Security-Hub-Benutzerhandbuch.

Beispiel 2: So ordnen Sie eine selbstverwaltete Konfiguration zu

Im folgenden Beispiel für start-configuration-policy-association wird dem angegebenen Konto eine selbstverwaltete Konfiguration zugeordnet.

aws securityhub start-configuration-policy-association \ --configuration-policy-identifier "SELF_MANAGED_SECURITY_HUB" \ --target '{"OrganizationalUnitId": "123456789012"}'

Ausgabe:

{ "ConfigurationPolicyId": "SELF_MANAGED_SECURITY_HUB", "TargetId": "123456789012", "TargetType": "ACCOUNT", "AssociationType": "APPLIED", "UpdatedAt": "2023-11-29T17:40:52.468000+00:00", "AssociationStatus": "PENDING" }

Weitere Informationen finden Sie unter Erstellen und Zuordnen von Security-Hub-Konfigurationsrichtlinien im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie start-configuration-policy-disassociation verwendet wird.

AWS CLI

Beispiel 1: So trennen Sie die Zuordnung einer Konfigurationsrichtlinie

Im folgenden Beispiel für start-configuration-policy-disassociation wird die Zuordnung einer Konfigurationsrichtlinie zur angegebenen Organisationseinheit aufgehoben. Eine Konfiguration kann von einem Zielkonto, einer organisatorischen Einheit oder dem Stammkonto getrennt werden.

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"}'

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Trennen einer Konfiguration von Konten und Organisationseinheiten im AWS-Security-Hub-Benutzerhandbuch.

Beispiel 2: So trennen Sie die Zuordnung einer selbstverwalteten Konfiguration

Im folgenden Beispiel für start-configuration-policy-disassociation wird die Zuordnung einer selbstverwalteten Konfiguration zum angegebenen Konto aufgehoben.

aws securityhub start-configuration-policy-disassociation \ --configuration-policy-identifier "SELF_MANAGED_SECURITY_HUB" \ --target '{"AccountId": "123456789012"}'

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Trennen einer Konfiguration von Konten und Organisationseinheiten im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie tag-resource verwendet wird.

AWS CLI

So weisen Sie einer Ressource einen Tag zu

Im folgenden Beispiel für tag-resource werden der angegebenen Hub-Ressource Werte für die Tags 'Abteilung' und 'Gebiet' zugewiesen.

aws securityhub tag-resource \ --resource-arn "arn:aws:securityhub:us-west-1:123456789012:hub/default" \ --tags '{"Department":"Operations", "Area":"USMidwest"}'

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter AWS::SecurityHub::Hub im AWS-CloudFormation-Benutzerhandbuch.

  • API-Details finden Sie unter TagResource in der AWS CLI-Befehlsreferenz.

Das folgende Codebeispiel zeigt, wie untag-resource verwendet wird.

AWS CLI

So entfernen Sie ein Tag-Wert aus einer Ressource

Im folgenden Beispiel für untag-resource wird der Tag 'Abteilung' aus der angegebenen Hub-Ressource entfernt.

aws securityhub untag-resource \ --resource-arn "arn:aws:securityhub:us-west-1:123456789012:hub/default" \ --tag-keys "Department"

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter AWS::SecurityHub::Hub im AWS-CloudFormation-Benutzerhandbuch.

  • API-Details finden Sie unter UntagResource in der AWS CLI-Befehlsreferenz.

Das folgende Codebeispiel zeigt, wie update-action-target verwendet wird.

AWS CLI

So aktualisieren Sie eine benutzerdefinierte Aktion

Im folgenden Beispiel für update-action-target wird die benutzerdefinierte Aktion aktualisiert, die durch den angegebenen ARN identifiziert wurde.

aws securityhub update-action-target \ --action-target-arn "arn:aws:securityhub:us-west-1:123456789012:action/custom/Remediation" \ --name "Send to remediation"

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Erstellen einer benutzerdefinierten Aktion und Verknüpfung mit einer CloudWatch-Regel im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie update-configuration-policy verwendet wird.

AWS CLI

So aktualisieren Sie eine Konfigurationsrichtlinie

Im folgenden Beispiel für update-configuration-policy wird eine vorhandene Konfigurationsrichtlinie aktualisiert, sodass sie die angegebenen Einstellungen verwendet.

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"

Ausgabe:

{ "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 } } } } ] } } } }

Weitere Informationen finden Sie unter Aktualisieren von Security-Hub-Konfigurationsrichtlinien im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie update-finding-aggregator verwendet wird.

AWS CLI

So aktualisieren Sie die aktuelle Konfiguration der Ergebnisaggregation

Im folgenden Beispiel für update-finding-aggregator wird die Konfiguration der Ergebnisaggregation so geändert, dass aus ausgewählten Regionen darauf verwiesen wird. Dies wird von der Aggregationsregion US East (Virginia) aus ausgeführt. Sie wählt USA West (Nordkalifornien) und USA West (Oregon) als die verknüpften Regionen aus.

aws securityhub update-finding-aggregator \ --region us-east-1 \ --finding-aggregator-arn arn:aws:securityhub:us-east-1:222222222222:finding-aggregator/123e4567-e89b-12d3-a456-426652340000 \ --region-linking-mode SPECIFIED_REGIONS \ --regions us-west-1,us-west-2

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Aktualisieren der aktuellen Ergebnisaggregationskonfiguration im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie update-insight verwendet wird.

AWS CLI

Beispiel 1: So ändern Sie den Filter für einen benutzerdefinierten Insight

Im folgenden Beispiel für update-insight werden die Filter für einen benutzerdefinierten Insight geändert. Der aktualisierte Insight sucht nach Ergebnissen mit einem hohen Schweregrad, die sich auf AWS-Rollen beziehen.

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"

Beispiel 2: So ändern Sie das Gruppierungsattribut für einen benutzerdefinierten Insight

Im folgenden Beispiel für update-insight wird das Gruppierungsattribut für den benutzerdefinierten Insight mit dem angegebenen ARN geändert. Das neue Gruppierungsattribut ist die Ressourcen-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"

Ausgabe:

{ "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" } ] }

Weitere Informationen finden Sie unter Verwalten benutzerdefinierter Insights im AWS-Security-Hub-Benutzerhandbuch.

  • API-Details finden Sie unter UpdateInsight in der AWS CLI-Befehlsreferenz.

Das folgende Codebeispiel zeigt, wie update-organization-configuration verwendet wird.

AWS CLI

So aktualisieren Sie die Konfiguration von Security Hub für eine Organisation

Im folgenden Beispiel für update-organization-configuration wird festgelegt, dass Security Hub die zentrale Konfiguration verwenden soll, um eine Organisation zu konfigurieren. Nach der Ausführung dieses Befehls kann der delegierte Security-Hub-Administrator Konfigurationsrichtlinien zur Konfiguration der Organisation erstellen und verwalten. Der delegierte Administrator kann diesen Befehl auch verwenden, um von der zentralen zur lokalen Konfiguration zu wechseln. Wenn die lokale Konfiguration der Konfigurationstyp ist, kann der delegierte Administrator wählen, ob Security Hub und Standardsicherheitsstandards in neuen Unternehmenskonten automatisch aktiviert werden sollen.

aws securityhub update-organization-configuration \ --no-auto-enable \ --organization-configuration '{"ConfigurationType": "CENTRAL"}'

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Verwalten von Konten mit AWS-Organisationen im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie update-security-control verwendet wird.

AWS CLI

So aktualisieren Sie die Eigenschaften der Sicherheitskontrolle

Im folgenden Beispiel für update-security-control werden benutzerdefinierte Werte für einen Security-Hub-Sicherheitskontrollparameter angegeben.

aws securityhub update-security-control \ --security-control-id ACM.1 \ --parameters '{"daysToExpiration": {"ValueType": "CUSTOM", "Value": {"Integer": 15}}}' \ --last-update-reason "Internal compliance requirement"

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Benutzerdefinierte Kontrollparameter im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie update-security-hub-configuration verwendet wird.

AWS CLI

So aktualisieren Sie die Security-Hub-Konfiguration

Im folgenden Beispiel für update-security-hub-configuration wird Security Hub so konfiguriert, dass neue Steuerelemente für aktivierte Standards automatisch aktiviert werden.

aws securityhub update-security-hub-configuration \ --auto-enable-controls

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Automatisches Aktivieren neuer Kontrollen im AWS-Security-Hub-Benutzerhandbuch.

Das folgende Codebeispiel zeigt, wie update-standards-control verwendet wird.

AWS CLI

Beispiel 1: So deaktivieren Sie eine Kontrolle

Im folgenden Beispiel für update-standards-control wird die PCI.AutoScaling.1-Kontrolle deaktiviert.

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"

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Beispiel 2: So aktivieren Sie eine Kontrolle

Im folgenden Beispiel für update-standards-control wird die PCI.AutoScaling.1-Kontrolle aktiviert.

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"

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

Weitere Informationen finden Sie unter Aktivieren und Deaktivieren einzelner Kontrollen im AWS-Security-Hub-Benutzerhandbuch.