

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 了解 Security Hub CSPM 中的自訂洞見
<a name="securityhub-custom-insights"></a>

除了 AWS Security Hub CSPM 受管洞察之外，您還可以在 Security Hub CSPM 中建立自訂洞察，以追蹤您環境特有的問題。自訂洞見可協助您追蹤精選的問題子集。

以下是一些自訂洞見的範例，可能有助於設定：
+ 如果您擁有管理員帳戶，您可以設定自訂洞見來追蹤影響成員帳戶的關鍵和高嚴重性問題清單。
+ 如果您依賴特定的[整合 AWS 服務](securityhub-internal-providers.md)，您可以設定自訂洞見，以追蹤該服務的關鍵和高嚴重性問題清單。
+ 如果您依賴[第三方整合](securityhub-partner-providers.md)，您可以設定自訂洞見，以追蹤該整合產品的關鍵和高嚴重性問題清單。

您可以建立全新的自訂洞見，或從現有的自訂或受管洞見開始。

您可以使用下列選項設定每個洞見：
+ **分組屬性** – 分組屬性會決定洞見結果清單中顯示的項目。例如，如果分組屬性是**產品名稱**，洞見結果會顯示與每個調查結果提供者相關聯的調查結果數量。
+ **選用篩選條件** – 篩選條件縮小了洞見的相符調查結果範圍。

  只有當問題清單符合所有提供的篩選條件時，問題清單才會包含在洞見結果中。例如，如果篩選條件為「產品名稱為 GuardDuty」且「資源類型為`AwsS3Bucket`「，則相符的問題清單必須符合這兩個條件。

  不過，Security Hub CSPM 會將布林值 OR 邏輯套用至使用相同屬性但不同值的篩選條件。例如，如果篩選條件是「產品名稱為 GuardDuty」和「產品名稱為 Amazon Inspector」，則如果問題清單是由 Amazon GuardDuty 或 Amazon Inspector 產生，則會相符。

如果您使用資源識別符或資源類型做為分組屬性，洞見結果會包含相符調查結果中的所有資源。清單不限於符合資源類型篩選條件的資源。例如，洞見會識別與 S3 儲存貯體相關聯的調查結果，並根據資源識別符將這些調查結果分組。相符的調查結果同時包含 S3 儲存貯體資源和 IAM 存取金鑰資源。洞見結果包含兩個資源。

如果您啟用[跨區域彙總](finding-aggregation.md)，然後建立自訂洞見，洞見會套用至彙總區域和連結區域中相符的調查結果。例外情況是，如果您的洞見包含區域篩選條件。

# 建立自訂洞見
<a name="securityhub-custom-insight-create-api"></a>

在 AWS Security Hub CSPM 中，自訂洞見可用來收集一組特定的問題清單，並追蹤您環境特有的問題。如需自訂洞見的背景資訊，請參閱 [了解 Security Hub CSPM 中的自訂洞見](securityhub-custom-insights.md)。

選擇您偏好的方法，並依照步驟在 Security Hub CSPM 中建立自訂洞見

------
#### [ Security Hub CSPM console ]

**建立自訂洞見 （主控台）**

1. 在 https：//[https://console.aws.amazon.com/securityhub/](https://console.aws.amazon.com/securityhub/) 開啟 AWS Security Hub CSPM 主控台。

1. 在導覽窗格中，選擇 ** Insights**。

1. 選擇 **Create insight (建立洞見)**。

1. 選取洞見的分組屬性：

   1. 選擇搜尋方塊以顯示篩選條件選項。

   1. 選擇 **Group by (分組依據)**。

   1. 選取要用於將與此洞見相關聯的調查結果分組的屬性。

   1. 選擇**套用**。

1. 或者，選擇要用於此洞見的任何其他篩選條件。對於每個篩選條件，定義篩選條件，然後選擇**套用**。

1. 選擇 **Create insight (建立洞見)**。

1. 輸入 **Insight 名稱**，然後選擇**建立 Insight**。

------
#### [ Security Hub CSPM API ]

**建立自訂洞見 (API)**

1. 若要建立自訂洞見，請使用 Security Hub CSPM API [https://docs.aws.amazon.com//securityhub/1.0/APIReference/API_CreateInsight.html](https://docs.aws.amazon.com//securityhub/1.0/APIReference/API_CreateInsight.html)的操作。如果您使用 AWS CLI，請執行 [https://docs.aws.amazon.com/cli/latest/reference/securityhub/create-insight.html](https://docs.aws.amazon.com/cli/latest/reference/securityhub/create-insight.html)命令。

1. 使用自訂洞見的名稱填入 `Name` 參數。

1. 填入 `Filters` 參數以指定要包含在洞見中的調查結果。

1. 填入 `GroupByAttribute` 參數以指定用於將洞見中包含的問題清單分組的屬性。

1. 或者，填入 `SortCriteria` 參數，依特定欄位排序問題清單。

下列範例會建立自訂洞見，其中包含具有 `AwsIamRole` 資源類型的關鍵調查結果。此範例已針對 Linux、macOS 或 Unix 格式化，並使用反斜線 (\$1) 行接續字元來改善可讀性。

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

------
#### [ PowerShell ]

**建立自訂洞見 (PowerShell)**

1. 使用 `New-SHUBInsight` cmdlet。

1. 使用自訂洞見的名稱填入 `Name` 參數。

1. 填入 `Filter` 參數以指定要包含在洞見中的調查結果。

1. 填入 `GroupByAttribute` 參數以指定用於將洞見中包含的問題清單分組的屬性。

如果您已啟用[跨區域彙總](finding-aggregation.md)，並從彙總區域使用此 cmdlet，則洞見會套用至來自彙總和連結區域的相符問題清單。

**範例**

```
$Filter = @{
    AwsAccountId = [Amazon.SecurityHub.Model.StringFilter]@{
        Comparison = "EQUALS"
        Value = "XXX"
    }
    ComplianceStatus = [Amazon.SecurityHub.Model.StringFilter]@{
        Comparison = "EQUALS"
        Value = 'FAILED'
    }
}
New-SHUBInsight -Filter $Filter -Name TestInsight -GroupByAttribute ResourceId
```

------

## 從受管洞見建立自訂洞見 （僅限主控台）
<a name="securityhub-custom-insight-frrom-managed"></a>

您無法儲存變更或刪除受管洞見。不過，您可以使用受管洞見作為自訂洞見的基礎。此選項僅適用於 Security Hub CSPM 主控台。

**從受管洞見建立自訂洞見 （主控台）**

1. 開啟位於 https：//[https://console.aws.amazon.com/securityhub/](https://console.aws.amazon.com/securityhub/) 的 AWS Security Hub CSPM 主控台。

1. 在導覽窗格中，選擇 ** Insights**。

1. 選擇要使用的受管洞見。

1. 視需要編輯洞見組態。
   + 變更在洞見中用於將問題清單分組的屬性：

     1. 若要移除現有的群組，請透過設定選擇**群組**旁的 **X**。

     1. 選取搜尋方塊。

     1. 選取要用於分組的屬性。

     1. 選擇**套用**。
   + 若要從洞見中移除篩選條件，請選擇篩選條件旁的圓圈 **X**。
   + 新增篩選條件到洞見：

     1. 選取搜尋方塊。

     1. 選取要用做篩選條件的屬性和值。

     1. 選擇**套用**。

1. 更新完成時，請選擇 **Create insight (建立洞見)**。

1. 出現提示時，輸入 **Insight 名稱**，然後選擇**建立洞見**。

# 編輯自訂洞見
<a name="securityhub-custom-insight-modify-console"></a>

您可以編輯現有的自訂洞見，以變更分組值和篩選條件。進行變更後，您可以將更新儲存到原始洞見，或另存更新的版本為新的洞見。

在 AWS Security Hub CSPM 中，自訂洞見可用來收集一組特定的問題清單，並追蹤您環境特有的問題。如需自訂洞見的背景資訊，請參閱 [了解 Security Hub CSPM 中的自訂洞見](securityhub-custom-insights.md)。

若要編輯自訂洞見，請選擇您偏好的方法，然後遵循指示。

------
#### [ Security Hub CSPM console ]

**編輯自訂洞見 （主控台）**

1. 開啟位於 https：//[https://console.aws.amazon.com/securityhub/](https://console.aws.amazon.com/securityhub/) 的 AWS Security Hub CSPM 主控台。

1. 在導覽窗格中，選擇 ** Insights**。

1. 選擇要修改的自訂洞見

1. 視需要編輯洞見組態。
   + 變更在洞見中用於將問題清單分組的屬性：

     1. 若要移除現有的群組，請透過設定選擇**群組**旁的 **X**。

     1. 選取搜尋方塊。

     1. 選取要用於分組的屬性。

     1. 選擇**套用**。
   + 若要從洞見中移除篩選條件，請選擇篩選條件旁的圓圈 **X**。
   + 新增篩選條件到洞見：

     1. 選取搜尋方塊。

     1. 選取要用做篩選條件的屬性和值。

     1. 選擇**套用**。

1. 完成更新時，請選擇 **Save insight (儲存洞見)**。

1. 出現提示時，請執行以下其中一項作業：
   + 若要更新現有的洞見以反映您的變更，請選擇**更新 *<Insight\$1Name>***，然後選擇**儲存洞見**。
   + 如果要以更新建立新的洞見，請選擇 **Save new insight (儲存新的洞見)**。輸入 **Insight name (洞見名稱)**，然後選擇 **Save insight (儲存洞見)**。

------
#### [ Security Hub CSPM API ]

**編輯自訂洞見 (API)**

1. 使用 Security Hub CSPM API [https://docs.aws.amazon.com//securityhub/1.0/APIReference/API_UpdateInsight.html](https://docs.aws.amazon.com//securityhub/1.0/APIReference/API_UpdateInsight.html)的操作。如果您使用 AWS CLI 執行 [https://docs.aws.amazon.com/cli/latest/reference/securityhub/update-insight.html](https://docs.aws.amazon.com/cli/latest/reference/securityhub/update-insight.html)命令。

1. 若要識別您要更新的自訂洞見，請提供洞見的 Amazon Resource Name (ARN)。若要取得自訂洞見的 ARN，請使用 [https://docs.aws.amazon.com/securityhub/1.0/APIReference/API_GetInsights.html](https://docs.aws.amazon.com/securityhub/1.0/APIReference/API_GetInsights.html)操作或 [https://docs.aws.amazon.com/cli/latest/reference/securityhub/get-insights.html](https://docs.aws.amazon.com/cli/latest/reference/securityhub/get-insights.html)命令。

1. 視需要更新 `Filters`、 `Name`和 `GroupByAttribute` 參數。

下列範例會更新指定的洞見。此範例已針對 Linux、macOS 或 Unix 格式化，並使用反斜線 (\$1) 行接續字元來改善可讀性。

```
$ 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"
```

------
#### [ PowerShell ]

**編輯自訂洞見 (PowerShell)**

1. 使用 `Update-SHUBInsight` cmdlet。

1. 若要識別自訂洞見，請提供洞見的 Amazon Resource Name (ARN)。若要取得自訂洞見的 ARN，請使用 `Get-SHUBInsight` cmdlet。

1. 視需要更新 `Name`、 `Filter`和 `GroupByAttribute` 參數。

**範例**

```
$Filter = @{
    ResourceType = [Amazon.SecurityHub.Model.StringFilter]@{
        Comparison = "EQUALS"
        Value = "AwsIamRole"
    }
    SeverityLabel = [Amazon.SecurityHub.Model.StringFilter]@{
        Comparison = "EQUALS"
        Value = "HIGH"
    }
}

Update-SHUBInsight -InsightArn "arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" -Filter $Filter -Name "High severity role findings"
```

------

# 刪除自訂洞見
<a name="securityhub-custom-insight-delete-console"></a>

在 AWS Security Hub CSPM 中，自訂洞見可用來收集一組特定的問題清單，並追蹤您環境特有的問題。如需自訂洞見的背景資訊，請參閱 [了解 Security Hub CSPM 中的自訂洞見](securityhub-custom-insights.md)。

若要刪除自訂洞見，請選擇您偏好的方法，然後遵循指示。您無法刪除受管洞見。

------
#### [ Security Hub CSPM console ]

**刪除自訂洞見 （主控台）**

1. 開啟位於 https：//[https://console.aws.amazon.com/securityhub/](https://console.aws.amazon.com/securityhub/) 的 AWS Security Hub CSPM 主控台。

1. 在導覽窗格中，選擇 ** Insights**。

1. 找到要刪除的自訂洞見。

1. 針對該洞見，請選擇更多選項圖示 （卡片右上角的三個點）。

1. 選擇 **刪除**。

------
#### [ Security Hub CSPM API ]

**刪除自訂洞見 (API)**

1. 使用 Security Hub CSPM API [https://docs.aws.amazon.com//securityhub/1.0/APIReference/API_DeleteInsight.html](https://docs.aws.amazon.com//securityhub/1.0/APIReference/API_DeleteInsight.html)的操作。如果您使用 AWS CLI 執行 [https://docs.aws.amazon.com/cli/latest/reference/securityhub/delete-insight.html](https://docs.aws.amazon.com/cli/latest/reference/securityhub/delete-insight.html)命令。

1. 若要識別要刪除的自訂洞見，請提供洞見的 ARN。若要取得自訂洞見的 ARN，請使用 [https://docs.aws.amazon.com/securityhub/1.0/APIReference/API_GetInsights.html](https://docs.aws.amazon.com/securityhub/1.0/APIReference/API_GetInsights.html)操作或 [https://docs.aws.amazon.com/cli/latest/reference/securityhub/get-insights.html](https://docs.aws.amazon.com/cli/latest/reference/securityhub/get-insights.html)命令。

下列範例會刪除指定的洞見。此範例已針對 Linux、macOS 或 Unix 格式化，並使用反斜線 (\$1) 行接續字元來改善可讀性。

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

------
#### [ PowerShell ]

**刪除自訂洞見 (PowerShell)**

1. 使用 `Remove-SHUBInsight` cmdlet。

1. 若要識別自訂洞見，請提供洞見的 ARN。若要取得自訂洞見的 ARN，請使用 `Get-SHUBInsight` cmdlet。

**範例**

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

------