

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

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

EKS 保護可協助您偵測 AWS 環境中 Amazon Elastic Kubernetes Service (Amazon EKS) 叢集的潛在安全風險。例如，它可協助您偵測未驗證的執行者何時存取設定錯誤的 EKS 叢集，而該執行者會嘗試從您的叢集收集秘密或 AWS 登入資料。EKS 保護會使用 EKS 稽核日誌來分析使用者和應用程式的活動。

當您啟用 EKS 保護時，GuardDuty 會自動開始監控 Amazon EKS 叢集是否有潛在的安全威脅。GuardDuty 使用自己的獨立串流來收集和分析 [EKS 保護中的 EKS 稽核日誌](#guardduty_k8s-audit-logs)- 不需要額外的組態。

當 GuardDuty 根據 EKS 稽核日誌監控偵測到潛在威脅時，會產生安全調查結果。如需有關 GuardDuty 在您啟用 EKS 保護時可能產生的調查結果類型的資訊，請參閱 [EKS 保護調查結果類型](guardduty-finding-types-eks-audit-logs.md)。

**注意**  
若要檢視帳戶中的 EKS 稽核日誌 （選用），您可以設定 Amazon EKS 控制平面記錄，將稽核日誌傳送至 CloudWatch Logs。此組態與 EKS 保護不同，在 GuardDuty 中安全監控功能不需要。

**30 天免費試用**
+  AWS 區域 第一次在 AWS 帳戶 的 中啟用 GuardDuty 時，您會獲得 30 天的免費試用。在此情況下，GuardDuty 也會啟用 EKS 保護，此保護包含在 30 天的免費試用中。
+ 當您已使用 GuardDuty 並決定第一次啟用 EKS 保護時，您在此區域中的帳戶將取得 30 天的 EKS 保護免費試用。
+ 您可以隨時選擇在任何區域中停用 EKS 保護。
+ 在 30 天免費試用期間，您可以取得該帳戶和區域中用量成本的預估值。30 天免費試用結束後，GuardDuty 不會自動停用 EKS 保護。您在此區域中的帳戶將開始產生使用成本。如需詳細資訊，請參閱[監控用量和估計成本](monitoring_costs.md)。

當您停用 EKS 保護時，GuardDuty 會立即停止監控和分析 Amazon EKS 資源的 EKS 稽核日誌。

在所有提供 GuardDuty AWS 區域 的 中，可能無法使用 EKS 保護。如需詳細資訊，請參閱[區域特定功能的可用性](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 [控制平面記錄功能，將 EKS](https://docs.aws.amazon.com/eks/latest/userguide/control-plane-logs.html) 稽核日誌擷取為 Amazon CloudWatch Logs。如果您尚未為 Amazon EKS 啟用 EKS 稽核日誌，GuardDuty 不會管理 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 保護功能。GuardDuty 成員帳戶無法從其帳戶修改此組態。委派的 GuardDuty 管理員帳戶會使用 管理其成員帳戶 AWS Organizations。此委派的 GuardDuty 管理員帳戶可以選擇在加入組織時為所有新帳戶自動啟用 EKS 保護。如需有關多帳戶環境的詳細資訊，請參閱[在 Amazon GuardDuty 中管理多個帳戶](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_accounts.html)。

## 為委派的 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 管理員帳戶的組態，請在 **EKS 稽核日誌監控**窗格中選擇**編輯**。

1. 執行以下任意一項：

**使用**為所有帳戶啟用****
   + 選擇**為所有帳戶啟用**。這將為 AWS 組織中所有作用中的 GuardDuty 帳戶啟用保護計畫，包括加入組織的新帳戶。
   + 選擇**儲存**。

**使用**手動設定帳戶****
   + 若要僅為委派的 GuardDuty 管理員帳戶啟用保護計畫，請選擇**手動設定帳戶**。
   + 在**委派的 GuardDuty 管理員帳戶 （此帳戶）** 區段下選擇**啟用**。
   + 選擇**儲存**。

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

使用您自己的區域偵測器 ID，並透過將 `name` 設定為 `EKS_AUDIT_LOGS` 及將 `status` 設定為 `ENABLED` 或 `DISABLED` 來傳遞 `features` 物件，從而執行 [https://docs.aws.amazon.com/guardduty/latest/APIReference/API_UpdateDetector.html](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_UpdateDetector.html) API 操作。

若要尋找`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。

您可以執行下列 AWS CLI 命令來啟用或停用 EKS 稽核日誌監控。請務必使用委派的 GuardDuty 管理員帳戶的有效*偵測器 ID*。

**注意**  
下列範例程式碼會啟用 EKS 稽核日誌監控。請務必將 *12abc34d567e8fa901bc2d34e56789f0* 取代為委派 `detector-id` GuardDuty 管理員帳戶的 ，並將 *555555555555* 取代為 AWS 帳戶 委派 GuardDuty 管理員帳戶的 。

若要尋找`detectorId`您帳戶和目前區域的 ，請參閱 https：//[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。

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

若要停用 EKS 稽核日誌監控，請使用 `DISABLED` 取代 `ENABLED`。

------

## 為所有成員帳戶自動啟用 EKS 稽核日誌監控
<a name="k8s-autoenable"></a>

選擇您偏好的存取方式，以便為組織中現有的成員帳戶啟用 EKS 稽核日誌監控。

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

1. 登入 AWS 管理主控台 ，並在 [https://console.aws.amazon.com/guardduty/](https://console.aws.amazon.com/guardduty/)：// 開啟 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 稽核日誌監控，請使用您自己的*偵測器 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 稽核日誌監控。若要停用，請使用 `DISABLED` 取代 `ENABLED`。

  若要尋找`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。

  ```
  aws guardduty update-member-detectors --detector-id 12abc34d567e8fa901bc2d34e56789f0 --account-ids 111122223333 --features '[{"name": "EKS_AUDIT_LOGS", "status": "ENABLED"}]'
  ```
**注意**  
您也可以傳遞以空格分隔的帳戶 ID 清單。
+ 當程式碼成功執行時，會返回一個空白 `UnprocessedAccounts` 清單。如果變更帳戶的偵測器設定時發生任何問題，則會列出該帳戶 ID 以及問題摘要。

------

## 為所有現有作用中成員帳戶啟用 EKS 稽核日誌監控
<a name="enable-for-all-existing-members-eks-audit-log"></a>

選擇您偏好的存取方式，以便為組織中所有現有作用中成員帳戶啟用 EKS 稽核日誌監控。

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

1. 登入 AWS 管理主控台 ，並在 [https://console.aws.amazon.com/guardduty/](https://console.aws.amazon.com/guardduty/)：// 開啟 GuardDuty 主控台。

   使用委派的 GuardDuty 管理員帳戶登入資料登入。

1. 在導覽窗格中，選擇 **EKS 保護**。

1. 在 **EKS 保護**頁面上，您可以檢視 **GuardDuty 起始的惡意軟體掃描**組態的目前狀態。在**作用中成員帳戶**區段下，選擇**動作**。

1. 從**動作**下拉式選單中，選擇**為所有作用中的成員帳戶啟用**。

1. 選擇**儲存**。

------
#### [ API/CLI ]
+ 若要為您的成員帳戶選擇性地啟用或停用 EKS 稽核日誌監控，請使用您自己的*偵測器 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 稽核日誌監控。若要停用，請使用 `DISABLED` 取代 `ENABLED`。

  若要尋找`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。

  ```
  aws guardduty update-member-detectors --detector-id 12abc34d567e8fa901bc2d34e56789f0 --account-ids 111122223333 --features '[{"name": "EKS_AUDIT_LOGS", "status": "ENABLED"}]'
  ```
**注意**  
您也可以傳遞以空格分隔的帳戶 ID 清單。
+ 當程式碼成功執行時，會返回一個空白 `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 稽核日誌監控，請使用您自己的*偵測器 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 稽核日誌監控。您也可以傳遞以空格分隔的帳戶 ID 清單。

  若要尋找`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。

  ```
  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 稽核日誌監控，請使用您自己的*偵測器 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 稽核日誌監控。若要停用，請使用 `DISABLED` 取代 `ENABLED`。您也可以傳遞以空格分隔的帳戶 ID 清單。

若要尋找`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。

```
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. 前往 [https://console.aws.amazon.com/guardduty/](https://console.aws.amazon.com/guardduty/) 開啟 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 保護的區域。

  若要尋找`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。

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

------