# Okta 로그

## 개요

Panther는 다음을 쿼리하여 Okta 이벤트를 가져올 수 있습니다 [Okta 시스템 로그 API](https://developer.okta.com/docs/reference/api/system-log/). Panther는 System Log API를 1분마다 쿼리합니다. Panther가 API에 액세스하려면 새 API 토큰을 생성하거나 기존 토큰을 사용해야 합니다.

또한 활성화할 수 있습니다 [Okta 사용자 및 디바이스 프로필](https://docs.panther.com/ko/enrichment/okta).

### 비디오 안내

{% embed url="<https://youtu.be/QqoddCp1Vy8>" %}
Okta 로그를 Panther에 온보딩하는 방법을 보여주는 비디오 안내
{% endembed %}

## Okta 로그를 Panther에 온보딩하는 방법

### 1단계: 새 Okta API 토큰 생성

{% hint style="info" %}
System Logs를 쿼리할 권한을 가진 Okta API 토큰을 생성하려면 다음 유형의 Okta 관리자 중 하나로 로그인되어 있어야 합니다: [수퍼 관리자](https://help.okta.com/en-us/Content/Topics/Security/administrators-super-admin.htm), [조직 관리자](https://help.okta.com/en-us/Content/Topics/Security/administrators-org-admin.htm), 또는 [읽기 전용 관리자](https://help.okta.com/en-us/Content/Topics/Security/administrators-read-only-admin.htm).

권장되는 것은 [읽기 전용 관리자](https://help.okta.com/en-us/Content/Topics/Security/administrators-read-only-admin.htm) 최소 권한을 위한 역할입니다.

참조 [Okta 문서](https://help.okta.com/en-us/Content/Topics/Security/Administrators.htm) 관리자 역할 관리를 위한 자세한 정보는
{% endhint %}

1. Okta 관리자 계정으로 로그인합니다.
2. Okta 관리 콘솔에서 다음으로 이동합니다 **보안** > **API.**
3. 콘솔로. **토큰** 탭을 클릭하세요.
4. 를 선택하고 Panther가 설치된 계정 ID를 입력하십시오. **토큰 생성.**
5. 토큰에 대한 설명 이름을 입력하세요. 예: `Panther API 토큰`.
6. 다음 값을 복사하세요 **토큰 값** 을 안전한 장소에 저장하세요. 다음 단계에서 필요합니다.
   * **참고**: Okta는 이 값을 다시 표시하지 않습니다.

### 2단계: Panther에서 새 Okta 소스 생성

1. Panther 콘솔의 왼쪽 탐색 창에서 **구성** > **로그 소스**.
2. 를 선택하고 Panther가 설치된 계정 ID를 입력하십시오. **새로 만들기.**
3. “Okta”를 검색한 후 해당 타일을 클릭하세요.
4. 슬라이드 아웃 패널에서 클릭하세요 **설정 시작**.
5. 페이지에서 **구성** 페이지에서 다음 필드를 입력하세요:
   * **이름**: 소스에 대한 설명 이름을 입력하세요. 예: `내 Okta 로그`.
   * **Okta 하위 도메인**: Okta 조직 도메인의 하위 도메인을 입력하세요. Okta 조직 도메인에 대한 자세한 내용은 [Okta 문서](https://developer.okta.com/docs/guides/find-your-domain/main/) 를 참조하세요.
   * **Okta 도메인**: Okta 도메인 드롭다운에서 적절한 도메인 이름을 선택하세요.
   * **API 토큰**: 이전 단계에서 생성한 토큰 값을 입력하세요.
6. 를 선택하고 Panther가 설치된 계정 ID를 입력하십시오. **설정**.
7. 페이지에서 **인리치먼트** 페이지에서, 다음을 활성화하려면 [Okta 아이덴티티 프로필](https://docs.panther.com/ko/enrichment/okta), 오른쪽의 **사용자 프로필** 및/또는 **디바이스 프로필**, 토글을 클릭하세요 `켜기`.

   * 참고 [Okta 디바이스 프로필을 활성화하기 위한 전제 조건](https://docs.panther.com/ko/enrichment/okta#prerequisite-for-okta-device-profiles).
   * 각각의 토글이 `켜기`로 설정된 경우, **새로고침 주기(분)**&#xC744; 설정하세요. 이는 Panther가 Okta에 저장된 내용으로 프로필 데이터를 업데이트하는 주기를 나타냅니다.

   <figure><img src="https://2400888838-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-a5770bea3f5313f650d98bd7ad15aa0a7f03a4a6%2FScreenshot%202023-10-04%20at%205.19.36%20PM.png?alt=media" alt="On the Enrichment settings page of the Create Okta source flow, there are toggles for User Profiles and Device Profiles. Next to each of the toggles is a Refresh period (min) field." width="375"><figcaption></figcaption></figure>
8. 를 선택하고 Panther가 설치된 계정 ID를 입력하십시오. **설정**. 성공 화면으로 이동됩니다:\\

   <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 관리](https://docs.panther.com/ko/detections/panther-managed) 의 Okta 룰 [panther-analysis GitHub 리포지토리](https://github.com/panther-labs/panther-analysis/tree/main/rules/okta_rules). 여기에는 다음이 포함됩니다:

* [Okta 관리자 역할 할당](https://github.com/panther-labs/panther-analysis/blob/cd220c87982011d4ad156c7daecd2857c358d154/rules/okta_rules/okta_admin_role_assigned.py) - 사용자가 Okta에서 관리 권한을 부여받음
* [Okta API 키 생성](https://github.com/panther-labs/panther-analysis/blob/cd220c87982011d4ad156c7daecd2857c358d154/rules/okta_rules/okta_api_key_created.py) - 사용자가 Okta에서 API 키를 생성함
* [Okta API 키 취소](https://github.com/panther-labs/panther-analysis/blob/cd220c87982011d4ad156c7daecd2857c358d154/rules/okta_rules/okta_api_key_revoked.py) - 사용자가 Okta에서 API 키를 취소함
* [지리적으로 불가능한 Okta 로그인](https://github.com/panther-labs/panther-analysis/blob/cd220c87982011d4ad156c7daecd2857c358d154/rules/okta_rules/okta_geo_improbable_access.py) - 사용자가 지리적으로 매우 멀리 떨어진 두 위치에서 연속으로 로그인함
* [Okta MFA 전역 비활성화](https://github.com/panther-labs/panther-analysis/blob/cd220c87982011d4ad156c7daecd2857c358d154/rules/okta_rules/okta_admin_disabled_mfa.py) - 관리자가 Okta 시스템 전체 MFA를 비활성화함
* [Okta 지원 자격 증명 재설정](https://github.com/panther-labs/panther-analysis/blob/cd220c87982011d4ad156c7daecd2857c358d154/rules/okta_rules/okta_support_reset.py) - Okta 지원팀이 사용자의 비밀번호 또는 MFA를 재설정함
* [Okta 지원 액세스 부여](https://github.com/panther-labs/panther-analysis/blob/cd220c87982011d4ad156c7daecd2857c358d154/rules/okta_rules/okta_account_support_access.py) - Okta 지원 접근이 부여됨

## 커스텀 디텍션

#### 예시로 보고된 의심스러운 동작

사용자가 자신의 계정에서 의심스러운 동작을 보고했습니다:

```python
def rule(event):
    if event.get('eventtype') == 'user.account.report_suspicious_activity_by_enduser':
        return True
```

#### 커스텀 디텍션 패턴

아래는 Okta 로그에 대한 커스텀 디텍션을 작성할 때 흔히 사용하는 함수와 예시입니다 [`deep_get()`](https://docs.panther.com/ko/detections/rules/python#deep_get) Okta의 다양한 이벤트 타입에 대한 자세한 내용은 Okta [문서](https://developer.okta.com/docs/reference/api/event-types/).

```python
#Okta에는 여기에 나열된 많은 이벤트 타입이 있습니다. 이러한 eventtype 중 하나를 기반으로 디텍션을 시작할 수 있습니다
#https://developer.okta.com/docs/reference/api/event-types/
event.get('eventtype')

#도시, 주, 위도, 경도 등에 액세스하려면 
deep_get(event, 'client', 'geographicalContext', 'city')
deep_get(event, 'client', 'geographicalContext', 'state')
deep_get(event, 'client', 'geographicalContext', 'country')
deep_get(event, 'client', 'geographicalContext', 'geolocation', 'lon')
deep_get(event, 'client', 'geographicalContext', 'geolocation', 'lat')

#이벤트의 출처에 대한 세부 정보
deep_get(event, 'client' 'device')
deep_get(event, 'client', 'ipAddress')
deep_get(event, 'client', 'userAgent')


deep_get(event, 'actor', 'alternateId')
deep_get(event, 'actor', 'displayName')

## Okta와 함께 유용할 수 있는 전역 헬퍼

# panther_base_helpers 내에서
def okta_alert_context(event: dict):
    """Okta 알러트 자동화를 위한 공통 컨텍스트를 반환합니다"""
    return {
        "ips": event.get("p_any_ip_addresses", []),
        "actor": event.get("actor", ""),
        "target": event.get("target", ""),
        "client": event.get("client", ""),
    }
    
# panther_base_helpers 내에서
def is_ip_in_network(ip_addr, networks):
    """주어진 IP가 IP 범위 목록 내에 있는지 확인합니다"""
    return any(ip_address(ip_addr) in ip_network(network) for network in networks)
```

## 지원되는 로그 유형

### Okta.SystemLog

Okta 시스템 로그는 조직과 관련된 시스템 이벤트를 기록하여 플랫폼 활동을 이해하고 문제를 진단하는 데 사용할 수 있는 감사 추적을 제공합니다.

참고: [System Log API에 대한 Okta 문서.](https://developer.okta.com/docs/reference/api/system-log/)

```yaml
스키마: Okta.SystemLog
설명: |
    Okta 시스템 로그는 조직과 관련된 시스템 이벤트를 기록하여 플랫폼 활동을 이해하고 문제를 진단하는 데 사용할 수 있는 감사 추적을 제공합니다.
참고URL: https://developer.okta.com/docs/reference/api/system-log/
필드:
    - name: uuid
      required: true
      description: 개별 이벤트에 대한 고유 식별자
      type: string
    - name: published
      required: true
      description: 이벤트가 게시된 타임스탬프
      type: timestamp
      시간 형식: rfc3339
      isEventTime: true
    - name: eventType
      required: true
      description: 게시된 이벤트의 유형
      type: string
    - name: version
      required: true
      description: 버전 표시기
      type: string
    - 이름: severity
      required: true
      description: '이벤트의 심각도를 나타냅니다: DEBUG, INFO, WARN, ERROR'
      type: string
    - name: legacyEventType
      description: 연관된 Events API Action objectType 속성 값
      type: string
    - name: displayMessage
      description: 이벤트에 대한 표시 메시지
      type: string
    - name: actor
      description: 작업을 수행한 엔티티를 설명함
      type: object
      필드:
        - 이름: id
          required: true
          description: 액터의 ID
          type: string
        - 이름: type
          required: true
          description: 액터의 유형
          type: string
        - name: alternateId
          description: 액터의 대체 ID
          type: string
          지표:
            - 이메일
        - name: displayName
          description: 액터의 표시 이름
          type: string
        - 이름: details
          description: 액터에 대한 세부 정보
          유형: json
        - name: detailEntry
          description: 상세 항목
          유형: json
    - name: client
      description: 작업을 요청한 클라이언트
      type: object
      필드:
        - 이름: id
          description: OAuth 요청의 경우 요청을 하는 OAuth 클라이언트의 ID입니다. SSWS 토큰 요청의 경우 요청을 하는 에이전트의 ID입니다.
          type: string
        - 이름: userAgent
          description: 액터가 작업을 수행할 때 사용한 사용자 에이전트
          type: object
          필드:
            - 이름: browser
              description: 클라이언트가 웹 브라우저인 경우 이 필드는 웹 브라우저의 유형을 식별합니다(예: CHROME, FIREFOX)
              type: string
            - 이름: os
              description: 클라이언트가 실행되는 운영 체제(예: Windows 10)
              type: string
            - name: rawUserAgent
              description: HTTP/1.1 의미 및 내용의 섹션 5.5.3에 따라 형식화된 사용자 에이전트의 원시 문자열 표현입니다. 브라우저 및 OS 필드는 이 필드에서 유도될 수 있습니다.
              type: string
        - name: geographicalContext
          description: 클라이언트가 요청을 보낸 물리적 위치
          type: object
          필드:
            - name: geolocation
              description: 지리적 위치 좌표(위도, 경도)를 포함함
              type: object
              필드:
                - name: lat
                  description: 위도
                  type: float
                - name: lon
                  description: 경도
                  type: float
            - 이름: city
              description: 지리적 위치 좌표를 포함하는 영역을 포괄하는 도시(예: Seattle, San Francisco), 사용 가능한 경우
              type: string
            - name: state
              description: 지리적 위치 좌표를 포함하는 영역을 포괄하는 주/도 전체 이름(예: Montana, Incheon)
              type: string
            - 이름: country
              description: 지리적 위치 좌표를 포함하는 영역을 포괄하는 국가의 전체 이름(예: France, Uganda)
              type: string
            - name: postalCode
              description: 지리적 위치 좌표를 포함하는 영역을 포괄하는 국가의 전체 이름(예: France, Uganda)
              type: string
        - 이름: zone
          description: 클라이언트 위치가 매핑된 존(Zone)의 이름
          type: string
        - name: ipAddress
          description: 클라이언트가 요청을 보낸 IP 주소
          type: string
          지표:
            - ip
        - name: device
          description: 클라이언트가 사용한 디바이스 유형(예: Computer)
          type: string
    - 이름: request
      description: 작업을 시작한 요청
      type: object
      필드:
        - name: ipChain
          description: 들어오는 요청이 프록시를 통과하는 경우 해당 프록시들의 IP 주소가 (clientIp, proxy1, proxy2, ...) 형식으로 여기에 저장됩니다.
          type: array
          element:
            type: object
            필드:
                - 이름: ip
                  description: IP 주소
                  type: string
                  지표:
                    - ip
                - name: geographicalContext
                  description: IP 주소의 지리적 컨텍스트
                  type: object
                  필드:
                    - name: geolocation
                      description: 지리적 위치 좌표(위도, 경도)를 포함함
                      type: object
                      필드:
                        - name: lat
                          description: 위도
                          type: float
                        - name: lon
                          description: 경도
                          type: float
                    - 이름: city
                      description: 지리적 위치 좌표를 포함하는 영역을 포괄하는 도시(예: Seattle, San Francisco), 사용 가능한 경우
                      type: string
                    - name: state
                      description: 지리적 위치 좌표를 포함하는 영역을 포괄하는 주/도 전체 이름(예: Montana, Incheon)
                      type: string
                    - 이름: country
                      description: 지리적 위치 좌표를 포함하는 영역을 포괄하는 국가의 전체 이름(예: France, Uganda)
                      type: string
                    - name: postalCode
                      description: 지리적 위치 좌표를 포함하는 영역을 포괄하는 국가의 전체 이름(예: France, Uganda)
                      type: string
                - name: version
                  description: IP 버전
                  type: string
                - name: source
                  description: 소스에 대한 세부 사항
                  type: string
    - name: outcome
      description: 작업의 결과
      type: object
      필드:
        - 이름: result
          description: '작업의 결과: SUCCESS, FAILURE, SKIPPED, ALLOW, DENY, CHALLENGE, UNKNOWN'
          type: string
        - 이름: reason
          description: 예: INVALID_CREDENTIALS와 같은 결과에 대한 이유
          type: string
    - name: target
      description: 작업의 대상이 될 수 있는 0개 이상 항목
      type: array
      element:
        type: object
        필드:
            - 이름: id
              required: true
              description: 대상의 ID
              type: string
            - 이름: type
              required: true
              description: 대상의 유형
              type: string
            - name: alternateId
              description: 대상의 대체 ID
              type: string
            - name: displayName
              description: 대상의 표시 이름
              type: string
            - 이름: details
              description: 대상에 대한 세부 사항
              유형: json
            - name: detailEntry
              description: 상세 항목
              유형: json
            - name: changeDetails
              description: 변경에 대한 세부 정보
              유형: json
    - name: transaction
      description: 작업의 트랜잭션 세부 정보
      type: object
      필드:
        - 이름: id
          description: 이 트랜잭션의 고유 식별자.
          type: string
        - 이름: type
          description: 트랜잭션의 종류를 설명합니다. WEB은 웹 요청을 나타냅니다. JOB은 비동기 작업을 나타냅니다.
          type: string
        - 이름: detail
          description: 이 트랜잭션에 대한 세부 정보.
          유형: json
    - name: debugContext
      description: 작업의 디버그 요청 데이터
      type: object
      필드:
        - name: debugData
          description: 이벤트 타입에 따라 달라지는 다양한 정보를 포함하는 동적 필드.
          유형: json
    - name: authenticationContext
      description: 작업의 인증 데이터
      type: object
      필드:
        - name: authenticationProvider
          description: 제공된 자격 증명을 사용하여 액터의 신원을 증명하는 시스템
          type: string
        - name: authenticationStep
          description: 인증 파이프라인에서의 0부터 시작하는 단계 번호입니다. 현재 사용되지 않으며 항상 0으로 설정됩니다.
          유형: int
        - name: credentialProvider
          description: 크레덴셜 제공자는 ID 및 관련 자격 증명을 관리하는 소프트웨어 서비스입니다. 인증이 크레덴셜 제공자가 제공한 자격 증명을 통해 발생하면 해당 크레덴셜 제공자가 여기 기록됩니다.
          type: string
        - name: credentialType
          description: 크레덴셜에 사용된 기반 기술/스킴
          type: string
        - name: rootSessionId
          type: string
        - name: issuer
          description: 크레덴셜을 생성하고 발급한 특정 소프트웨어 엔티티.
          type: object
          필드:
            - 이름: id
              description: 인증 유형에 따라 다릅니다. 인증이 SAML 2.0인 경우 id는 SAML 어설션의 발급자입니다. 소셜 로그인의 경우 id는 토큰의 발급자입니다.
              type: string
            - 이름: type
              description: SAML 어설션 또는 토큰의 발급자 및 출처에 관한 정보.
              type: string
        - name: externalSessionId
          description: 액터의 세션 ID에 대한 대리자
          type: string
        - name: interface
          description: 액터가 인증하는 제3자 사용자 인터페이스(있는 경우).
          type: string
        - name: authenticatorProvider
          description: '권장되지 않음: 이 필드는 하위 호환성을 위해 유지됩니다.'
          type: string
    - name: securityContext
      description: 작업의 보안 데이터
      type: object
      필드:
        - name: asNumber
          description: 이벤트 요청의 출처인 자율 시스템과 연결된 자율 시스템 번호
          type: bigint
        - name: asOrg
          description: 이벤트 요청의 출처인 자율 시스템과 연결된 조직
          type: string
        - name: isp
          description: 이벤트 요청을 전송하는 데 사용된 인터넷 서비스 제공자
          type: string
        - name: domain
          description: 수신 이벤트 요청의 IP 주소와 연결된 도메인 이름
          type: string
          지표:
            - 도메인
        - name: isProxy
          description: 이벤트의 요청이 알려진 프록시에서 발생했는지 여부를 지정함
          유형: boolean
```
