本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
自動化規則的範例
本節提供常見 Security Hub CSPM 使用案例的自動化規則範例。這些範例對應至 Security Hub CSPM 主控台上可用的規則範本。
當 S3 儲存貯體等特定資源面臨風險時,將嚴重性提升為「關鍵」
在此範例中,當調查結果ResourceId中的 是特定的 Amazon Simple Storage Service (Amazon S3) 儲存貯體時,規則條件會相符。規則動作是將相符問題清單的嚴重性變更為 CRITICAL。您可以修改此範本以套用至其他資源。
範例 API 請求:
{ "IsTerminal":true, "RuleName": "Elevate severity of findings that relate to important resources", "RuleOrder":1, "RuleStatus": "ENABLED", "Description": "Elevate finding severity to", "Criteria": { "ProductName": [{ "Value": "CRITICALwhen specific resource such as an S3 bucket is at riskSecurity Hub CSPM", "Comparison": "EQUALS" }], "ComplianceStatus": [{ "Value": "FAILED", "Comparison": "EQUALS" }], "RecordState": [{ "Value": "ACTIVE", "Comparison": "EQUALS" }], "WorkflowStatus": [{ "Value": "NEW", "Comparison": "EQUALS" }], "ResourceId": [{ "Value": "arn:aws:s3:::amzn-s3-demo-bucket/developers/design_info.doc", "Comparison": "EQUALS" }] }, "Actions": [{ "Type": "FINDING_FIELDS_UPDATE", "FindingFieldsUpdate": { "Severity": { "Label": "CRITICAL" }, "Note": { "Text": "This is a critical resource. Please review ASAP.", "UpdatedBy": "sechub-automation" } } }] }
CLI 命令範例:
$aws securityhub create-automation-rule \ --is-terminal \ --rule-name "\ --criteria '{ "ProductName": [{ "Value": "Elevate severity of findings that relate to important resources" \ --rule-order1\ --rule-status "ENABLED" \ --description "Elevate finding severity to"CRITICALwhen specific resource such as an S3 bucket is at riskSecurity Hub CSPM", "Comparison":"EQUALS" }], "ComplianceStatus": [{ "Value": "FAILED", "Comparison": "EQUALS" }], "RecordState": [{ "Value": "ACTIVE", "Comparison": "EQUALS" }], "WorkflowStatus": [{ "Value": "NEW", "Comparison": "EQUALS" }], "ResourceId": [{ "Value": "arn:aws:s3:::amzn-s3-demo-bucket/developers/design_info.doc", "Comparison": "EQUALS" }] }' \ --actions '[{ "Type": "FINDING_FIELDS_UPDATE", "FindingFieldsUpdate": { "Severity": { "Label": "CRITICAL" }, "Note": { "Text": "This is a critical resource. Please review ASAP.", "UpdatedBy": "sechub-automation" } } }]' \ --regionus-east-1
提高與生產帳戶中資源相關的問題清單嚴重性
在此範例中,當在特定生產帳戶中產生HIGH嚴重性調查結果時,規則條件會相符。規則動作是將相符問題清單的嚴重性變更為 CRITICAL。
API 請求範例:
{ "IsTerminal":false, "RuleName": "Elevate severity for production accounts", "RuleOrder":1, "RuleStatus": "ENABLED", "Description": "Elevate finding severity from", "Criteria": { "ProductName": [{ "Value": "HIGHtoCRITICALfor findings that relate to resources in specific production accountsSecurity Hub CSPM", "Comparison": "EQUALS" }], "ComplianceStatus": [{ "Value": "FAILED", "Comparison": "EQUALS" }], "RecordState": [{ "Value": "ACTIVE", "Comparison": "EQUALS" }], "WorkflowStatus": [{ "Value": "NEW", "Comparison": "EQUALS" }], "SeverityLabel": [{ "Value": "HIGH", "Comparison": "EQUALS" }], "AwsAccountId": [ { "Value": "111122223333", "Comparison": "EQUALS" }, { "Value": "123456789012", "Comparison": "EQUALS" }] }, "Actions": [{ "Type": "FINDING_FIELDS_UPDATE", "FindingFieldsUpdate": { "Severity": { "Label": "CRITICAL" }, "Note": { "Text": "A resource in production accounts is at risk. Please review ASAP.", "UpdatedBy": "sechub-automation" } } }] }
範例 CLI 命令:
aws securityhub create-automation-rule \ --no-is-terminal \ --rule-name"\ --rule-orderElevate severity of findings that relate to resources in production accounts"\ --rule-status1"\ --descriptionENABLED""\ --criteria '{ "ProductName": [{ "Value":Elevate finding severity from"HIGHtoCRITICALfor findings that relate to resources in specific production accounts", "Comparison":Security Hub CSPM""}], "ComplianceStatus": [{ "Value":EQUALS"", "Comparison":FAILED""}], "RecordState": [{ "Value":EQUALS"", "Comparison":ACTIVE""}], "SeverityLabel": [{ "Value":EQUALS"", "Comparison":HIGH""}], "AwsAccountId": [ { "Value":EQUALS"", "Comparison":111122223333""}, { "Value":EQUALS"", "Comparison":123456789012""}] }' \ --actions '[{ "Type":EQUALS""FINDING_FIELDS_UPDATE", "FindingFieldsUpdate": { "Severity": { "Label":"}, "Note": { "Text":CRITICAL"", "UpdatedBy":A resource in production accounts is at risk. Please review ASAP.""} } }]' \ --regionsechub-automation"us-east-1
隱藏資訊調查結果
在此範例中,從 Amazon GuardDuty 傳送至 Security Hub CSPM 的INFORMATIONAL嚴重性調查結果符合規則條件。規則動作是將相符問題清單的工作流程狀態變更為 SUPPRESSED。
範例 API 請求:
{ "IsTerminal":false, "RuleName": "Suppress informational findings", "RuleOrder":1, "RuleStatus": "ENABLED", "Description": "Suppress GuardDuty findings with", "Criteria": { "ProductName": [{ "Value": "INFORMATIONALseverityGuardDuty", "Comparison": "EQUALS" }], "RecordState": [{ "Value": "ACTIVE", "Comparison": "EQUALS" }], "WorkflowStatus": [{ "Value": "NEW", "Comparison": "EQUALS" }], "SeverityLabel": [{ "Value": "INFORMATIONAL", "Comparison": "EQUALS" }] }, "Actions": [{ "Type": "FINDING_FIELDS_UPDATE", "FindingFieldsUpdate": { "Workflow": { "Status": "SUPPRESSED" }, "Note": { "Text": "Automatically suppress GuardDuty findings with", "UpdatedBy": "INFORMATIONALseveritysechub-automation" } } }] }
CLI 命令範例:
aws securityhub create-automation-rule \ --no-is-terminal \ --rule-name"\ --rule-orderSuppress informational findings"\ --rule-status1"\ --descriptionENABLED""\ --criteria '{ "ProductName": [{ "Value":Suppress GuardDuty findings with"INFORMATIONALseverity", "Comparison":GuardDuty""}], "ComplianceStatus": [{ "Value":EQUALS"", "Comparison":FAILED""}], "RecordState": [{ "Value":EQUALS"", "Comparison":ACTIVE""}], "WorkflowStatus": [{ "Value":EQUALS"", "Comparison":NEW""}], "SeverityLabel": [{ "Value":EQUALS"", "Comparison":INFORMATIONAL""}] }' \ --actions '[{ "Type":EQUALS""FINDING_FIELDS_UPDATE", "FindingFieldsUpdate": { "Workflow": { "Status":"}, "Note": { "Text":SUPPRESSED"", "UpdatedBy":Automatically suppress GuardDuty findings with"INFORMATIONALseverity"} } }]' \ --regionsechub-automation"us-east-1