# AWS EKS

## 개요

Panther는 AWS CloudWatch Logs를 통해 Amazon Web Services(AWS) Elastic Kubernetes Service(EKS) 로그 수집을 지원합니다.

EKS는 로그를 S3로 직접 보낼 수 없습니다. 대신 EKS 로그를 다음으로 보내야 합니다. [CloudWatch Logs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/WhatIsCloudWatchLogs.html)로 보낸 다음, [Kinesis Data Firehose](https://aws.amazon.com/kinesis/data-firehose/?p=pm\&c=aa\&pd=kinesis\&z=4) 를 구성하여 이를 S3 버킷으로 전송해야 하며, Panther는 그 버킷에서 로그를 읽습니다.

## AWS 온보딩 방법 **EKS** 로그를 Panther에

### 1단계: EKS 제어 평면 로깅 활성화

EKS 제어 평면 로그를 활성화하면 AWS가 이를 CloudWatch Logs로 라우팅하기 시작합니다.

* 다음을 따르세요. [EKS 제어 평면 로깅을 활성화하는 AWS 문서](https://docs.aws.amazon.com/eks/latest/userguide/control-plane-logs.html).
  * EKS 콘솔에서 로깅을 구성할 때는 다음에 대해서만 로깅을 활성화하도록 하세요. **Audit** 및 **Authenticator** 로그 유형. Panther는 현재 다른 로그 유형은 지원하지 않습니다.

### 2단계: Panther 콘솔에서 CloudWatch Logs 소스 구성

EKS 제어 평면 로깅을 활성화하면 EKS 감사 및 인증자 로그를 CloudWatch Logs에서 사용할 수 있습니다. 이제 Panther에서 CloudWatch Logs 소스를 설정할 차례입니다.

1. Panther Console의 왼쪽 탐색 표시줄에서 클릭하세요 **구성** > **로그 소스**.
2. 오른쪽 상단에서 다음을 클릭하세요 **새로 만들기**.
3. 다음을 클릭하세요. **사용자 지정 로그 형식** 타일.
4. 다음 항목에서 **AWS CloudWatch Logs** 타일에서 다음을 클릭합니다 **시작**.
5. "소스 구성" 페이지에서 다음 필드를 입력하세요.
   * **Name:** CloudWatch Logs 소스의 설명이 되는 이름을 입력합니다.
   * **로그 그룹 이름**: CloudWatch Logs 그룹의 고유 이름을 입력합니다. AWS CloudWatch Logs LogGroup의 이름 형식은 다음과 같습니다. `/aws/eks/{your_cluster_name}/cluster`
   * **AWS 계정 ID**: EKS 클러스터를 호스팅하는 AWS 계정의 ID 번호를 입력합니다.
   * (선택 사항) **패턴 필터**: 로그 이벤트를 필터링할 패턴을 입력합니다. 다음을 참조하세요. [AWS CloudWatch Logs 패턴 필터 문서](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html) 자세히 알아보세요.
   * **로그 유형**: `Amazon.EKS.Audit` 및 `Amazon.EKS.Authenticator`.
6. 다음을 클릭하세요. **설정**.

### 3단계: S3 버킷, Kinesis Data Firehose 및 IAM 역할 설정

Panther가 CloudWatch Logs 소스에서 객체를 읽으려면 다양한 AWS 리소스가 필요합니다. 이를 구성하기 위해 Panther는 S3 버킷, Kinesis Data Firehose, IAM 역할 및 기타 필요한 리소스를 설정하는 CloudFormation 템플릿을 제공합니다.

1. Panther 콘솔에서 **AWS 콘솔 UI 사용**를 클릭하세요. 템플릿이 미리 채워진 상태로 AWS CloudFormation 콘솔 UI로 이동합니다.
   * 템플릿을 다운로드하여 자체 파이프라인을 통해 적용하거나, 리소스를 수동으로 구성할 수도 있습니다. 자세한 내용은 다음을 참조하세요. [CloudWatch Logs 소스 문서](https://docs.panther.com/ko/data-transports/aws/cloudwatch#setup-an-iam-role).
2. EKS 클러스터가 호스팅되는 AWS 계정 ID와 리전에 CloudFormation 스택 템플릿을 설치하세요.
   * CloudFormation 스택 생성이 완료될 때까지 기다리세요.
3. CloudFormation 스택이 준비되면 Panther 콘솔에서 **Bucket Name** 및 **Role ARN** 을 입력하세요.
   * CloudFormation 스택 생성이 완료되면 AWS의 스택 "Outputs" 섹션에서 리소스 ARN을 찾을 수 있습니다.

### 4단계: Panther에서 소스 설정 완료

에 명시된 역할과 권한이 있는 Zoom 계정에 로그인되어 있어야 한다는 점을 기억하세요

<figure><img src="https://2400888838-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-e55cedf82c6a6adc66ec5c14ebdcb164c3b1dcca%2FScreenshot%202023-08-03%20at%204.33.30%20PM.png?alt=media" alt="The success screen reads, &#x22;Everything looks good! Panther will now automatically pull &#x26; process logs from your account&#x22;" width="281"><figcaption></figcaption></figure>

* 선택적으로 하나 이상의 [디택션 팩](https://docs.panther.com/detections/panther-managed/packs).
* 다음 **이벤트가 처리되지 않을 때 알러트 트리거** 설정 기본값은 **예**. 이 기능을 활성화된 상태로 두는 것을 권장합니다. 일정 시간이 지난 후 로그 소스에서 데이터 전송이 중단되면 알림을 받게 됩니다. 이 시간 범위는 구성할 수 있으며 기본값은 24시간입니다.\\

  <figure><img src="https://2400888838-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-c48119abd559990173004bde99ff4907fdd2ded2%2FScreenshot%202023-08-03%20at%204.26.54%20PM.png?alt=media" alt="The &#x22;Trigger an alert when no events are processed&#x22; toggle is set to YES. The &#x22;How long should Panther wait before it sends you an alert that no events have been processed&#x22; setting is set to 1 Day" width="320"><figcaption></figcaption></figure>

## Panther가 만든 탐지

에서 Panther의 미리 작성된 AWS 규칙을 확인하세요 [panther-analysis GitHub 저장소](https://github.com/panther-labs/panther-analysis/tree/master/rules).

## 지원되는 AWS EKS 로그 유형

Panther는 지원합니다 [Amazon.EKS.Audit](#amazon.eks.audit) 및 [Amazon.EKS.Authenticator](#amazon.eks.authenticator) 로그.

### Amazon.EKS.Audit

EKS 감사 로그는 클러스터에 영향을 준 개별 사용자, 관리자 또는 시스템 구성요소의 기록을 제공합니다. 자세한 내용은 다음을 참조하세요. [EKS 제어 평면 로그에 대한 AWS 문서](https://docs.aws.amazon.com/eks/latest/userguide/control-plane-logs.html).

```yaml
fields:
  - name: responseObject
    type: object
    fields:
      - name: secrets
        type: array
        element:
          type: object
          fields:
            - name: name
              required: true
              type: string
      - name: rules
        type: array
        element:
          type: object
          fields:
            - name: apiGroups
              type: array
              element:
                type: string
            - name: resources
              type: array
              element:
                type: string
            - name: verbs
              type: array
              element:
                type: string
      - name: spec
        type: json
      - name: apiVersion
        type: string
      - name: kind
        type: string
      - 이름: metadata
        type: object
        fields:
          - name: namespace
            type: string
          - name: annotations
            type: json
          - name: creationTimestamp
            type: timestamp
            timeFormats:
              - rfc3339
          - name: labels
            type: json
          - name: managedFields
            type: array
            element:
              type: object
              fields:
                - name: apiVersion
                  type: string
                - name: fieldsType
                  type: string
                - 이름: manager
                  type: string
                - name: operation
                  type: string
                - name: time
                  type: timestamp
                  timeFormats:
                    - rfc3339
          - name: name
            type: string
          - name: resourceVersion
            type: string
          - name: uid
            type: string
          - name: ownerReferences
            type: json
  - name: requestObject
    type: object
    fields:
      - name: rules
        type: array
        element:
          type: object
          fields:
            - name: apiGroups
              type: array
              element:
                type: string
            - name: resources
              type: array
              element:
                type: string
            - name: verbs
              type: array
              element:
                type: string
      - name: spec
        type: json
      - name: apiVersion
        type: string
      - name: kind
        type: string
      - 이름: metadata
        type: object
        fields:
          - name: annotations
            type: json
          - name: namespace
            type: string
          - name: labels
            type: json
          - name: name
            type: string
          - name: ownerReferences
            type: json
          - name: resourceVersion
            type: string
      - name: status
        type: object
        fields:
          - name: $setElementOrder/conditions
            type: array
            element:
              type: object
              fields:
                - 이름: type
                  type: string
          - name: conditions
            type: array
            element:
              type: object
              fields:
                - name: lastHeartbeatTime
                  type: timestamp
                  timeFormats:
                    - rfc3339
                - 이름: type
                  type: string
  - name: objectRef
    type: object
    fields:
      - name: subresource
        type: string
      - name: resourceVersion
        type: string
      - name: uid
        type: string
      - name: namespace
        type: string
      - name: name
        type: string
      - name: apiGroup
        type: string
      - name: apiVersion
        required: true
        type: string
      - name: resource
        required: true
        type: string
  - name: annotations
    type: json
  - name: apiVersion
    required: true
    type: string
  - name: auditID
    required: true
    type: string
  - name: kind
    required: true
    type: string
  - name: level
    required: true
    type: string
  - name: requestReceivedTimestamp
    required: true
    type: timestamp
    timeFormats:
      - rfc3339
    isEventTime: true
  - name: requestURI
    type: string
  - name: responseStatus
    type: object
    fields:
      - name: reason
        type: string
      - name: message
        type: string
      - name: status
        type: string
      - name: code
        required: true
        유형: bigint
  - name: sourceIPs
    required: true
    type: array
    element:
      type: string
      indicators:
        - ip
  - name: stage
    required: true
    type: string
  - name: stageTimestamp
    required: true
    type: timestamp
    timeFormats:
      - rfc3339
  - name: user
    required: true
    type: object
    fields:
      - name: extra
        type: object
        fields:
          - name: authentication.kubernetes.io/pod-name
            type: array
            element:
              type: string
          - name: authentication.kubernetes.io/pod-uid
            type: array
            element:
              type: string
          - name: accessKeyId
            type: array
            element:
              type: string
          - name: arn
            type: array
            element:
              type: string
              indicators:
                - aws_arn
          - name: canonicalArn
            type: array
            element:
              type: string
              indicators:
                - aws_arn
          - name: sessionName
            type: array
            element:
              type: string
      - name: uid
        type: string
      - name: groups
        type: array
        element:
          type: string
      - name: username
        type: string
        indicators:
          - username
  - 이름: userAgent
    type: string
  - name: verb
    required: true
    type: string

```

### Amazon.EKS.Authenticator

이 로그는 EKS가 IAM 자격 증명을 사용해 Kubernetes 역할 기반 액세스 제어(RBAC) 인증에 사용하는 제어 평면 구성요소를 나타냅니다. 자세한 내용은 다음을 참조하세요. [EKS 제어 평면 로그에 대한 AWS 문서](https://docs.aws.amazon.com/eks/latest/userguide/control-plane-logs.html).

```yaml
fields:
    - 이름: timestamp
      required: true
      description: timestamp
      type: timestamp
      timeFormat: rfc3339
      isEventTime: true
    - name: level
      required: true
      description: level
      type: string
    - name: access_key_id
      description: access_key_id
      type: string
    - name: message
      required: true
      description: message
      type: string
    - name: account_id
      description: account_id
      type: string
      indicators:
        - aws_account_id
    - name: arn
      description: arn
      type: string
      indicators:
        - aws_arn
    - name: client
      description: client
      type: string
    - name: method
      description: method
      type: string
    - name: path
      description: path
      type: string
    - name: session
      description: session
      type: string
    - name: user_id
      description: user_id
      type: string
    - name: groups
      description: groups
      type: string
    - name: uid
      description: uid
      type: string
      indicators:
        - trace_id
    - name: username
      description: username
      type: string
      indicators:
        - username
```
