Skip to content

Commit 2081cfd

Browse files
Updated CEL program and fields.yml
1 parent f943064 commit 2081cfd

File tree

6 files changed

+164
-66
lines changed

6 files changed

+164
-66
lines changed

packages/checkpoint_harmony_endpoint/data_stream/forensics/_dev/test/pipeline/test-access-sample.log

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/checkpoint_harmony_endpoint/data_stream/forensics/_dev/test/pipeline/test-access-sample.log-config.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/checkpoint_harmony_endpoint/data_stream/forensics/_dev/test/pipeline/test-access-sample.log-expected.json

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 99 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,109 @@
1-
config_version: 1
1+
config_version: 3
2+
{{#if enable_request_tracer}}
3+
{{/if}}
4+
resource.tracer.filename: "../../logs/cel/http-request-trace-*.ndjson"
5+
request.tracer.maxbackups: 5
26
resource.url: {{server_url}}
3-
auth_request_body: '{"clientId":"{{client_id}}","accessKey":"{{secret_key}}"}'
7+
auth.oauth2:
8+
client.id: {{client_id}}
9+
token_url: {{server_url}}/auth/external
10+
endpoint_params:
11+
accessKey: {{secret_key}}
12+
state:
13+
interval: {{interval}}
14+
initial_interval: {{initial_interval}} // Define initial interval
15+
want_more: false
16+
full_url: {{server_url}}/logs_query/
17+
per_page: {{per_page}}
18+
page_limit: {{page_limit}}
419
program: |
5-
(
6-
request("GET", state.url.trim_right("/") + {{auth_uri}})
7-
.with(
20+
request("GET", state.full_url).with({
21+
"Header": {"Content-Type": ["application/json"]},
22+
"Body": {
823
{
9-
"Header": {"Content-Type": ["application/json"]},
10-
"Body": auth_request_body
24+
"filter": "product:\"Forensics\"",
25+
"limit": state.per_page,
26+
"pageLimit": state.page_limit,
27+
"cloudService": "Harmony Endpoint",
28+
"timeframe": {
29+
//Is this correct way to use apply time?
30+
"startTime": '"' + timestamp(now() - duration('"+' + state.initial_interval + '"')).format(time_layout.RFC3339) + '"',
31+
"endTime": '"' + timestamp(now()).format(time_layout.RFC3339) + '"'
32+
}
33+
}
34+
}
35+
}).do_request().as(resp,
36+
resp.StatusCode == 200
37+
?
38+
bytes(resp.Body).decode_json().as(body, {
39+
"events": body.success,
40+
"want_more": false,
41+
"cursor": {
42+
"taskid": body.data.taskId
1143
}
12-
)
13-
.do_request().as(resp,
14-
resp.StatusCode == 200 ?
15-
(bytes(resp.Body).decode_json().as(body, {
16-
"events": [body.data.token]
17-
},
18-
"url": {{server_url}},
19-
)
20-
)
44+
})
2145
:
2246
{
23-
"events": {
24-
"error": string(resp.message)
25-
}
47+
"events": [{
48+
"error": {
49+
"message": "response code: "+resp.StatusCode
50+
}
51+
}]
2652
}
53+
)
2754

55+
resource.retry.wait_min(20s)
56+
request("GET", state.full_url+"/"+cursor.taskid).with({
57+
"Header": {"Content-Type": ["application/json"]}
58+
}).do_request.as(resp,
59+
resp.StatusCode == 200
60+
?
61+
byte(resp.body).decode_json().as(body, {
62+
"events": body.success,
63+
"pagetokens": body.data.pageTokens
64+
})
65+
:
66+
{
67+
"events: [{
68+
"error: {
69+
"message": "response code: "+resp.StatusCode
70+
}"
71+
}]"
72+
}
2873
)
29-
debug(resp)
74+
75+
// How to apply pagination based on 'nextPageToken' value from response body.
76+
// As discussed in previous call, how to use 'last_seen_ts' to update 'startTime' for next iteration?
77+
request("GET", state.full_url+"/retrieve").with({
78+
"Header": {"Content-Type": ["application/json"]},
79+
"Body": {
80+
{
81+
"taskid": cursor.taskid,
82+
"pagetoken": cursor.pagetokens
83+
}
84+
}
85+
}).do_request.as(resp,
86+
resp.StatusCode == 200
87+
?
88+
byte(resp.body).decode_json().as(body, {
89+
"events": body.data.records,
90+
"nextPageToken": body.data.nextPageToken
91+
"last_seen_ts": body.data.records[-1].time
92+
})
93+
:
94+
{
95+
"events: [{
96+
"error: {
97+
"message": "response code: "+resp.StatusCode
98+
}"
99+
}]"
100+
}
30101
)
102+
103+
tags:
104+
{{#if preserve_original_event}}
105+
- preserve_original_event
106+
{{/if}}
107+
{{#if preserve_duplicate_custom_fields}}
108+
- preserve_duplicate_custom_fields
109+
{{/if}}
Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,51 @@
1-
- name: ti_crowdstrike.intel
1+
- name: checkpoint_harmony_endpoint.forensics
22
type: group
33
fields:
44
- name: confidence_level
55
type: keyword
6-
description: Confidence levek
6+
description: Confidence level
7+
- name: policy_date
8+
type: date
9+
description: Policy Date
710
- name: policy_name
811
type: keyword
9-
description: Policy Name
12+
description: Policy Name
13+
- name: severity
14+
type: keyword
15+
description: Event severity
16+
- name: time
17+
type: date
18+
description: Time
19+
- name: action
20+
type: keyword
21+
description: Action
22+
- name: protection_type
23+
type: keyword
24+
description: Protection Type
25+
- name: attack_status
26+
type: keyword
27+
description: Attack Status
28+
- name: detected_by
29+
type: keyword
30+
description: Detected By
31+
- name: event_type
32+
type: keyword
33+
description: Event Type
34+
- name: malware_action
35+
type: flattened
36+
description: Action Taken
37+
- name: protection_name
38+
type: keyword
39+
description: Protection Name
40+
- name: resource
41+
type: flattened
42+
description: Resource
43+
- name: src
44+
type: ip
45+
description: Source IP
46+
- name: src_machine_name
47+
type: keyword
48+
description: Source Host Name
49+
- name: src_user_name
50+
type: flattened
51+
description: Source User Name

packages/checkpoint_harmony_endpoint/manifest.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,32 @@ policy_templates:
5959
default: https://cloudinfra-gw.portal.checkpoint.com
6060
required: true
6161
show_user: true
62-
- name: auth_uri
62+
- name: interval
6363
type: text
64-
title: Authentication URI
65-
description: URI of the CheckPoint Harmony Endpoint API Authentication API. Defaults to /auth/external
66-
default: /auth/external
64+
title: Interval
65+
description: Interval at which the logs will be pulled. The value must be between 2m and 1h. Supported units for this parameter are h/m/s.
66+
default: 5m
6767
required: true
6868
show_user: true
69-
- name: search_uri
69+
- name: initial_interval
7070
type: text
71-
title: Search URI
72-
description: URI of the CheckPoint Harmony Endpoint API Search Query. Defaults to /logs_query/
73-
default: /logs_query/
71+
title: Initial Interval
72+
description: Initial interval at which the logs will be pulled. Defaults to 30 days (720 hours). Max is 12960 hours (18 months). Supported units for this parameter are h/m/s.
73+
default: 720h
7474
required: true
7575
show_user: true
76-
- name: retrieve_results_uri
77-
type: text
78-
title: Retrive Search Results URI
79-
description: URI of the CheckPoint Harmony Endpoint API to check progress of Search Query. Defaults to /logs_query/retrieve
80-
default: /logs_query/retrieve
76+
- name: per_page
77+
type: integer
78+
title: Results per page
79+
description: Sets the number of results to return per page. If set this must be greater or equal to 1 and less than or equal to 1000. If not set, the API default is used. Per page should not be greated than 'Page Limit'.
80+
default: 100
81+
required: true
82+
show_user: true
83+
- name: page_limit
84+
type: integer
85+
title: Results per page
86+
description: Sets the number of results to return per page. If set this must be greater or equal to 1 and less than or equal to 1000. If not set, the API default is used.
87+
default: 100
8188
required: true
8289
show_user: true
8390
owner:

0 commit comments

Comments
 (0)