

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

# GuardDuty EKS 保护
<a name="kubernetes-protection"></a>

EKS Protection 可帮助您检测环境中亚马逊 Elastic Kubernetes Service（亚马逊 EKS）集群中的潜在安全风险。 AWS 例如，它可以帮助您检测配置错误的 EKS 集群何时被试图从您的集群收集机密或 AWS 凭据的未经身份验证的参与者访问。EKS 防护功能使用 EKS 审计日志来分析用户和应用程序的活动。

启用 EKS 保护后， GuardDuty 会自动开始监控您的 Amazon EKS 集群是否存在潜在的安全威胁。 GuardDuty 使用自己的独立数据流进行收集和分析，[EKS 防护中的 EKS 审计日志](#guardduty_k8s-audit-logs)无需额外配置。

当基于 EKS 审核日志监控 GuardDuty 检测到潜在威胁时，它会生成安全发现。有关启用 EKS 保护时 GuardDuty 可能生成的查找类型的信息，请参阅[EKS 防护调查发现类型](guardduty-finding-types-eks-audit-logs.md)。

**注意**  
要查看您账户中的 EKS 审核日志（可选），您可以配置 Amazon EKS 控制平面日志以将审核日志发送到 CloudWatch 日志。此配置与 EKS Protection 是分开的，并且不是中安全监控功能所必需的 GuardDuty。

**30 天免费试用期**
+ 首次 GuardDuty 在 in AWS 账户 中启用时，您将获得 30 天的免费试用期。 AWS 区域 在这种情况下， GuardDuty 还将启用 EKS 保护，该保护包含在 30 天免费试用版中。
+ 如果您已经在使用 GuardDuty 并决定首次启用 EKS 保护，那么您在该地区的账户将获得 EKS Protection 的 30 天免费试用。
+ 您可以随时选择禁用任何区域的 EKS 防护。
+ 在 30 天免费试用期内，您可以估算该账户在该区域的使用成本。30 天免费试用期结束后， GuardDuty 不会自动禁用 EKS 保护。您的账户在该区域将开始产生使用成本。有关更多信息，请参阅 [监控使用情况并估算成本](monitoring_costs.md)。

禁用 EKS 保护后，会 GuardDuty 立即停止监控和分析您的 Amazon EKS 资源的 EKS 审核日志。

EKS Protection 可能并非在所有可用 AWS 区域 的地方 GuardDuty 都可用。有关更多信息，请参阅 [特定于区域的特征可用性](guardduty_regions.md#gd-regional-feature-availability)。

**注意**  
EKS 运行时监控时作为运行时监控的一部分进行管理的。有关更多信息，请参阅 [GuardDuty 运行时监控](runtime-monitoring.md)。

## EKS 防护中的 EKS 审计日志
<a name="guardduty_k8s-audit-logs"></a>

EKS 审计日志可捕获 Amazon EKS 集群内的连续操作，包括来自用户、使用 Kubernetes API 的应用程序以及控制面板的活动。审计日志记录是所有 Kubernetes 集群的一个组件。

有关更多信息，请参阅 Kubernetes 文档中的[审计](https://Kubernetes.io/docs/tasks/debug-application-cluster/audit/)。

Amazon EKS 允许通过 EKS [控制平面 CloudWatch 日志记录功能将 EKS 审核日志作为亚马逊日志](https://docs.aws.amazon.com/eks/latest/userguide/control-plane-logs.html)提取。 GuardDuty 不会管理你的 Amazon EKS 控制平面日志，也不会让你的账户可以访问 EKS 审核日志（如果您尚未为 Amazon EKS 启用 EKS 审核日志）。要管理对 EKS 审计日志的访问和保留，必须配置 Amazon EKS 控制面板日志记录功能。有关更多信息，请参阅《Amazon EKS 用户指南》****中的[启用和禁用控制面板日志](https://docs.aws.amazon.com/eks/latest/userguide/control-plane-logs.html#enabling-control-plane-log-export)。

# 在多账户环境中启用 EKS 防护
<a name="eks-protection-enable-multiple-accounts"></a>

在多账户环境中，只有委派的 GuardDuty 管理员账户可以选择为其组织中的成员账户启用或禁用 EKS Protection; 功能。 GuardDuty 成员账户无法通过其账户修改此配置。委托 GuardDuty 管理员账户使用管理其成员账户 AWS Organizations。这个委派的 GuardDuty 管理员账户可以选择在所有新账户加入组织时自动启用 EKS 保护。有关多账户环境的更多信息，请参阅在 A [mazon 中管理多个账户](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_accounts.html)。 GuardDuty

## 为委派的 GuardDuty 管理员账户配置 EKS 审核日志监控
<a name="configure-eks-audit-log-monitoring-delegatedadmin"></a>

选择您的首选访问方式，为委派的 GuardDuty 管理员账户配置 EKS 审核日志监控。

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

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

1. 在导航窗格中，选择“EKS 保护”。

1. 在**配置**选项卡下，您可以在相应部分中查看 EKS 审计日志监控的当前配置状态。要更新委派 GuardDuty 管理员帐户的配置，请在 “E **KS 审核日志监控**” 窗格中选择 “**编辑**”。

1. 请执行以下操作之一：

**使用**对所有账户启用****
   + 选择**为所有账户启用**。这将为组织中的所有活跃 GuardDuty 账户（包括加入 AWS 组织的新账户）启用保护计划。
   + 选择**保存**。

**使用**手动配置账户****
   + 要仅为委派 GuardDuty 管理员账户启用保护计划，请选择**手动配置帐户**。
   + 在 “**委派 GuardDuty 管理员帐户（此账户）**” 部分下选择 “**启用**”。
   + 选择**保存**。

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

使用您自己的区域检测器 ID 运行 [https://docs.aws.amazon.com/guardduty/latest/APIReference/API_UpdateDetector.html](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_UpdateDetector.html) API 操作，并传递 `name` 为 `EKS_AUDIT_LOGS`、`status` 为 `ENABLED` 或 `DISABLED` 的 `features` 对象。

要查找您的账户和当前区域的，请查看[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`

您可以通过运行以下 AWS CLI 命令来启用或禁用 EKS 审核日志监控。请务必使用有效的委托 GuardDuty 管理员账号*detector ID*。

**注意**  
以下示例代码可启用 EKS 审计日志监控。请务必*12abc34d567e8fa901bc2d34e56789f0*替换为委派 GuardDuty 管理员账号的，*555555555555*替换为 AWS 账户 委派 GuardDuty 管理员账号的。`detector-id`

要查找您的账户和当前区域的，请查看[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`

```
aws guardduty update-detector --detector-id 12abc34d567e8fa901bc2d34e56789f0 --features '[{"Name": "EKS_AUDIT_LOGS", "Status": "ENABLED"}]'
```

要禁用 EKS 审计日志监控，请将 `ENABLED` 替换为 `DISABLED`。

------

## 为所有成员账户自动启用 EKS 审计日志监控
<a name="k8s-autoenable"></a>

选择您的首选访问方式，为组织中的现有成员账户启用 EKS 审计日志监控。

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

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

   请务必使用委派 GuardDuty 管理员账户证书。

1. 请执行以下操作之一：

**使用 **EKS 保护**页面**

   1. 在导航窗格中，选择 **EKS 保护**。

   1. 在**配置**选项卡下，您可以查看组织中活跃成员账户的 EKS 审计日志监控的当前状态。

      要更新 EKS 审计日志监控的配置，请选择**编辑**。

   1. 选择**为所有账户启用**。此操作会自动为组织中的现有账户和新账户启用 EKS 审计日志监控。

   1. 选择**保存**。
**注意**  
更新成员账户的配置可能最长需要 24 小时。

**使用**账户**页面**

   1. 在导航窗格中，选择**账户**。

   1. 在**账户**页面上，选择**自动启用**首选项，然后选择**通过邀请添加账户**。

   1. 在**管理自动启用首选项**窗口中，在 **EKS 审计日志监控**下选择**为所有账户启用**。

   1. 选择**保存**。

   如果您无法使用**为所有账户启用**选项，并且想要为组织中的特定账户自定义 EKS 审计日志监控配置，请参阅 [有选择地为成员账户启用或禁用 EKS 审计日志监控](#k8s-enable-disable-selective-members-org)。

------
#### [ API/CLI ]
+ 要有选择地为您的成员账户启用或禁用 EKS 审核日志监控，请使用您自己的*detector ID*账户运行 [https://docs.aws.amazon.com/guardduty/latest/APIReference/API_UpdateMemberDetectors.html](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_UpdateMemberDetectors.html)API 操作。
+ 以下示例显示如何为单个成员账户启用 EKS 审计日志监控。要将其禁用，请将 `ENABLED` 替换为 `DISABLED`。

  要查找您的账户和当前区域的，请查看[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`

  ```
  aws guardduty update-member-detectors --detector-id 12abc34d567e8fa901bc2d34e56789f0 --account-ids 111122223333 --features '[{"name": "EKS_AUDIT_LOGS", "status": "ENABLED"}]'
  ```
**注意**  
您也可以传递用空格 IDs 分隔的账户列表。
+ 成功执行代码后，会返回 `UnprocessedAccounts` 的空列表。如果更改账户的检测器设置时出现任何问题，则会列出该账户 ID 和问题摘要。

------

## 为所有现有活跃成员账户启用 EKS 审计日志监控
<a name="enable-for-all-existing-members-eks-audit-log"></a>

选择您的首选访问方式，为组织中所有现有活跃成员账户启用 EKS 审计日志监控。

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

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

   使用委派的 GuardDuty 管理员账户凭据登录。

1. 在导航窗格中，选择 **EKS 保护**。

1. 在 **EKS Pro** tection 页面上，您可以查看**GuardDuty启动的恶意软件扫描**配置的当前状态。在**活跃成员账户**部分下，选择**操作**。

1. 从**操作**下拉菜单中，选择**为所有现有活跃成员账户启用**。

1. 选择**保存**。

------
#### [ API/CLI ]
+ 要有选择地为您的成员账户启用或禁用 EKS 审核日志监控，请使用您自己的*detector ID*账户运行 [https://docs.aws.amazon.com/guardduty/latest/APIReference/API_UpdateMemberDetectors.html](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_UpdateMemberDetectors.html)API 操作。
+ 以下示例显示如何为单个成员账户启用 EKS 审计日志监控。要将其禁用，请将 `ENABLED` 替换为 `DISABLED`。

  要查找您的账户和当前区域的，请查看[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`

  ```
  aws guardduty update-member-detectors --detector-id 12abc34d567e8fa901bc2d34e56789f0 --account-ids 111122223333 --features '[{"name": "EKS_AUDIT_LOGS", "status": "ENABLED"}]'
  ```
**注意**  
您也可以传递用空格 IDs 分隔的账户列表。
+ 成功执行代码后，会返回 `UnprocessedAccounts` 的空列表。如果更改账户的检测器设置时出现任何问题，则会列出该账户 ID 和问题摘要。

------

## 为新成员账户自动启用 EKS 审计日志监控
<a name="k8s-auto-enable-new-member-org"></a>

在选择配置 GuardDuty启动的恶意软件扫描 GuardDuty 之前，必须**启用**新添加的成员帐户。通过邀请管理的成员帐户可以为其帐户手动配置 GuardDuty启动的恶意软件扫描。有关更多信息，请参阅 [Step 3 - Accept an invitation](guardduty_become_console.md#guardduty_accept_invite_proc)。

选择您的首选访问方式，为加入您组织的新账户启用 EKS 审计日志监控。

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

**委派的 GuardDuty 管理员账户可以使用 EKS 审核日志监控或账户页面为组织中的新成员账户启用 **EKS 审核日志监控**。**

**为新成员账户自动启用 EKS 审计日志监控**

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

   请务必使用委派 GuardDuty 管理员账户证书。

1. 请执行以下操作之一：
   + 使用 **EKS 保护**页面：

     1. 在导航窗格中，选择 **EKS 保护**。

     1. 在 **EKS 保护**页面上，在 **EKS 审计日志监控**中选择**编辑**。

     1. 选择**手动配置账户**。

     1. 选择**为新成员账户自动启用**。此步骤可确保每当有新账户加入您的组织时，系统都会自动为其账户启用 EKS 审计日志监控。只有组织委派的 GuardDuty 管理员帐户才能修改此配置。

     1. 选择**保存**。
   + 使用**账户**页面：

     1. 在导航窗格中，选择**账户**。

     1. 在**账户**页面上，选择**自动启用**首选项。

     1. 在**管理自动启用首选项**窗口中，在 **EKS 审计日志监控**下选择**为新账户启用**。

     1. 选择**保存**。

------
#### [ API/CLI ]
+ 要有选择地为您的新账户启用或禁用 EKS 审核日志监控，请使用您自己的*detector ID*账户运行 [https://docs.aws.amazon.com/guardduty/latest/APIReference/API_UpdateOrganizationConfiguration.html](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_UpdateOrganizationConfiguration.html)API 操作。
+ 以下示例说明如何为加入组织的新成员启用 EKS 审计日志监控。您也可以传递用空格 IDs 分隔的账户列表。

  要查找您的账户和当前区域的，请查看[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`

  ```
  aws guardduty update-organization-configuration --detector-id 12abc34d567e8fa901bc2d34e56789f0 --auto-enable --features '[{"Name": "EKS_AUDIT_LOGS", "AutoEnable": "NEW"}]'
  ```

------

## 有选择地为成员账户启用或禁用 EKS 审计日志监控
<a name="k8s-enable-disable-selective-members-org"></a>

选择您的首选访问方式，为组织中所选的部分成员账户启用或禁用 EKS 审计日志监控。

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

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

   请务必使用委派 GuardDuty 管理员账户证书。

1. 在导航窗格中，选择**账户**。

   在**账户**页面上，查看 **EKS 审计日志监控**列，了解您成员账户的状态。

1. 

**启用或禁用 EKS 审计日志监控**

   选择要为 EKS 审计日志监控配置的账户。您可以一次选择多个账户。在**编辑保护计划**下拉列表中，选择 **EKS 审计日志监控**，然后选择相应的选项。

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

要有选择地为您的成员账户启用或禁用 EKS 审核日志监控，请使用您自己的*detector ID*账户调用 [https://docs.aws.amazon.com/guardduty/latest/APIReference/API_UpdateMemberDetectors.html](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_UpdateMemberDetectors.html)API 操作。

以下示例显示如何为单个成员账户启用 EKS 审计日志监控。要将其禁用，请将 `ENABLED` 替换为 `DISABLED`。您也可以传递用空格 IDs 分隔的账户列表。

要查找您的账户和当前区域的，请查看[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`

```
aws guardduty update-member-detectors --detector-id 12abc34d567e8fa901bc2d34e56789f0 --accountids 111122223333 --features '[{"Name": "EKS_AUDIT_LOGS", "Status": "ENABLED"}]'
```

------

# 为独立账户启用 EKS 防护
<a name="eks-protection-enable-standalone-account"></a>

独立账户负责决定其 AWS 账户在特定区域中启用或禁用防护计划。

如果您的账户通过或通过 AWS Organizations邀请方式与 GuardDuty 管理员帐户关联，则此部分不适用于您。有关管理多个账户的信息，请参阅[在多账户环境中启用 EKS 防护](eks-protection-enable-multiple-accounts.md)。

启用 EKS 保护后， GuardDuty 将开始监控您账户中 Amazon EKS 集群的 EKS 审核日志。

选择您偏好的访问方法，为独立账户配置 EKS 防护。

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

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

1. 在右上角的**区域**选择器中，选择要启用 EKS 防护的区域。

1. 在导航窗格中，选择 EKS 保护。

1. **EKS 防护**页面提供了您账户的当前 EKS 防护状态。选择**启用**以启用 EKS 防护。

1. 选择**确认**以保存选择。

------
#### [ API/CLI ]
+ 使用委派 GuardDuty 管理员账户的区域探测器 ID 运行 [https://docs.aws.amazon.com/guardduty/latest/APIReference/API_UpdateDetector.html](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_UpdateDetector.html)API 操作，并将`features`对象名称传递为`EKS_AUDIT_LOGS`，状态为`ENABLED`。

  您也可以通过运行 AWS CLI 命令来启用 EKS 防护。运行以下命令，*12abc34d567e8fa901bc2d34e56789f0*替换为账户的检测器 ID 和*us-east-1*要启用 EKS 保护的区域。

  要查找您的账户和当前区域的，请查看[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`

  ```
  aws guardduty update-detector --detector-id 12abc34d567e8fa901bc2d34e56789f0 --region us-east-1 --features [{"Name" : "EKS_AUDIT_LOGS", "Status" : "ENABLED"}]'
  ```

------