change which user runs filecheck cron based on md engine

This commit is contained in:
m0duspwnens
2023-08-08 17:25:08 -04:00
parent 2dbe679849
commit 6da2f117f2
2 changed files with 26 additions and 6 deletions

View File

@@ -6,7 +6,7 @@
{% from 'allowed_states.map.jinja' import allowed_states %} {% from 'allowed_states.map.jinja' import allowed_states %}
{% if sls.split('.')[0] in allowed_states %} {% if sls.split('.')[0] in allowed_states %}
{% from 'strelka/map.jinja' import STRELKAMERGED %} {% from 'strelka/map.jinja' import STRELKAMERGED %}
{% from 'strelka/map.jinja' import filecheck_runas %} {% from 'vars/globals.map.jinja' import GLOBALS %}
include: include:
- strelka.config - strelka.config
@@ -87,11 +87,33 @@ filecheck_restart:
- file: filecheck_script - file: filecheck_script
- file: filecheck_conf - file: filecheck_conf
filecheck_run: {% if GLOBALS.md_engine == 'ZEEK' %}
filecheck_run_socore:
cron.present: cron.present:
- name: 'ps -ef | grep filecheck | grep -v grep > /dev/null 2>&1 || python3 /opt/so/conf/strelka/filecheck >> /opt/so/log/strelka/filecheck_stdout.log 2>&1 &' - name: 'ps -ef | grep filecheck | grep -v grep > /dev/null 2>&1 || python3 /opt/so/conf/strelka/filecheck >> /opt/so/log/strelka/filecheck_stdout.log 2>&1 &'
- identifier: filecheck_run - identifier: filecheck_run_socore
- user: {{ filecheck_runas }} - user: socore
remove_filecheck_run_suricata:
cron.absent:
- identifier: filecheck_run_suricata
- user: suricata
{% elif GLOBALS.md_engine == 'SURICATA'%}
filecheck_run_suricata:
cron.present:
- name: 'ps -ef | grep filecheck | grep -v grep > /dev/null 2>&1 || python3 /opt/so/conf/strelka/filecheck >> /opt/so/log/strelka/filecheck_stdout.log 2>&1 &'
- identifier: filecheck_run_suricata
- user: suricata
remove_filecheck_run_socore:
cron.absent:
- identifier: filecheck_run_socore
- user: socore
{% endif %}
filcheck_history_clean: filcheck_history_clean:
cron.present: cron.present:

View File

@@ -24,10 +24,8 @@
{% if GLOBALS.md_engine == "SURICATA" %} {% if GLOBALS.md_engine == "SURICATA" %}
{% set extract_path = '/nsm/suricata/extracted' %} {% set extract_path = '/nsm/suricata/extracted' %}
{% set filecheck_runas = 'suricata' %}
{% else %} {% else %}
{% set extract_path = '/nsm/zeek/extracted/complete' %} {% set extract_path = '/nsm/zeek/extracted/complete' %}
{% set filecheck_runas = 'socore' %}
{% endif %} {% endif %}
{% do STRELKADEFAULTS.strelka.filecheck.update({'extract_path': extract_path}) %} {% do STRELKADEFAULTS.strelka.filecheck.update({'extract_path': extract_path}) %}