Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

SysmonForLinux | New integration to support Sysmon logs for Linux #4531

Merged
merged 10 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
/packages/suricata @elastic/security-external-integrations
/packages/symantec_endpoint @elastic/security-external-integrations
/packages/synthetics @elastic/uptime
/packages/sysmon_linux @elastic/security-external-integrations
/packages/system @elastic/elastic-agent-data-plane
/packages/system/kibana @elastic/elastic-agent-data-plane @elastic/kibana-vis-editors
/packages/tcp @elastic/security-external-integrations
Expand Down
3 changes: 3 additions & 0 deletions packages/sysmon_linux/_dev/build/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dependencies:
ecs:
reference: git@v8.5.1
26 changes: 26 additions & 0 deletions packages/sysmon_linux/_dev/build/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Sysmon for Linux Integration

The Sysmon for Linux integration allows you to monitor the [Sysmon for Linux](https://github.com/Sysinternals/SysmonForLinux), which is an open-source system monitor tool developed to collect security events from Linux environments.

Use the Sysmon for Linux integration to collect logs from linux machine which has sysmon tool running.
Then visualize that data in Kibana, create alerts to notify you if something goes wrong, and reference data when troubleshooting an issue.

NOTE: To collect Sysmon events from Windows event log, use [Windows `sysmon_operational` data stream](https://docs.elastic.co/en/integrations/windows#sysmonoperational) instead.

## Requirements

You need Elasticsearch for storing and searching your data and Kibana for visualizing and managing it.
You can use our hosted Elasticsearch Service on Elastic Cloud, which is recommended, or self-manage the Elastic Stack on your own hardware.

## Setup

For step-by-step instructions on how to set up an integration,
see the {{ url "getting-started-observability" "Getting started" }} guide.

## Data streams

The Sysmon for Linux `log` data stream provides events from logs produced by Sysmon tool running on Linux machine.

{{event "log"}}

{{fields "log"}}
8 changes: 8 additions & 0 deletions packages/sysmon_linux/_dev/deploy/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "2.3"
services:
sysmon_linux:
image: alpine
volumes:
- ./sample_logs:/sample_logs:ro
- ${SERVICE_LOGS_DIR}:/var/log
command: /bin/sh -c "cp /sample_logs/* /var/log/"
50 changes: 50 additions & 0 deletions packages/sysmon_linux/_dev/deploy/docker/sample_logs/sysmon.log

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions packages/sysmon_linux/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# newer versions go on top
- version: "0.1.0"
changes:
- description: initial release
type: enhancement
link: https://github.com/elastic/integrations/pull/4531
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fields:
tags:
- preserve_original_event
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"events": [
{
"log": {
"syslog": {
"hostname": "user-ubuntu",
"appname": "sysmon",
"procid": "3099"
}
},
"winlog": {
"record_id": "24",
"computer_name": "user-ubuntu",
"process": {
"pid": 3099,
"thread": {
"id": 3099
}
},
"event_id": "5",
"provider_guid": "{ff032593-a8d3-4f13-b0d6-01fc615a0f97}",
"level": "information",
"channel": "Linux-Sysmon/Operational",
"time_created": "2022-10-24T17:06:14.193Z",
"event_data": {
"User": "root",
"ProcessId": "783",
"Image": "/opt/Elastic/Agent/data/elastic-agent-5ae799/install/osquerybeat-7.15.1-linux-x86_64/osqueryd",
"RuleName": "-",
"ProcessGuid": "{d65774de-8d1e-6175-0000-000000000000}",
"UtcTime": "2022-10-24 17:06:14.200",
"opcode": "Info",
"provider_name": "Linux-Sysmon",
"version": "3"
}
}
},
{
"log": {
"syslog": {
"hostname": "user-ubuntu",
"appname": "sysmon"
}
},
"winlog": {
"computer_name": "user-ubuntu",
"record_id": "22",
"process": {
"pid": 3099,
"thread": {
"id": 3099
}
},
"event_id": "5",
"level": "information",
"provider_guid": "{ff032593-a8d3-4f13-b0d6-01fc615a0f97}",
"channel": "Linux-Sysmon/Operational",
"time_created": "2022-10-24T17:05:48.296Z",
"event_data": {
"User": "root",
"ProcessId": "3100",
"Image": "(null)",
"ProcessGuid": "{d65774de-8d10-6175-0000-000000000000}",
"RuleName": "-",
"UtcTime": "2022-10-24 17:05:48.302",
"provider_name": "Linux-Sysmon",
"opcode": "Info",
"version": "3"
}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"expected": [
{
"ecs": {
"version": "8.5.0"
},
"event": {
"action": "log",
"category": [
"process"
],
"code": "5",
"created": "2022-10-24T17:06:14.193Z",
"kind": "event",
"provider": "Linux-Sysmon",
"type": [
"end"
]
},
"host": {
"hostname": "user-ubuntu"
},
"log": {
"level": "information"
},
"process": {
"entity_id": "{d65774de-8d1e-6175-0000-000000000000}",
"executable": "/opt/Elastic/Agent/data/elastic-agent-5ae799/install/osquerybeat-7.15.1-linux-x86_64/osqueryd",
"name": "sysmon",
"pid": 783
},
"tags": [
"preserve_original_event"
],
"winlog": {
"channel": "Linux-Sysmon/Operational",
"computer_name": "user-ubuntu",
"event_id": "5",
"opcode": "Info",
"process": {
"pid": 3099,
"thread": {
"id": 3099
}
},
"provider_guid": "{ff032593-a8d3-4f13-b0d6-01fc615a0f97}",
"record_id": "24",
"version": 3
}
},
{
"ecs": {
"version": "8.5.0"
},
"event": {
"action": "log",
"category": [
"process"
],
"code": "5",
"created": "2022-10-24T17:05:48.296Z",
"kind": "event",
"provider": "Linux-Sysmon",
"type": [
"end"
]
},
"host": {
"hostname": "user-ubuntu"
},
"log": {
"level": "information"
},
"process": {
"entity_id": "{d65774de-8d10-6175-0000-000000000000}",
"executable": "(null)",
"name": "sysmon",
"pid": 3100
},
"tags": [
"preserve_original_event"
],
"winlog": {
"channel": "Linux-Sysmon/Operational",
"computer_name": "user-ubuntu",
"event_id": "5",
"opcode": "Info",
"process": {
"pid": 3099,
"thread": {
"id": 3099
}
},
"provider_guid": "{ff032593-a8d3-4f13-b0d6-01fc615a0f97}",
"record_id": "22",
"version": 3
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
service: sysmon_linux
input: filestream
data_stream:
vars:
paths:
- "{{SERVICE_LOGS_DIR}}/*.log"
preserve_original_event: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
paths:
{{#each paths as |path i|}}
- {{path}}
{{/each}}
prospector.scanner.exclude_files: [".gz$"]
{{!-- inlcude_lines: '.* sysmon(\:|\[\d+\]).*' --}}
{{!-- exclude_lines: '.* sysmon(\:|\[\d+\]).*' --}}
{{!-- exclude_lines: '^(?:(?!.* sysmon(\:|\[\d+\]).*).)+$' --}}
tags:
{{#if preserve_original_event}}
- preserve_original_event
{{/if}}
{{#each tags as |tag i|}}
- {{tag}}
{{/each}}
{{#contains "forwarded" tags}}
publisher_pipeline.disable_host: true
{{/contains}}
processors:
- add_locale: ~
- rename:
fields:
- from: message
to: event.original
ignore_missing: true
fail_on_error: false
- syslog:
field: "event.original"
ignore_missing: true
ignore_failure: true
- drop_event:
when:
and:
- has_fields: ['log.syslog.appname']
- not:
equals:
log.syslog.appname: 'sysmon'
- decode_xml_wineventlog:
when:
regexp:
message: '^\<Event'
field: event.original
target_field: winlog
ignore_missing: true
ignore_failure: true
map_ecs_fields: true
{{#if processors.length}}
{{processors}}
{{/if}}
{{#if ignore_older}}
ignore_older: {{ignore_older}}
{{/if}}
Loading