

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 添加和启用实体列表或 IP 列表
<a name="guardduty-lists-create-activate"></a>

实体列表和 IP 地址列表可帮助您自定义中的威胁检测功能 GuardDuty。有关这些列表的更多信息，请参阅[理解实体列表和 IP 地址列表](guardduty_upload-lists.md#guardduty-threat-intel-list-entity-sets)。要管理您 AWS 环境的可信数据和威胁情报数据， GuardDuty建议使用实体列表。在开始之前，请参阅[设置实体列表和 IP 地址列表的先决条件](guardduty-lists-prerequisites.md)。

选择以下访问方法之一添加和启用可信实体列表、威胁实体列表、可信 IP 列表或威胁 IP 列表。

------
#### [ Console ]

**（可选）步骤 1：获取列表的位置 URL**

1. 打开 Amazon S3 控制台，网址为 [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)。

1. 在导航窗格中，选择**存储桶**。

1. 选择包含要添加的特定列表的 Amazon S3 存储桶名称。

1. 选择对象（列表）名称以查看其详细信息。

1. 在**属性**选项卡下，复制该对象的 **S3 URI**。

**步骤 2：添加可信或威胁情报数据**

1. 打开 GuardDuty 控制台，网址为[https://console.aws.amazon.com/guardduty/](https://console.aws.amazon.com/guardduty/)。

1. 在导航窗格中，选择**列表**。

1. 在**列表**页面上，选择**实体列表**或**IP 地址列表**选项卡。

1. 根据您选择的选项卡，选择添加可信列表或威胁列表。

1. 在“添加可信列表或威胁列表”的对话框中，执行以下操作：

   1. 对于**列表名称**，输入列表的名称。

      **列表命名约束**：列表名称可以包含小写字母、大写字母、数字、短划线 (-) 和下划线 (\$1)。

      对于 IP 地址列表，您的列表名称在 AWS 账户 和区域内必须是唯一的。

   1. 对于**位置**，请提供您上传列表的位置。如果您还没有，请参阅 [Step 1: Fetching location URL of your list](#fetch-location-URL-list-manage)。

      仅适用于自定义威胁和自定义可信实体集，如果您提供的位置 URL 与以下支持的格式不一致，则您在添加和启用列表时会收到错误消息。

**位置 URL 的格式：**
      + https://s3.amazonaws.com/bucket.name/file.txt
      + https://s3-aws-region.amazonaws.com/bucket.name/file.txt
      + http://bucket.s3.amazonaws.com/file.txt
      + http://bucket.s3-aws-region.amazonaws.com/file.txt
      + s3://bucket.name/file.txt

   1. （可选）对于**预期存储桶拥有者**，您可以输入拥有**位置**字段中指定的 Amazon S3 存储桶的 AWS 账户 ID。

      如果不指定 AWS 账户 ID 所有者，则实体列表和 IP 地址列表的 GuardDuty 行为会有所不同。对于实体列表， GuardDuty 将验证当前成员账户是否拥有**位置**字段中指定的 S3 存储桶。对于 IP 地址列表，如果您未指定 AWS 账户 ID 所有者，则 GuardDuty 不执行任何验证。

      如果 GuardDuty 发现此 S3 存储桶不属于指定的账户 ID，则在激活列表时会出现错误。

   1. 选中 **I agree** 复选框。

   1. 选择 **Add list**。默认情况下，已添加列表的**状态**为**非活动**。要使列表生效，必须激活列表。

**步骤 3：启用实体列表或 IP 地址列表**

1. 打开 GuardDuty 控制台，网址为[https://console.aws.amazon.com/guardduty/](https://console.aws.amazon.com/guardduty/)。

1. 在导航窗格中，选择**列表**。

1. 在**列表**页面上，选择要启用列表的选项卡：**实体列表**或 **IP 地址列表**。

1. 选择要启用的列表。这将启用**操作**和**编辑**菜单。

1. 选择**操作**，然后选择**启用**。

------
#### [ API/CLI ]

**添加和启用可信实体列表**

1. 运行 [CreateTrustedEntitySet](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_CreateTrustedEntitySet.html)。确保提供要为其创建此可信实体列表的成员账户的 `detectorId`。要查找您的账户和当前区域的，请参阅[https://console.aws.amazon.com/guardduty/](https://console.aws.amazon.com/guardduty/)控制台中的**设置**页面，或运行 [https://docs.aws.amazon.com/guardduty/latest/APIReference/API_ListDetectors.html](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_ListDetectors.html)API。`detectorId`

   **列表命名约束**：列表名称可以包含小写字母、大写字母、数字、短划线 (-) 和下划线 (\$1)。

1. 您也可以通过运行以下 AWS Command Line Interface 命令来执行此操作：

   ```
   aws guardduty create-trusted-entity-set \ 
   --detector-id 12abc34d567e8fa901bc2d34e56789f0 \
   --name "AnyOrganization ListEXAMPLE" \
   --format TXT \
   --location "https://s3.amazonaws.com/amzn-s3-demo-bucket/DOC-EXAMPLE-SOURCE-FILE.format" \
   --activate
   ```

   `detector-id`替换为要为其创建可信实体列表的成员账户的检测器 ID 以及其他占位符值。*shown in red*

   如果您不想启用此新建列表，请将参数 `--activate` 替换为 `--no-activate`。

   `expected-bucket-owner` 参数是可选的。无论您是否为此参数指定值，都将 GuardDuty 验证与此`--detector-id`值关联的 AWS 账户 ID 是否拥有`--location`参数中指定的 S3 存储桶。如果 GuardDuty 发现此 S3 存储桶不属于指定的账户 ID，则在激活此列表时会出现错误。

   仅适用于自定义威胁和自定义可信实体集，如果您提供的位置 URL 与以下支持的格式不一致，则您在添加和启用列表时会收到错误消息。

**添加和启用威胁实体列表**

1. 运行 [CreateThreatEntitySet](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_CreateThreatEntitySet.html)。确保提供要为其创建此威胁实体列表的成员账户的 `detectorId`。要查找您的账户和当前区域的，请参阅[https://console.aws.amazon.com/guardduty/](https://console.aws.amazon.com/guardduty/)控制台中的**设置**页面，或运行 [https://docs.aws.amazon.com/guardduty/latest/APIReference/API_ListDetectors.html](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_ListDetectors.html)API。`detectorId`

   **列表命名约束**：列表名称可以包含小写字母、大写字母、数字、短划线 (-) 和下划线 (\$1)。

1. 您也可以通过运行以下 AWS Command Line Interface 命令来执行此操作：

   ```
   aws guardduty create-threat-entity-set \ 
   --detector-id 12abc34d567e8fa901bc2d34e56789f0 \
   --name "AnyOrganization ListEXAMPLE" \
   --format TXT \
   --location "https://s3.amazonaws.com/amzn-s3-demo-bucket/DOC-EXAMPLE-SOURCE-FILE.format" \
   --activate
   ```

   `detector-id`替换为要为其创建可信实体列表的成员账户的检测器 ID 以及其他占位符值。*shown in red*

   如果您不想启用此新建列表，请将参数 `--activate` 替换为 `--no-activate`。

   `expected-bucket-owner` 参数是可选的。无论您是否为此参数指定值，都将 GuardDuty 验证与此`--detector-id`值关联的 AWS 账户 ID 是否拥有`--location`参数中指定的 S3 存储桶。如果 GuardDuty 发现此 S3 存储桶不属于指定的账户 ID，则在激活此列表时会出现错误。

   仅适用于自定义威胁和自定义可信实体集，如果您提供的位置 URL 与以下支持的格式不一致，则您在添加和启用列表时会收到错误消息。

**添加和启用可信 IP 地址列表**

1. 运行 “[创建” IPSet](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_CreateIPSet.html)。确保提供要为其创建此可信 IP 地址列表的成员账户的 `detectorId`。要查找您的账户和当前区域的，请参阅[https://console.aws.amazon.com/guardduty/](https://console.aws.amazon.com/guardduty/)控制台中的**设置**页面，或运行 [https://docs.aws.amazon.com/guardduty/latest/APIReference/API_ListDetectors.html](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_ListDetectors.html)API。`detectorId`

   对于 IP 地址列表，您的列表名称在 AWS 账户 和区域内必须是唯一的。

   **列表命名约束**：列表名称可以包含小写字母、大写字母、数字、短划线 (-) 和下划线 (\$1)。

1. 您也可以通过运行以下 AWS Command Line Interface 命令来执行此操作，并确保将 `detector-id` 替换为要为其更新可信 IP 地址列表的成员账户的检测器 ID。

   ```
   aws guardduty create-ip-set \
   --detector-id 12abc34d567e8fa901bc2d34e56789f0 \
   --name "AnyOrganization ListEXAMPLE" \
   --format TXT \
   --location "https://s3.amazonaws.com/amzn-s3-demo-bucket/DOC-EXAMPLE-SOURCE-FILE.format" \
   --activate
   ```

   `detector-id`替换为要为其创建可信 IP 列表的成员账户的检测器 ID 以及其他占位符值。*shown in red*

   如果您不想启用此新建列表，请将参数 `--activate` 替换为 `--no-activate`。

   `expected-bucket-owner` 参数是可选的。如果您未指定拥有 S3 存储桶的账户 ID， GuardDuty 则不会执行任何验证。当您为参数指定账户 ID 时，将 GuardDuty 验证此 AWS 账户 ID 是否拥有`expected-bucket-owner`参数中指定的 S3 存储桶。`--location`如果 GuardDuty 发现此 S3 存储桶不属于指定的账户 ID，则在激活此列表时会出现错误。

**添加和启用威胁 IP 列表**

1. 运行 [CreateThreatIntelSet](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_CreateThreatIntelSet.html)。确保提供要为其创建此威胁 IP 地址列表的成员账户的 `detectorId`。要查找您的账户和当前区域的，请参阅[https://console.aws.amazon.com/guardduty/](https://console.aws.amazon.com/guardduty/)控制台中的**设置**页面，或运行 [https://docs.aws.amazon.com/guardduty/latest/APIReference/API_ListDetectors.html](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_ListDetectors.html)API。`detectorId`

   **列表命名约束**：列表名称可以包含小写字母、大写字母、数字、短划线 (-) 和下划线 (\$1)。

   对于 IP 地址列表，您的列表名称在 AWS 账户 和区域内必须是唯一的。

1. 您也可以通过运行以下 AWS Command Line Interface 命令来执行此操作，并确保将 `detector-id` 替换为要为其更新威胁 IP 列表的成员账户的检测器 ID。

   ```
   aws guardduty create-threat-intel-set \
   --detector-id 12abc34d567e8fa901bc2d34e56789f0 \
   --name "AnyOrganization ListEXAMPLE" \
   --format TXT \
   --location "https://s3.amazonaws.com/amzn-s3-demo-bucket/DOC-EXAMPLE-SOURCE-FILE.format" \
   --activate
   ```

   `detector-id`替换为要为其创建威胁 IP 列表的成员账户的探测器 ID 以及其他占位符值。*shown in red*

   如果您不想启用此新建列表，请将参数 `--activate` 替换为 `--no-activate`。

   `expected-bucket-owner` 参数是可选的。如果您未指定拥有 S3 存储桶的账户 ID， GuardDuty 则不会执行任何验证。当您为参数指定账户 ID 时，将 GuardDuty 验证此 AWS 账户 ID 是否拥有`expected-bucket-owner`参数中指定的 S3 存储桶。`--location`如果 GuardDuty 发现此 S3 存储桶不属于指定的账户 ID，则在激活此列表时会出现错误。

------

启用实体列表或 IP 地址列表后，列表可能需要几分钟才能生效。有关更多信息，请参阅 [GuardDuty 清单的重要注意事项](guardduty_upload-lists.md#guardduty-lists-entity-sets-considerations)。