Add logstash

This commit is contained in:
Josh Brower
2023-01-27 07:49:21 -05:00
parent 81ee333b07
commit 29aa6dceed
9 changed files with 39 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
logstash:
pipelines:
fleet:
config:
- so/0012_input_elastic_agent.conf
- so/9805_output_elastic_agent.conf.jinja

View File

@@ -185,6 +185,8 @@ base:
- minions.adv_{{ grains.id }} - minions.adv_{{ grains.id }}
'*_fleet': '*_fleet':
- soc_global
- adv_global
- backup.soc_backup - backup.soc_backup
- backup.adv_backup - backup.adv_backup
- minions.{{ grains.id }} - minions.{{ grains.id }}

View File

@@ -201,6 +201,7 @@
'ssl', 'ssl',
'telegraf', 'telegraf',
'firewall', 'firewall',
'logstash',
'healthcheck', 'healthcheck',
'schedule', 'schedule',
'elastic-fleet', 'elastic-fleet',

View File

@@ -119,6 +119,25 @@ function add_elastic_to_minion() {
" " >> $PILLARFILE " " >> $PILLARFILE
} }
# Add Elastic Fleet Server settings to the minion file
function add_fleet_to_minion() {
# Create ES Token for Fleet server (Curl to Kibana API)
# TODO: Add error handling
ESTOKEN=$(curl -K /opt/so/conf/elasticsearch/curl.config -L -X POST "localhost:5601/api/fleet/service_tokens" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' | jq -r .value)
# Create Logstash Certs
# Write out settings to minion file
printf '%s\n'\
"logstash_settings:"\
" lsheap: '500m'"\
"fleet-server:"\
" ES-Token: '$ESTOKEN'"\
" " >> $PILLARFILE
}
# Analyst Workstation # Analyst Workstation
function add_analyst_to_minion() { function add_analyst_to_minion() {
printf '%s\n'\ printf '%s\n'\
@@ -170,6 +189,10 @@ function createEVAL() {
add_sensor_to_minion add_sensor_to_minion
} }
function createFLEET() {
add_fleet_to_minion
}
function createIDHNODE() { function createIDHNODE() {
echo "Nothing custom needed for IDH nodes" echo "Nothing custom needed for IDH nodes"
} }

View File

@@ -255,6 +255,9 @@ role:
- {{ portgroups.elastic_agent_data }} - {{ portgroups.elastic_agent_data }}
- {{ portgroups.endgame }} - {{ portgroups.endgame }}
- {{ portgroups.strelka_frontend }} - {{ portgroups.strelka_frontend }}
fleet:
portgroups:
- {{ portgroups.elasticsearch_rest }}
sensors: sensors:
portgroups: portgroups:
- {{ portgroups.docker_registry }} - {{ portgroups.docker_registry }}

View File

@@ -22,7 +22,7 @@
include: include:
- ssl - ssl
{% if GLOBALS.role not in ['so-receiver'] %} {% if GLOBALS.role not in ['so-receiver','so-fleet'] %}
- elasticsearch - elasticsearch
{% endif %} {% endif %}

View File

@@ -152,7 +152,7 @@ rediskeyperms:
- group: 939 - group: 939
{% endif %} {% endif %}
{% if grains['role'] in ['so-manager', 'so-eval', 'so-managersearch', 'so-standalone', 'so-import', 'so-heavynode'] %} {% if grains['role'] in ['so-manager', 'so-eval', 'so-managersearch', 'so-standalone', 'so-import', 'so-heavynode', 'so-fleet'] %}
etc_elasticfleet_key: etc_elasticfleet_key:
x509.private_key_managed: x509.private_key_managed:
- name: /etc/pki/elasticfleet.key - name: /etc/pki/elasticfleet.key

View File

@@ -382,6 +382,7 @@ base:
- sensoroni - sensoroni
- telegraf - telegraf
- firewall - firewall
- logstash
- elastic-fleet - elastic-fleet
- schedule - schedule
- docker_clean - docker_clean

View File

@@ -0,0 +1 @@
{% set ROLE_GLOBALS = {} %}