-
Couldn't load subscription status.
- Fork 505
[Akamai] - Migrated SIEM data stream from HTTPJSON to CEL input #15713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9cfe35c
5c11cff
d2e92ce
175690c
ffd666e
d05fc95
42dcd3d
b4206f4
2d32dc5
d97ebf2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,159 @@ | ||||||||||||||||||
| config_version: 2 | ||||||||||||||||||
| interval: {{interval}} | ||||||||||||||||||
| resource: | ||||||||||||||||||
| url: {{api_host}}/siem/v1/configs/{{config_ids}} | ||||||||||||||||||
| {{#if ssl}} | ||||||||||||||||||
| ssl: {{ssl}} | ||||||||||||||||||
| {{/if}} | ||||||||||||||||||
| {{#if http_client_timeout}} | ||||||||||||||||||
| timeout: {{http_client_timeout}} | ||||||||||||||||||
| {{/if}} | ||||||||||||||||||
| {{#if proxy_url }} | ||||||||||||||||||
| proxy_url: {{proxy_url}} | ||||||||||||||||||
| {{/if}} | ||||||||||||||||||
| tracer: | ||||||||||||||||||
| enabled: {{enable_request_tracer}} | ||||||||||||||||||
| filename: "../../logs/cel/http-request-trace-*.ndjson" | ||||||||||||||||||
| maxbackups: 5 | ||||||||||||||||||
| {{#if max_executions}} | ||||||||||||||||||
| max_executions: {{max_executions}} | ||||||||||||||||||
| {{/if}} | ||||||||||||||||||
|
|
||||||||||||||||||
| state: | ||||||||||||||||||
| client_token: {{client_token}} | ||||||||||||||||||
| access_token: {{access_token}} | ||||||||||||||||||
| client_secret: {{client_secret}} | ||||||||||||||||||
| initial_interval: {{initial_interval}} | ||||||||||||||||||
| event_limit: {{event_limit}} | ||||||||||||||||||
|
|
||||||||||||||||||
| redact: | ||||||||||||||||||
| fields: | ||||||||||||||||||
| - client_secret | ||||||||||||||||||
| - access_token | ||||||||||||||||||
| - client_token | ||||||||||||||||||
|
|
||||||||||||||||||
| program: |- | ||||||||||||||||||
| state.with( | ||||||||||||||||||
| ( | ||||||||||||||||||
| state.?cursor.recovery_mode.orValue(false) ? | ||||||||||||||||||
| { | ||||||||||||||||||
| "from": int(now - duration("12h")), | ||||||||||||||||||
| "to": int(now), | ||||||||||||||||||
| } | ||||||||||||||||||
| : state.?cursor.last_offset.hasValue() ? | ||||||||||||||||||
| { | ||||||||||||||||||
| "offset": state.cursor.last_offset, | ||||||||||||||||||
| } | ||||||||||||||||||
| : | ||||||||||||||||||
| { | ||||||||||||||||||
| "from": max(int(now - duration(state.initial_interval)), int(now - duration("12h"))), | ||||||||||||||||||
| "to": int(now), | ||||||||||||||||||
| } | ||||||||||||||||||
| ).as(params, | ||||||||||||||||||
| now.format("20060102T15:04:05-0700").as(timestamp, | ||||||||||||||||||
| uuid().as(nonce, | ||||||||||||||||||
| sprintf( | ||||||||||||||||||
| "EG1-HMAC-SHA256 client_token=%s;access_token=%s;timestamp=%s;nonce=%s;", | ||||||||||||||||||
| [state.client_token, state.access_token, timestamp, nonce] | ||||||||||||||||||
| ).as(sig_base, | ||||||||||||||||||
| base64(hmac(timestamp, "sha256", bytes(state.client_secret))).as(sig_key, | ||||||||||||||||||
| ( | ||||||||||||||||||
| state.url.trim_right("/") + "?" + { | ||||||||||||||||||
| "limit": [string(state.event_limit)], | ||||||||||||||||||
| ?"from": (params.?from.orValue("") != "") ? optional.of([string(params.from)]) : optional.none(), | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we doing |
||||||||||||||||||
| ?"to": (params.?to.orValue("") != "") ? optional.of([string(params.to)]) : optional.none(), | ||||||||||||||||||
| ?"offset": (params.?offset.orValue("") != "") ? optional.of([string(params.offset)]) : optional.none(), | ||||||||||||||||||
| }.format_query() | ||||||||||||||||||
| ).parse_url().as(u, | ||||||||||||||||||
| sprintf( | ||||||||||||||||||
| "GET\t%s\t%s\t%s?%s\t\t\t%s", | ||||||||||||||||||
| [ | ||||||||||||||||||
| string(u.Scheme), | ||||||||||||||||||
| string(u.Host), | ||||||||||||||||||
| string(u.Path), | ||||||||||||||||||
| string(u.RawQuery), | ||||||||||||||||||
|
Comment on lines
+71
to
+74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
| sig_base, | ||||||||||||||||||
| ] | ||||||||||||||||||
| ).as(to_sign, | ||||||||||||||||||
| base64(hmac(to_sign, "sha256", bytes(sig_key))).as(signature, | ||||||||||||||||||
| sig_base + "signature=" + signature | ||||||||||||||||||
| ) | ||||||||||||||||||
| ) | ||||||||||||||||||
| ) | ||||||||||||||||||
| ) | ||||||||||||||||||
| ) | ||||||||||||||||||
| ) | ||||||||||||||||||
| ).as(auth_header, | ||||||||||||||||||
| request( | ||||||||||||||||||
| "GET", | ||||||||||||||||||
| state.url.trim_right("/") + "?" + { | ||||||||||||||||||
| "limit": [string(state.event_limit)], | ||||||||||||||||||
| ?"from": (params.?from.orValue("") != "") ? optional.of([string(params.from)]) : optional.none(), | ||||||||||||||||||
| ?"to": (params.?to.orValue("") != "") ? optional.of([string(params.to)]) : optional.none(), | ||||||||||||||||||
| ?"offset": (params.?offset.orValue("") != "") ? optional.of([string(params.offset)]) : optional.none(), | ||||||||||||||||||
| }.format_query() | ||||||||||||||||||
|
Comment on lines
+89
to
+94
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should be using the value that we obtained above, purely for efficiency (the query will be canonicalised in order, so it's not a correctness issue). |
||||||||||||||||||
| ).with( | ||||||||||||||||||
| { | ||||||||||||||||||
| "Header": { | ||||||||||||||||||
| "Authorization": [auth_header], | ||||||||||||||||||
| }, | ||||||||||||||||||
| } | ||||||||||||||||||
| ).do_request().as(resp, | ||||||||||||||||||
| (resp.StatusCode == 200) ? | ||||||||||||||||||
| string(resp.Body).split("\n").filter(line, line != "").as(lines, | ||||||||||||||||||
| { | ||||||||||||||||||
| "events": lines.map(line, {"message": line}), | ||||||||||||||||||
| "cursor": { | ||||||||||||||||||
| ?"last_offset": (lines.size() > 0) ? | ||||||||||||||||||
| lines[lines.size() - 1].decode_json().as(lastEvent, | ||||||||||||||||||
| lastEvent.?offset | ||||||||||||||||||
| ) | ||||||||||||||||||
| : | ||||||||||||||||||
| optional.none(), | ||||||||||||||||||
| "recovery_mode": false, | ||||||||||||||||||
| }, | ||||||||||||||||||
| "want_more": (lines.size() > 0) ? | ||||||||||||||||||
| lines[lines.size() - 1].decode_json().as(lastEvent, | ||||||||||||||||||
| has(lastEvent.offset) && lastEvent.offset != "" | ||||||||||||||||||
| ) | ||||||||||||||||||
| : | ||||||||||||||||||
| false, | ||||||||||||||||||
| } | ||||||||||||||||||
| ) | ||||||||||||||||||
| : (resp.StatusCode == 416) ? | ||||||||||||||||||
| { | ||||||||||||||||||
| "events": { | ||||||||||||||||||
| "error": { | ||||||||||||||||||
| "code": string(resp.StatusCode), | ||||||||||||||||||
| "id": string(resp.Status), | ||||||||||||||||||
| "message": "GET " + state.url.trim_right("/") + ( | ||||||||||||||||||
| (size(resp.Body) != 0) ? | ||||||||||||||||||
| string(resp.Body) | ||||||||||||||||||
| : | ||||||||||||||||||
| string(resp.Status) + " (" + string(resp.StatusCode) + ")" | ||||||||||||||||||
| ), | ||||||||||||||||||
| }, | ||||||||||||||||||
| }, | ||||||||||||||||||
| "cursor": {"recovery_mode": true}, | ||||||||||||||||||
| "want_more": true, | ||||||||||||||||||
| } | ||||||||||||||||||
| : | ||||||||||||||||||
| { | ||||||||||||||||||
| "events": { | ||||||||||||||||||
| "error": { | ||||||||||||||||||
| "code": string(resp.StatusCode), | ||||||||||||||||||
| "id": string(resp.Status), | ||||||||||||||||||
| "message": "GET " + state.url.trim_right("/") + ( | ||||||||||||||||||
| (size(resp.Body) != 0) ? | ||||||||||||||||||
| string(resp.Body) | ||||||||||||||||||
| : | ||||||||||||||||||
| string(resp.Status) + " (" + string(resp.StatusCode) + ")" | ||||||||||||||||||
| ), | ||||||||||||||||||
| }, | ||||||||||||||||||
| }, | ||||||||||||||||||
| "want_more": false, | ||||||||||||||||||
| } | ||||||||||||||||||
| ) | ||||||||||||||||||
| ) | ||||||||||||||||||
| ) | ||||||||||||||||||
| ) | ||||||||||||||||||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.