# 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 콘솔에서 로깅을 구성할 때 Panther가 현재 다른 로그 유형을 지원하지 않으므로 다음 **감사** 와 **Authenticator** 로그 유형에 대해서만 로깅을 활성화해야 합니다.

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

EKS 컨트롤 플레인 로깅을 활성화한 후 EKS 감사 및 인증자 로그가 CloudWatch Logs에서 사용 가능해집니다. 이제 Panther에서 CloudWatch Logs 소스를 설정할 시간입니다.

1. Panther 콘솔의 왼쪽 탐색 모음에서 클릭하세요 **구성** > **로그 소스**.
2. 오른쪽 상단에서 클릭하세요 **새로 만들기**.
3. 을 클릭하세요 **사용자 지정 로그 형식** 타일을 클릭합니다.
4. 페이지에서 **AWS CloudWatch Logs** 타일에서 **에 대해 자세히 알아보세요**.
5. "소스 구성" 페이지에서 다음 필드를 채우세요:
   * **이름:** 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. 를 선택하고 Panther가 설치된 계정 ID를 입력하십시오. **설정**.

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

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

1. 설치하지 마세요! **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 콘솔에서 **버킷 이름** 와 **역할 ARN** 를 입력하세요.
   * CloudFormation 스택 생성이 완료되면 AWS의 스택 "Outputs" 섹션에서 리소스 ARN을 찾을 수 있습니다.

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

3단계: 소스 설정 완료

<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의 사전 작성된 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
필드:
  - name: responseObject
    type: object
    필드:
      - name: secrets
        type: array
        element:
          type: object
          필드:
            - 이름: name
              required: true
              type: string
      - name: rules
        type: array
        element:
          type: object
          필드:
            - name: apiGroups
              type: array
              element:
                type: string
            - name: resources
              type: array
              element:
                type: string
            - name: verbs
              type: array
              element:
                type: string
      - name: spec
        유형: json
      - name: apiVersion
        type: string
      - name: kind
        type: string
      - 이름: metadata
        type: object
        필드:
          - name: namespace
            type: string
          - name: annotations
            유형: json
          - name: creationTimestamp
            type: timestamp
            timeFormats:
              - rfc3339
          - 이름: labels
            유형: json
          - name: managedFields
            type: array
            element:
              type: object
              필드:
                - name: apiVersion
                  type: string
                - name: fieldsType
                  type: string
                - name: manager
                  type: string
                - 이름: operation
                  type: string
                - 이름: time
                  type: timestamp
                  timeFormats:
                    - rfc3339
          - 이름: name
            type: string
          - name: resourceVersion
            type: string
          - 이름: uid
            type: string
          - name: ownerReferences
            유형: json
  - name: requestObject
    type: object
    필드:
      - name: rules
        type: array
        element:
          type: object
          필드:
            - name: apiGroups
              type: array
              element:
                type: string
            - name: resources
              type: array
              element:
                type: string
            - name: verbs
              type: array
              element:
                type: string
      - name: spec
        유형: json
      - name: apiVersion
        type: string
      - name: kind
        type: string
      - 이름: metadata
        type: object
        필드:
          - name: annotations
            유형: json
          - name: namespace
            type: string
          - 이름: labels
            유형: json
          - 이름: name
            type: string
          - name: ownerReferences
            유형: json
          - name: resourceVersion
            type: string
      - 이름: status
        type: object
        필드:
          - name: $setElementOrder/conditions
            type: array
            element:
              type: object
              필드:
                - 이름: type
                  type: string
          - name: conditions
            type: array
            element:
              type: object
              필드:
                - name: lastHeartbeatTime
                  type: timestamp
                  timeFormats:
                    - rfc3339
                - 이름: type
                  type: string
  - name: objectRef
    type: object
    필드:
      - name: subresource
        type: string
      - name: resourceVersion
        type: string
      - 이름: uid
        type: string
      - name: namespace
        type: string
      - 이름: name
        type: string
      - name: apiGroup
        type: string
      - name: apiVersion
        required: true
        type: string
      - 이름: resource
        required: true
        type: string
  - name: annotations
    유형: json
  - name: apiVersion
    required: true
    type: string
  - name: auditID
    required: true
    type: string
  - name: kind
    required: true
    type: string
  - 이름: level
    required: true
    type: string
  - name: requestReceivedTimestamp
    required: true
    type: timestamp
    timeFormats:
      - rfc3339
    isEventTime: true
  - name: requestURI
    type: string
  - name: responseStatus
    type: object
    필드:
      - 이름: reason
        type: string
      - name: message
        type: string
      - 이름: status
        type: string
      - 이름: code
        required: true
        type: bigint
  - name: sourceIPs
    required: true
    type: array
    element:
      type: string
      지표:
        - ip
  - 이름: stage
    required: true
    type: string
  - name: stageTimestamp
    required: true
    type: timestamp
    timeFormats:
      - rfc3339
  - name: user
    required: true
    type: object
    필드:
      - name: extra
        type: object
        필드:
          - 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
              지표:
                - aws_arn
          - name: canonicalArn
            type: array
            element:
              type: string
              지표:
                - aws_arn
          - name: sessionName
            type: array
            element:
              type: string
      - 이름: uid
        type: string
      - 이름: groups
        type: array
        element:
          type: string
      - 이름: username
        type: string
        지표:
          - username
  - 이름: userAgent
    type: string
  - name: verb
    required: true
    type: string

```

### Amazon.EKS.Authenticator

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

```yaml
필드:
    - 이름: timestamp
      required: true
      설명: 타임스탬프
      type: timestamp
      시간 형식: rfc3339
      isEventTime: true
    - 이름: 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
      지표:
        - aws_account_id
    - name: arn
      description: arn
      type: string
      지표:
        - aws_arn
    - name: client
      description: client
      type: string
    - name: method
      description: method
      type: string
    - name: path
      description: path
      type: string
    - 이름: session
      description: session
      type: string
    - 이름: user_id
      description: user_id
      type: string
    - 이름: groups
      description: groups
      type: string
    - 이름: uid
      description: uid
      type: string
      지표:
        - trace_id
    - 이름: username
      description: username
      type: string
      지표:
        - username
```
