dont run curator on searchnode if truecluster is enabled - https://github.com/Security-Onion-Solutions/securityonion/issues/2806

This commit is contained in:
m0duspwnens
2021-08-04 09:40:34 -04:00
parent 1aeb2d7d4f
commit 52cb72ba67
3 changed files with 32 additions and 12 deletions

View File

@@ -6,6 +6,7 @@
{% set MANAGER = salt['grains.get']('master') %} {% set MANAGER = salt['grains.get']('master') %}
{% if grains['role'] in ['so-eval', 'so-node', 'so-managersearch', 'so-heavynode', 'so-standalone'] %} {% if grains['role'] in ['so-eval', 'so-node', 'so-managersearch', 'so-heavynode', 'so-standalone'] %}
{% from 'elasticsearch/auth.map.jinja' import ELASTICAUTH with context %} {% from 'elasticsearch/auth.map.jinja' import ELASTICAUTH with context %}
{% from "curator/map.jinja" import CURATOROPTIONS with context %}
# Curator # Curator
# Create the group # Create the group
curatorgroup: curatorgroup:
@@ -118,8 +119,10 @@ so-curatordeletecron:
- dayweek: '*' - dayweek: '*'
so-curator: so-curator:
docker_container.running: docker_container.{{ CURATOROPTIONS.status }}:
{% if CURATOROPTIONS.status == 'running' %}
- image: {{ MANAGER }}:5000/{{ IMAGEREPO }}/so-curator:{{ VERSION }} - image: {{ MANAGER }}:5000/{{ IMAGEREPO }}/so-curator:{{ VERSION }}
- start: {{ CURATOROPTIONS.start }}
- hostname: curator - hostname: curator
- name: so-curator - name: so-curator
- user: curator - user: curator
@@ -129,11 +132,27 @@ so-curator:
- /opt/so/conf/curator/curator.yml:/etc/curator/config/curator.yml:ro - /opt/so/conf/curator/curator.yml:/etc/curator/config/curator.yml:ro
- /opt/so/conf/curator/action/:/etc/curator/action:ro - /opt/so/conf/curator/action/:/etc/curator/action:ro
- /opt/so/log/curator:/var/log/curator:rw - /opt/so/log/curator:/var/log/curator:rw
{% else %}
- force: True
{% endif %}
append_so-curator_so-status.conf: append_so-curator_so-status.conf:
file.append: file.append:
- name: /opt/so/conf/so-status/so-status.conf - name: /opt/so/conf/so-status/so-status.conf
- text: so-curator - text: so-curator
- unless: grep -q so-curator /opt/so/conf/so-status/so-status.conf
{% if not CURATOROPTIONS.start %}
so-curator_so-status.disabled:
file.comment:
- name: /opt/so/conf/so-status/so-status.conf
- regex: ^so-curator$
{% else %}
delete_so-curator_so-status.disabled:
file.uncomment:
- name: /opt/so/conf/so-status/so-status.conf
- regex: ^so-curator$
{% endif %}
# Begin Curator Cron Jobs # Begin Curator Cron Jobs

12
salt/curator/map.jinja Normal file
View File

@@ -0,0 +1,12 @@
{% set CURATOROPTIONS = {} %}
{% set ENABLED = salt['pillar.get']('curator:enabled', True) %}
{% set TRUECLUSTER = salt['pillar.get']('elasticsearch:true_cluster', False) %}
# don't start the docker container if searchnode and true clustering is enabled or disabled via pillar
{% if (grains.id.split('_')|last == 'searchnode' and TRUECLUSTER) or not ENABLED %}
{% do CURATOROPTIONS.update({'start': False}) %}
{% do CURATOROPTIONS.update({'status': 'absent'}) %}
{% else %}
{% do CURATOROPTIONS.update({'start': True}) %}
{% do CURATOROPTIONS.update({'status': 'running'}) %}
{% endif %}

View File

@@ -11,7 +11,6 @@
{% set FILEBEAT = salt['pillar.get']('filebeat:enabled', True) %} {% set FILEBEAT = salt['pillar.get']('filebeat:enabled', True) %}
{% set KIBANA = salt['pillar.get']('kibana:enabled', True) %} {% set KIBANA = salt['pillar.get']('kibana:enabled', True) %}
{% set LOGSTASH = salt['pillar.get']('logstash:enabled', True) %} {% set LOGSTASH = salt['pillar.get']('logstash:enabled', True) %}
{% set CURATOR = salt['pillar.get']('curator:enabled', True) %}
{% set REDIS = salt['pillar.get']('redis:enabled', True) %} {% set REDIS = salt['pillar.get']('redis:enabled', True) %}
{% set STRELKA = salt['pillar.get']('strelka:enabled', '0') %} {% set STRELKA = salt['pillar.get']('strelka:enabled', '0') %}
{% import_yaml 'salt/minion.defaults.yaml' as saltversion %} {% import_yaml 'salt/minion.defaults.yaml' as saltversion %}
@@ -127,9 +126,7 @@ base:
{%- if FILEBEAT %} {%- if FILEBEAT %}
- filebeat - filebeat
{%- endif %} {%- endif %}
{%- if CURATOR %}
- curator - curator
{%- endif %}
{%- if ELASTALERT %} {%- if ELASTALERT %}
- elastalert - elastalert
{%- endif %} {%- endif %}
@@ -265,9 +262,7 @@ base:
{%- if FILEBEAT %} {%- if FILEBEAT %}
- filebeat - filebeat
{%- endif %} {%- endif %}
{%- if CURATOR %}
- curator - curator
{%- endif %}
{%- if ELASTALERT %} {%- if ELASTALERT %}
- elastalert - elastalert
{%- endif %} {%- endif %}
@@ -310,9 +305,7 @@ base:
{%- if LOGSTASH %} {%- if LOGSTASH %}
- logstash - logstash
{%- endif %} {%- endif %}
{%- if CURATOR %}
- curator - curator
{%- endif %}
{%- if FILEBEAT %} {%- if FILEBEAT %}
- filebeat - filebeat
{%- endif %} {%- endif %}
@@ -354,9 +347,7 @@ base:
{%- if REDIS %} {%- if REDIS %}
- redis - redis
{%- endif %} {%- endif %}
{%- if CURATOR %}
- curator - curator
{%- endif %}
{%- if KIBANA %} {%- if KIBANA %}
- kibana - kibana
{%- endif %} {%- endif %}
@@ -409,9 +400,7 @@ base:
{%- if REDIS %} {%- if REDIS %}
- redis - redis
{%- endif %} {%- endif %}
{%- if CURATOR %}
- curator - curator
{%- endif %}
{%- if FILEBEAT %} {%- if FILEBEAT %}
- filebeat - filebeat
{%- endif %} {%- endif %}