mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-01-15 12:41:32 +01:00
Merge pull request #199 from Security-Onion-Solutions/feature/issue127
manage threshold.conf with Salt - #127
This commit is contained in:
36
salt/suricata/files/threshold.conf.jinja
Normal file
36
salt/suricata/files/threshold.conf.jinja
Normal file
@@ -0,0 +1,36 @@
|
||||
{% set THRESHOLDING = salt['pillar.get']('thresholding', {}) -%}
|
||||
|
||||
{% if THRESHOLDING -%}
|
||||
|
||||
{% for EACH_SID in THRESHOLDING.sids -%}
|
||||
{% for ACTIONS_LIST in THRESHOLDING.sids[EACH_SID] -%}
|
||||
{% for EACH_ACTION in ACTIONS_LIST -%}
|
||||
|
||||
{%- if EACH_ACTION == 'threshold' %}
|
||||
{{ EACH_ACTION }} gen_id {{ ACTIONS_LIST[EACH_ACTION].gen_id }}, sig_id {{ EACH_SID }}, type {{ ACTIONS_LIST[EACH_ACTION].type }}, track {{ ACTIONS_LIST[EACH_ACTION].track }}, count {{ ACTIONS_LIST[EACH_ACTION].count }}, seconds {{ ACTIONS_LIST[EACH_ACTION].seconds }}
|
||||
|
||||
{%- elif EACH_ACTION == 'rate_filter' %}
|
||||
{%- if ACTIONS_LIST[EACH_ACTION].new_action not in ['drop','reject'] %}
|
||||
{{ EACH_ACTION }} gen_id {{ ACTIONS_LIST[EACH_ACTION].gen_id }}, sig_id {{ EACH_SID }}, track {{ ACTIONS_LIST[EACH_ACTION].track }}, count {{ ACTIONS_LIST[EACH_ACTION].count }}, seconds {{ ACTIONS_LIST[EACH_ACTION].seconds }}, new_action {{ ACTIONS_LIST[EACH_ACTION].new_action }}, timeout {{ ACTIONS_LIST[EACH_ACTION].timeout }}
|
||||
{%- else %}
|
||||
##### Security Onion does not support drop or reject actions for rate_filter
|
||||
##### {{ EACH_ACTION }} gen_id {{ ACTIONS_LIST[EACH_ACTION].gen_id }}, sig_id {{ EACH_SID }}, track {{ ACTIONS_LIST[EACH_ACTION].track }}, count {{ ACTIONS_LIST[EACH_ACTION].count }}, seconds {{ ACTIONS_LIST[EACH_ACTION].seconds }}, new_action {{ ACTIONS_LIST[EACH_ACTION].new_action }}, timeout {{ ACTIONS_LIST[EACH_ACTION].timeout }}
|
||||
{%- endif %}
|
||||
|
||||
{%- elif EACH_ACTION == 'suppress' %}
|
||||
{%- if ACTIONS_LIST[EACH_ACTION].track is defined %}
|
||||
{{ EACH_ACTION }} gen_id {{ ACTIONS_LIST[EACH_ACTION].gen_id }}, sig_id {{ EACH_SID }}, track {{ ACTIONS_LIST[EACH_ACTION].track }}, ip {{ ACTIONS_LIST[EACH_ACTION].ip }}
|
||||
{%- else %}
|
||||
{{ EACH_ACTION }} gen_id {{ ACTIONS_LIST[EACH_ACTION].gen_id }}, sig_id {{ EACH_SID }}
|
||||
{%- endif %}
|
||||
|
||||
{%- endif %}
|
||||
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
|
||||
{%- else %}
|
||||
##### The thresholding pillar has not been defined
|
||||
|
||||
{%- endif %}
|
||||
@@ -70,6 +70,14 @@ suriconfigsync:
|
||||
- group: 940
|
||||
- template: jinja
|
||||
|
||||
surithresholding:
|
||||
file.managed:
|
||||
- name: /opt/so/conf/suricata/threshold.conf
|
||||
- source: salt://suricata/files/threshold.conf.jinja
|
||||
- user: 940
|
||||
- group: 940
|
||||
- template: jinja
|
||||
|
||||
so-suricataimage:
|
||||
cmd.run:
|
||||
- name: docker pull --disable-content-trust=false docker.io/soshybridhunter/so-suricata:HH1.1.1
|
||||
@@ -84,9 +92,11 @@ so-suricata:
|
||||
- INTERFACE={{ interface }}
|
||||
- binds:
|
||||
- /opt/so/conf/suricata/suricata.yaml:/etc/suricata/suricata.yaml:ro
|
||||
- /opt/so/conf/suricata/threshold.conf:/etc/suricata/threshold.conf:ro
|
||||
- /opt/so/conf/suricata/rules:/etc/suricata/rules:ro
|
||||
- /opt/so/log/suricata/:/var/log/suricata/:rw
|
||||
- network_mode: host
|
||||
- watch:
|
||||
- file: /opt/so/conf/suricata/suricata.yaml
|
||||
- file: surithresholding
|
||||
- file: /opt/so/conf/suricata/rules/
|
||||
|
||||
Reference in New Issue
Block a user