From 0ea2252b5bd08092e78433be25bf31fd56d339c5 Mon Sep 17 00:00:00 2001 From: Mike Reeves Date: Tue, 2 Jun 2020 13:40:46 -0400 Subject: [PATCH] Add Suricata Flow pipeline --- .../elasticsearch/files/ingest/suricata.alert | 2 +- .../files/ingest/suricata.common | 2 +- salt/elasticsearch/files/ingest/suricata.conn | 40 ------------------- salt/elasticsearch/files/ingest/suricata.flow | 9 +++++ 4 files changed, 11 insertions(+), 42 deletions(-) delete mode 100644 salt/elasticsearch/files/ingest/suricata.conn create mode 100644 salt/elasticsearch/files/ingest/suricata.flow diff --git a/salt/elasticsearch/files/ingest/suricata.alert b/salt/elasticsearch/files/ingest/suricata.alert index 7a3580864..4687e1624 100644 --- a/salt/elasticsearch/files/ingest/suricata.alert +++ b/salt/elasticsearch/files/ingest/suricata.alert @@ -7,6 +7,6 @@ { "rename":{ "field": "rule.ref", "target_field": "rule.version", "ignore_failure": true } }, { "rename":{ "field": "rule.signature_id", "target_field": "rule.uuid", "ignore_failure": true } }, { "rename":{ "field": "rule.signature_id", "target_field": "rule.signature", "ignore_failure": true } }, - { "pipeline": { "name": "suricata.common" } } + { "pipeline": { "name": "common" } } ] } diff --git a/salt/elasticsearch/files/ingest/suricata.common b/salt/elasticsearch/files/ingest/suricata.common index 489beb119..cd0ea3fc5 100644 --- a/salt/elasticsearch/files/ingest/suricata.common +++ b/salt/elasticsearch/files/ingest/suricata.common @@ -13,6 +13,6 @@ { "rename":{ "field": "message2.event_type", "target_field": "dataset", "ignore_failure": true } }, { "set": { "field": "observer.name", "value": "{{agent.name}}" } }, { "remove":{ "field": "agent", "ignore_failure": true } }, - { "pipeline": { "name": "common" } } + { "pipeline": { "name": "suricata.{{dataset}}" } } ] } diff --git a/salt/elasticsearch/files/ingest/suricata.conn b/salt/elasticsearch/files/ingest/suricata.conn deleted file mode 100644 index 5e3ae9c79..000000000 --- a/salt/elasticsearch/files/ingest/suricata.conn +++ /dev/null @@ -1,40 +0,0 @@ -{ - "description" : "zeek.conn", - "processors" : [ - { "remove": { "field": ["host"], "ignore_failure": true } }, - { "json": { "field": "message", "target_field": "message2", "ignore_failure": true } }, - { "rename": { "field": "message2.proto", "target_field": "network.transport", "ignore_missing": true } }, - { "rename": { "field": "message2.service", "target_field": "network.protocol", "ignore_missing": true } }, - { "rename": { "field": "message2.duration", "target_field": "event.duration", "ignore_missing": true } }, - { "rename": { "field": "message2.orig_bytes", "target_field": "client.bytes", "ignore_missing": true } }, - { "rename": { "field": "message2.resp_bytes", "target_field": "server.bytes", "ignore_missing": true } }, - { "rename": { "field": "message2.conn_state", "target_field": "connection.state", "ignore_missing": true } }, - { "rename": { "field": "message2.local_orig", "target_field": "connection.local.originator", "ignore_missing": true } }, - { "rename": { "field": "message2.local_resp", "target_field": "connection.local.responder", "ignore_missing": true } }, - { "rename": { "field": "message2.missed_bytes", "target_field": "connection.bytes.missed", "ignore_missing": true } }, - { "rename": { "field": "message2.history", "target_field": "connection.history", "ignore_missing": true } }, - { "rename": { "field": "message2.orig_pkts", "target_field": "client.packets", "ignore_missing": true } }, - { "rename": { "field": "message2.orig_ip_bytes", "target_field": "client.ip_bytes", "ignore_missing": true } }, - { "rename": { "field": "message2.resp_pkts", "target_field": "server.packets", "ignore_missing": true } }, - { "rename": { "field": "message2.resp_ip_bytes", "target_field": "server.ip_bytes", "ignore_missing": true } }, - { "rename": { "field": "message2.tunnel_parents", "target_field": "log.id.tunnel_parents", "ignore_missing": true } }, - { "rename": { "field": "message2.orig_cc", "target_field": "client.country_code","ignore_missing": true } }, - { "rename": { "field": "message2.resp_cc", "target_field": "server.country_code", "ignore_missing": true } }, - { "rename": { "field": "message2.sensorname", "target_field": "observer.name", "ignore_missing": true } }, - { "script": { "lang": "painless", "source": "ctx.network.bytes = (ctx.client.bytes + ctx.server.bytes)", "ignore_failure": true } }, - { "set": { "if": "ctx.connection.state == 'S0'", "field": "connection.state_description", "value": "Connection attempt seen, no reply" } }, - { "set": { "if": "ctx.connection.state == 'S1'", "field": "connection.state_description", "value": "Connection established, not terminated" } }, - { "set": { "if": "ctx.connection.state == 'S2'", "field": "connection.state_description", "value": "Connection established and close attempt by originator seen (but no reply from responder)" } }, - { "set": { "if": "ctx.connection.state == 'S3'", "field": "connection.state_description", "value": "Connection established and close attempt by responder seen (but no reply from originator)" } }, - { "set": { "if": "ctx.connection.state == 'SF'", "field": "connection.state_description", "value": "Normal SYN/FIN completion" } }, - { "set": { "if": "ctx.connection.state == 'REJ'", "field": "connection.state_description", "value": "Connection attempt rejected" } }, - { "set": { "if": "ctx.connection.state == 'RSTO'", "field": "connection.state_description", "value": "Connection established, originator aborted (sent a RST)" } }, - { "set": { "if": "ctx.connection.state == 'RSTR'", "field": "connection.state_description", "value": "Established, responder aborted" } }, - { "set": { "if": "ctx.connection.state == 'RSTOS0'","field": "connection.state_description", "value": "Originator sent a SYN followed by a RST, we never saw a SYN-ACK from the responder" } }, - { "set": { "if": "ctx.connection.state == 'RSTRH'", "field": "connection.state_description", "value": "Responder sent a SYN ACK followed by a RST, we never saw a SYN from the (purported) originator" } }, - { "set": { "if": "ctx.connection.state == 'SH'", "field": "connection.state_description", "value": "Originator sent a SYN followed by a FIN, we never saw a SYN ACK from the responder (hence the connection was 'half' open)" } }, - { "set": { "if": "ctx.connection.state == 'SHR'", "field": "connection.state_description", "value": "Responder sent a SYN ACK followed by a FIN, we never saw a SYN from the originator" } }, - { "set": { "if": "ctx.connection.state == 'OTH'", "field": "connection.state_description", "value": "No SYN seen, just midstream traffic (a 'partial connection' that was not later closed)" } }, - { "pipeline": { "name": "zeek.common" } } - ] -} diff --git a/salt/elasticsearch/files/ingest/suricata.flow b/salt/elasticsearch/files/ingest/suricata.flow new file mode 100644 index 000000000..c51961c05 --- /dev/null +++ b/salt/elasticsearch/files/ingest/suricata.flow @@ -0,0 +1,9 @@ +{ + "description" : "suricata.flow", + "processors" : [ + { "set": { "field": "dataset", "value": "conn" } }, + { "rename": { "field": "message2.proto", "target_field": "network.transport", "ignore_missing": true } }, + { "rename": { "field": "message2.app_proto", "target_field": "network.protocol", "ignore_missing": true } }, + { "pipeline": { "name": "common" } } + ] +}