Detector APIs
출처: 문서
본문
Detector API
다음 API는 Detector 생성부터 업데이트, 검색에 이르기까지 Detector와 관련된 다양한 작업에 사용할 수 있어요. 많은 API 호출이 요청에 detector ID를 사용하는데, 이 ID는 Detector 검색 API를 사용해 가져올 수 있어요.
Detector 생성
새로운 Detector를 생성해요.
POST _plugins/_security_analytics/detectors
요청 본문 필드
Detector를 생성할 때 다음 필드를 지정할 수 있어요.
| 필드 | 타입 | 설명 |
|---|---|---|
enabled |
Boolean | Detector를 활성(true) 또는 비활성(false) 상태로 설정해요. 새 Detector가 생성될 때 기본값은 true예요. 필수 항목이에요. |
name |
String | Detector의 이름이에요. 이름은 대소문자 알파벳, 숫자 0--9, 하이픈, 공백, 언더스코어만 사용할 수 있어요. 5--50자를 사용하세요. 필수 항목이에요. |
detector_type |
String | Detector를 정의하는 로그 타입이에요. 옵션은 다음과 같아요: linux, network ,windows, ad_ldap, apache_access, cloudtrail, dns, s3. 필수 항목이에요. |
schedule |
Object | Detector가 얼마나 자주 실행될지를 결정하는 스케줄이에요. API에서 고정 간격을 지정하는 방법은 Cron 표현식을 참고하세요. |
schedule.period |
Object | 스케줄 실행 빈도에 대한 세부 정보예요. |
schedule.period.interval |
Integer | Detector가 실행되는 간격이에요. |
schedule.period.unit |
String | 간격의 시간 단위예요. |
inputs |
Object | Detector의 입력값이에요. |
inputs.detector_input |
Array | Detector를 생성하는 데 사용되는 인덱스와 정의를 담고 있는 배열이에요. Detector에는 로그 데이터 소스를 하나만 사용할 수 있어요. |
inputs.detector_input.description |
String | Detector에 대한 설명이에요. 선택 항목이에요. |
inputs.detector_input.custom_rules |
Array | 커스텀 규칙을 위한 Detector 입력값이에요. Detector에는 최소 한 개의 규칙을 지정해야 해요. 사전 패키징된 규칙을 지정하면 생략할 수 있어요. |
inputs.detector_input.custom_rules.id |
String | 사용자가 생성한 커스텀 규칙의 유효한 규칙 ID예요. 유효한 규칙은 전역 고유 식별자, 즉 범용 고유 식별자(universally unique identifier, UUID) 형식이에요. 자세한 내용은 범용 고유 식별자를 참고하세요. |
inputs.detector_input.indices |
Array | Detector에 사용되는 로그 데이터 소스로, 인덱스 이름이나 인덱스 패턴이 될 수 있어요. 항목은 하나만 지원해요. 필수 항목이에요. |
inputs.detector_input.pre_packaged_rules |
Array | 사전 패키징된 규칙을 위한 Detector 입력값이에요(커스텀 규칙과는 반대). Detector에는 최소 한 개의 규칙을 지정해야 해요. 커스텀 규칙을 지정하면 생략할 수 있어요. |
inputs.detector_input.pre_packaged_rules.id |
String | 사전 패키징된 규칙의 규칙 ID예요. API를 사용해 규칙을 검색하고 결과에서 규칙 ID를 가져오는 방법은 사전 패키징된 규칙 검색을 참고하세요. |
triggers |
Array | 얼럿을 위한 트리거 설정이에요. |
triggers.ids |
Array | 트리거 조건의 일부가 되는 규칙 ID 목록이에요. |
triggers.tags |
Array | 태그는 보안 규칙에 지정돼요. 이후 태그를 선택해 얼럿 트리거에 적용하면 얼럿의 트리거 조건을 좁힐 수 있어요. Sigma 규칙에서 태그를 사용하는 예시는 Sigma의 규칙 생성 가이드에서 볼 수 있어요. |
triggers.id |
String | 트리거의 고유 ID예요. |
triggers.sev_levels |
Array | Sigma 규칙의 심각도 레벨이에요: informational; low; medium; high; criticial. Sigma 규칙 생성 가이드의 레벨을 참고하세요. |
triggers.name |
String | 트리거의 이름이에요. 이름은 대소문자 알파벳, 숫자 0--9, 하이픈, 공백, 언더스코어만 사용할 수 있어요. 5--50자를 사용하세요. 필수 항목이에요. |
triggers.severity |
Integer | 트리거의 심각도 레벨을 정수로 표현한 값이에요: 1 = 가장 높음; 2 = 높음; 3 = 중간; 4 = 낮음; 5 = 가장 낮음. 트리거 심각도는 얼럿 정의의 일부예요. |
triggers.actions |
Object | 트리거 조건이 충족되면 액션이 알림을 보내요. 얼럿에 알림 메시지가 필수가 아니기 때문에 선택 항목이에요. |
triggers.actions.id |
String | 액션의 고유 ID예요. 사용자가 생성하는 값이에요. |
triggers.actions.destination_id |
String | 알림 대상의 고유 ID예요. 사용자가 생성하는 값이에요. |
triggers.actions.subject_template |
Object | 알림 메시지의 제목 필드 정보를 담고 있어요. 선택 항목이에요. |
triggers.actions.subject_template.source |
String | 알림 메시지의 제목이에요. |
triggers.actions.subject_template.lang |
String | 제목을 정의하는 데 사용하는 스크립팅 언어예요. 반드시 Mustache여야 해요. 템플릿에 대한 자세한 내용은 Mustache 매뉴얼을 참고하세요. |
triggers.actions.name |
String | 트리거 얼럿의 이름이에요. 이름은 대소문자 알파벳, 숫자 0--9, 하이픈, 공백, 언더스코어만 사용할 수 있어요. 5--50자를 사용하세요. |
triggers.actions.message_template |
String | 알림 메시지 본문의 정보를 담고 있어요. 선택 항목이에요. |
triggers.actions.message_template.source |
String | 알림 메시지의 본문이에요. |
triggers.actions.message_template.lang |
String | 메시지를 정의하는 데 사용하는 스크립팅 언어예요. 반드시 Mustache여야 해요. |
triggers.actions.throttle_enabled |
Boolean | 얼럿 알림에 대한 스로틀링을 활성화해요. 선택 항목이에요. 기본값은 false예요. |
triggers.actions.throttle |
Object | 스로틀링은 주어진 시간 동안 받을 수 있는 알림의 수를 제한해요. |
triggers.actions.throttle.unit |
String | 스로틀링의 시간 단위예요. |
triggers.actions.throttle.value |
Integer | 시간 단위의 값이에요. |
요청 예시
POST _plugins/_security_analytics/detectors
{
"enabled": true,
"schedule": {
"period": {
"interval": 1,
"unit": "MINUTES"
}
},
"detector_type": "WINDOWS",
"type": "detector",
"inputs": [
{
"detector_input": {
"description": "windows detector for security analytics",
"custom_rules": [
{
"id": "bc2RB4QBrbtylUb_1Pbm"
}
],
"indices": [
"windows"
],
"pre_packaged_rules": [
{
"id": "06724a9a-52fc-11ed-bdc3-0242ac120002"
}
]
}
}
],
"triggers": [
{
"ids": [
"06724a9a-52fc-11ed-bdc3-0242ac120002"
],
"types": [],
"tags": [
"attack.defense_evasion"
],
"severity": "1",
"actions": [{
"id": "hVTLkZYzlA",
"destination_id": "6r8ZBoQBKW_6dKriacQb",
"subject_template": {
"source": "Trigger: {{ctx.trigger.name}}",
"lang": "mustache"
},
"name": "hello_world",
"throttle_enabled": false,
"message_template": {
"source": "Detector {{ctx.detector.name}} just entered alert status. Please investigate the issue." +
"- Trigger: {{ctx.trigger.name}}" +
"- Severity: {{ctx.trigger.severity}}",
"lang": "mustache"
},
"throttle": {
"unit": "MINUTES",
"value": 108
}
}
],
"id": "8qhrBoQBYK1JzUUDzH-N",
"sev_levels": [],
"name": "test-trigger"
}
],
"name": "nbReFCjlfn"
}
{% include copy-curl.html %}
응답 예시
{
"_id": "dc2VB4QBrbtylUb_Hfa3",
"_version": 1,
"detector": {
"name": "nbReFCjlfn",
"detector_type": "windows",
"enabled": true,
"schedule": {
"period": {
"interval": 1,
"unit": "MINUTES"
}
},
"inputs": [
{
"detector_input": {
"description": "windows detector for security analytics",
"indices": [
"windows"
],
"custom_rules": [
{
"id": "bc2RB4QBrbtylUb_1Pbm"
}
],
"pre_packaged_rules": [
{
"id": "06724a9a-52fc-11ed-bdc3-0242ac120002"
}
]
}
}
],
"triggers": [
{
"id": "8qhrBoQBYK1JzUUDzH-N",
"name": "test-trigger",
"severity": "1",
"types": [],
"ids": [
"06724a9a-52fc-11ed-bdc3-0242ac120002"
],
"sev_levels": [],
"tags": [
"attack.defense_evasion"
],
"actions": [
{
"id": "hVTLkZYzlA",
"name": "hello_world",
"destination_id": "6r8ZBoQBKW_6dKriacQb",
"message_template": {
"source": "Trigger: {{ctx.trigger.name}}",
"lang": "mustache"
},
"throttle_enabled": false,
"subject_template": {
"source": "Detector {{ctx.detector.name}} just entered alert status. Please investigate the issue." +
"- Trigger: {{ctx.trigger.name}}" +
"- Severity: {{ctx.trigger.severity}}",
"lang": "mustache"
},
"throttle": {
"value": 108,
"unit": "MINUTES"
}
}
]
}
],
"last_update_time": "2022-10-24T01:22:03.738379671Z",
"enabled_time": "2022-10-24T01:22:03.738376103Z"
}
}
Detector 업데이트
Detector 정의를 업데이트해요. Detector를 지정하려면 detector ID가 필요해요.
PUT /_plugins/_security_analytics/detectors/{detector_Id}
요청 본문 필드
Detector를 업데이트할 때 다음 필드를 지정할 수 있어요.
| 필드 | 타입 | 설명 |
|---|---|---|
detector_type |
String | Detector를 정의하는 로그 타입이에요. 옵션은 다음과 같아요: linux, network ,windows, ad_ldap, apache_access, cloudtrail, dns, s3. |
name |
String | Detector의 이름이에요. 이름은 대소문자 알파벳, 숫자 0--9, 하이픈, 공백, 언더스코어만 사용할 수 있어요. 5--50자를 사용하세요. 필수 항목이에요. |
enabled |
Boolean | Detector를 활성(true) 또는 비활성(false) 상태로 설정해요. |
schedule.period.interval |
Integer | Detector가 실행되는 간격이에요. |
schedule.period.unit |
String | 간격의 시간 단위예요. |
inputs.input.description |
String | Detector에 대한 설명이에요. |
inputs.input.indices |
Array | Detector에 사용되는 로그 데이터 소스예요. 소스는 하나만 허용돼요. |
inputs.input.rules.id |
Array | Detector 정의를 위한 보안 규칙 목록이에요. |
triggers.sev_levels |
Array | Sigma 규칙의 심각도 레벨이에요: informational; low; medium; high; criticial. Sigma 규칙 생성 가이드의 레벨을 참고하세요. |
triggers.tags |
Array | 태그는 보안 규칙에 지정돼요. 이후 태그를 선택해 얼럿 트리거에 적용하면 얼 |