mirror of
https://github.com/certat/intelmq-docker.git
synced 2025-12-06 09:12:49 +01:00
Compare commits
4 Commits
c146edfe86
...
enh-test
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01d53b3738 | ||
|
|
1b1e0cbdc3 | ||
|
|
0aa3588c45 | ||
|
|
bf2c95fe2a |
@@ -3,6 +3,7 @@ upstream intelmq_api {
|
|||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
server_tokens off;
|
||||||
listen 80 default_server;
|
listen 80 default_server;
|
||||||
|
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|||||||
0
custom_bots/ecs/__init__.py
Normal file
0
custom_bots/ecs/__init__.py
Normal file
38
custom_bots/ecs/expert.py
Normal file
38
custom_bots/ecs/expert.py
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# SPDX-FileCopyrightText: 2021 Birger Schacht
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
import json
|
||||||
|
from intelmq.lib.bot import Bot
|
||||||
|
|
||||||
|
|
||||||
|
class ECSExpertBot(Bot):
|
||||||
|
"""Write some fields to the output field in ECS format"""
|
||||||
|
|
||||||
|
def process(self):
|
||||||
|
msg = self.receive_message()
|
||||||
|
|
||||||
|
ecs = {}
|
||||||
|
|
||||||
|
# If the event source has no original timestamp, this value is
|
||||||
|
# typically populated by the first time the event was received by the
|
||||||
|
# pipeline.
|
||||||
|
# (https://www.elastic.co/guide/en/ecs/current/ecs-base.html)
|
||||||
|
ecs['@timestamp'] = msg['time.source'] if 'time.source' in msg else msg['time.observation']
|
||||||
|
|
||||||
|
if 'feed.provider' in msg:
|
||||||
|
ecs['event.provider'] = msg['feed.provider']
|
||||||
|
if 'source.ip' in msg:
|
||||||
|
ecs['server.ip'] = msg['source.ip']
|
||||||
|
if 'source.fqdn' in msg:
|
||||||
|
ecs['server.domain'] = msg['source.fqdn']
|
||||||
|
if 'feed.name' in msg:
|
||||||
|
ecs['event.dataset'] = msg['feed.name']
|
||||||
|
|
||||||
|
msg.add("output", json.dumps(ecs))
|
||||||
|
|
||||||
|
self.send_message(msg)
|
||||||
|
self.acknowledge_message()
|
||||||
|
|
||||||
|
|
||||||
|
BOT = ECSExpertBot
|
||||||
@@ -26,6 +26,9 @@ services:
|
|||||||
- ./example_config/intelmq-api/config.json:/etc/intelmq/api-config.json
|
- ./example_config/intelmq-api/config.json:/etc/intelmq/api-config.json
|
||||||
- ./intelmq_logs:/opt/intelmq/var/log
|
- ./intelmq_logs:/opt/intelmq/var/log
|
||||||
- ./intelmq_output:/opt/intelmq/var/lib/bots
|
- ./intelmq_output:/opt/intelmq/var/lib/bots
|
||||||
|
|
||||||
|
- ./custom_bots/ecs/__init__.py:/etc/intelmq/intelmq/bots/experts/ecs/__init__.py:ro
|
||||||
|
- ./custom_bots/ecs/expert.py:/etc/intelmq/intelmq/bots/experts/ecs/expert.py:ro
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
Reference in New Issue
Block a user