Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix sensoroni for non sensor #12497

Merged
merged 3 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions salt/sensoroni/files/sensoroni.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{%- from 'vars/globals.map.jinja' import GLOBALS %}
{%- from 'sensoroni/map.jinja' import SENSORONIMERGED %}
{%- from 'pcap/config.map.jinja' import PCAPMERGED %}
{%- from 'suricata/map.jinja' import SURICATAMERGED %}
{% from 'vars/globals.map.jinja' import GLOBALS %}
{%- from 'sensoroni/map.jinja' import SENSORONIMERGED -%}
{
"logFilename": "/opt/sensoroni/logs/sensoroni.log",
"logLevel":"info",
Expand All @@ -24,22 +22,26 @@
"importer": {},
"statickeyauth": {
"apiKey": "{{ GLOBALS.sensoroni_key }}"
{#- if PCAPMERGED.enabled is true then we know that steno is the pcap engine #}
{#- if it is false, then user has steno disabled in ui or has selected suricata for pcap engine #}
{%- if PCAPMERGED.enabled %}
{% if GLOBALS.is_sensor %}
{% from 'pcap/config.map.jinja' import PCAPMERGED %}
{% from 'suricata/map.jinja' import SURICATAMERGED %}
{# if PCAPMERGED.enabled is true then we know that steno is the pcap engine #}
{# if it is false, then user has steno disabled in ui or has selected suricata for pcap engine #}
{%- if PCAPMERGED.enabled %}
},
"stenoquery": {
"executablePath": "/opt/sensoroni/scripts/stenoquery.sh",
"pcapInputPath": "/nsm/pcap",
"pcapOutputPath": "/nsm/pcapout"
}
{%- elif GLOBALS.pcap_engine == "SURICATA" and SURICATAMERGED.enabled %}
{%- elif GLOBALS.pcap_engine == "SURICATA" and SURICATAMERGED.enabled %}
},
"suriquery": {
"executablePath": "/opt/sensoroni/scripts/suriquery.sh",
"pcapInputPath": "/nsm/suripcap",
"pcapOutputPath": "/nsm/pcapout"
}
{% endif %}
{%- else %}
}
{%- endif %}
Expand Down
4 changes: 4 additions & 0 deletions salt/vars/globals.map.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
set GLOBALS = {
'hostname': INIT.GRAINS.nodename,
'is_manager': false,
'is_sensor': false,
'manager': INIT.GRAINS.master,
'minion_id': INIT.GRAINS.id,
'main_interface': INIT.PILLAR.host.mainint,
Expand Down Expand Up @@ -63,5 +64,8 @@
{% do GLOBALS.update({'is_manager': true}) %}
{% endif %}

{% if GLOBALS.role in GLOBALS.sensor_roles %}
{% do GLOBALS.update({'is_sensor': true}) %}
{% endif %}

{% do salt['defaults.merge'](GLOBALS, ROLE_GLOBALS, merge_lists=False, in_place=True) %}
Loading