# Custom Enrichments 사용: 1Password UUID

## 개요

기본적으로 1Password 로그에는 vault 및 로그인 자격 증명과 같은 객체의 사람이 읽을 수 있는 값이 포함되지 않습니다. 대신 각 객체는 Universally Unique Identifier(UUID)로 참조됩니다. Panther에서 사용자 정의 enrichment를 사용하여 UUID를 친숙한 이름으로 변환할 수 있습니다. 명령줄 인터페이스(CLI) 사용을 권장하지만, API를 사용하는 것도 가능합니다.

다음 예에서는 CLI를 통해 1Password 항목 목록과 해당 UUID를 추출한 다음, UUID를 사람이 읽을 수 있는 친숙한 이름으로 변환하는 사용자 정의 enrichment를 만들었습니다.

### **사전 요구 사항**

* 기존 [1Password 로그 소스](https://docs.panther.com/ko/data-onboarding/supported-logs/1password) 데이터가 Panther 계정으로 수집되고 있는
* 명령줄 유틸리티 `jq` 설치됨
* The [1Password 명령줄 도구](https://1password.com/downloads/command-line/) 설치되어 있습니다

## **관련 UUID가 포함된 1Password 항목 목록 가져오기**

1. CLI를 통해 1Password에 로그인합니다.
2. 다음 함수를 사용하여 관련 UUID를 포함한 1Password 항목 목록을 추출하고, 이를 다음 이름의 JSON 파일로 저장합니다 *1password\_enrichment.json*:\
   `op item list --format json | jq -c '.[] | {uuid:.id,title:.title,updatedAt:.updatedat}' >> 1password_enrichment.json`

   \
   또는 1Password CLI v1을 사용하는 경우 다음 명령을 사용합니다:

   * `op list items | jq -c '.[] | {uuid:.uuid,title:.overview.title,updatedAt:.updatedAt}' >> 1password_enrichment.json`

{% hint style="info" %}
이후 단계에서 이 1password\_enrichment.json을 사용하여 스키마를 만들어야 합니다.

스키마 생성에 대한 자세한 내용은 다음을 참조하세요 [사용자 지정 로그](https://docs.panther.com/ko/data-onboarding/custom-log-types#how-to-define-a-custom-schema).
{% endhint %}

## **Panther에서 사용자 정의 enrichment 만들기**

1. Panther Console에 로그인합니다. 왼쪽 탐색에서 **Configure > Enrichments**.
2. 오른쪽 상단에서 **새로 만들기**.
3. 을 클릭하세요. **Custom Enrichment** 카드.
4. 를 클릭할 수 있습니다.  **Enrichment Basic Information** 페이지에서 **Enrichment Name**을 추가하고, 필요에 따라 설명과 참조를 추가합니다.\
   ![The image shows the Lookup Table Basic Information form. The Lookup Name is set to "1Password Translation."](https://2400888838-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-58df3e9249e26c318bcc64d0d2c279767351c0f9%2F1pw-lookup-table-basic-info.jpg?alt=media)
   * 이 예에서는 이름이 “1Password Translation”이고 설명이 “1Password UUID를 사람이 읽을 수 있는 이름으로 변환합니다.”입니다.
   * Reference 필드는 일반적으로 관련 내부 리소스에 대한 하이퍼링크를 저장하는 데 사용됩니다.
5. 클릭 **계속**.
6. Associated Log Types 페이지에서 Log Type **OnePassword.ItemUsage**를 선택합니다. Selectors 아래에 `item_uuid`.\
   ![On the Associated Log Types page, the Log Type is set to OnePassword.ItemUsage and the Selectors field is set to item\_uuid.](https://2400888838-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-41b77a1c8f2f3c51515fd9fb5752d0370faf5495%2F1pw-log-type.png?alt=media)
7. 클릭 **계속**.
8. On the Table Schema page, add the schema you created based on your 1Password JSON file. For the Primary Key Name, select `uuid`.
   * 아직 스키마를 만들지 않았다면, 다음 단계로 넘어가기 전에 아래 문서를 따라 스키마를 만드세요: [샘플 로그에서 사용자 정의 로그 유형용 스키마 생성](https://docs.runpanther.io/data-onboarding/custom-log-types#generating-a-custom-log-type-from-sample-logs).
9. 클릭 **계속**.
10. Import Data 페이지에서 **파일 선택** 를 클릭한 다음 OnePasswordItems JSON 파일을 선택합니다.
11. 클릭 **를 참조하세요.** enrichments 목록으로 돌아가려면

이제 사용자 정의 enrichment를 만들었으므로 enrichment의 추가 컨텍스트를 기반으로 디택션을 작성할 수 있습니다. 다음 섹션에서는 이러한 새 값을 사용하여 디택션을 작성하는 방법을 다룹니다.

## **디택션 작성**

### **디택션용 데이터 가져오기**

1. Panther 계정에 로그인한 다음 왼쪽 탐색에서 **Investigate > Data Explorer**.
2. OnePassword 항목의 처음 10개 줄을 추출하는 새 쿼리를 작성합니다: `select * from your_company_logs.public.onepassword_itemusage limit 10`
3. 페이지 하단의 "Results" 표에서 레코드 중 하나 옆의 **View JSON** 를 클릭합니다.
4. JSON 텍스트를 클립보드에 복사합니다.

아래 예에서는 1Password vault의 특정 로그인 자격 증명 집합에 부여된 이름을 기반으로 디택션을 작성하고 있습니다. 이 경우 1Password의 로그인 이름은 “Sensitive Password”로 표시됩니다.

### **디택션 작성하기**

1. Panther 계정의 왼쪽 탐색에서 **Build > 디택션**.
2. 를 클릭하세요. 오른쪽 상단에서 **새로 만들기**.
3. 페이지 상단에서 **룰**.
4. Log Type 필드에서 "OnePasswordItems"를 선택합니다.
5. 아래에서 **Test**, 클릭하세요 **새로 추가**. Data Explorer에서 복사한 JSON 텍스트를 붙여넣습니다.
6. 클릭 **테스트 데이터 Enrich** 를 선택하고 title이 `p_enrichment` 필드 아래에서 친숙한 이름으로 표시되는지 확인합니다:\
   ![The image shows a section of the test data, including the p\_enrichment field which contains the title "Sensitive Password."](https://2400888838-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-156b5910c83d3ea2ea82c53b83e313afc623513d%2F1pw-login-title-encrichment.png?alt=media)
7. Python 룰 로직 편집기에 다음 내용을 붙여넣습니다:

   ```python
   from panther_base_helpers import deep_get
   def 룰(event): 
       if deep_get(event, "p_enrichment", "1Password Translation","item_uuid", "title") == "Sensitive Password": 
           return True
       return False
   ```

   * 다음을 사용 중인 경우 [간단한 탐지](https://docs.panther.com/ko/detections#simple-detections)그런 다음 YAML 텍스트 편집기에 다음 내용을 붙여넣습니다:

     ```yaml
     디택션:
       - Enrichment:
           Table: 1Password Translation
           Selector: item_uuid
           FieldPath: title
         Condition: Equals
         Value: Sensitive Password
     ```
8. [새 디택션에서](https://docs.runpanther.io/writing-detections/testing) 를 실행합니다. 테스트를 마쳤으면 **저장** 를 페이지 오른쪽 상단에서 클릭합니다.
