mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-07 09:42:46 +01:00
Merge remote-tracking branch 'origin/2.4/dev' into orchit
This commit is contained in:
@@ -65,6 +65,7 @@
|
|||||||
'registry',
|
'registry',
|
||||||
'manager',
|
'manager',
|
||||||
'nginx',
|
'nginx',
|
||||||
|
'strelka.manager',
|
||||||
'soc',
|
'soc',
|
||||||
'kratos',
|
'kratos',
|
||||||
'influxdb',
|
'influxdb',
|
||||||
@@ -91,6 +92,7 @@
|
|||||||
'nginx',
|
'nginx',
|
||||||
'telegraf',
|
'telegraf',
|
||||||
'influxdb',
|
'influxdb',
|
||||||
|
'strelka.manager',
|
||||||
'soc',
|
'soc',
|
||||||
'kratos',
|
'kratos',
|
||||||
'elasticfleet',
|
'elasticfleet',
|
||||||
@@ -111,6 +113,7 @@
|
|||||||
'nginx',
|
'nginx',
|
||||||
'telegraf',
|
'telegraf',
|
||||||
'influxdb',
|
'influxdb',
|
||||||
|
'strelka.manager',
|
||||||
'soc',
|
'soc',
|
||||||
'kratos',
|
'kratos',
|
||||||
'elastic-fleet-package-registry',
|
'elastic-fleet-package-registry',
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -37,6 +37,17 @@
|
|||||||
{% do SOCMERGED.config.server.modules.elastalertengine.update({'autoEnabledSigmaRules': SOCMERGED.config.server.modules.elastalertengine.autoEnabledSigmaRules.default}) %}
|
{% do SOCMERGED.config.server.modules.elastalertengine.update({'autoEnabledSigmaRules': SOCMERGED.config.server.modules.elastalertengine.autoEnabledSigmaRules.default}) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{# set elastalertengine.rulesRepos and strelkaengine.rulesRepos based on airgap or not #}
|
||||||
|
{% if GLOBALS.airgap %}
|
||||||
|
{% do SOCMERGED.config.server.modules.elastalertengine.update({'rulesRepos': SOCMERGED.config.server.modules.elastalertengine.rulesRepos.airgap}) %}
|
||||||
|
{% do SOCMERGED.config.server.modules.strelkaengine.update({'rulesRepos': SOCMERGED.config.server.modules.strelkaengine.rulesRepos.airgap}) %}
|
||||||
|
{% do SOCMERGED.config.server.update({'airgapEnabled': true}) %}
|
||||||
|
{% else %}
|
||||||
|
{% do SOCMERGED.config.server.modules.elastalertengine.update({'rulesRepos': SOCMERGED.config.server.modules.elastalertengine.rulesRepos.default}) %}
|
||||||
|
{% do SOCMERGED.config.server.modules.strelkaengine.update({'rulesRepos': SOCMERGED.config.server.modules.strelkaengine.rulesRepos.default}) %}
|
||||||
|
{% do SOCMERGED.config.server.update({'airgapEnabled': false}) %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{# remove these modules if detections is disabled #}
|
{# remove these modules if detections is disabled #}
|
||||||
{% if not SOCMERGED.config.server.client.detectionsEnabled %}
|
{% if not SOCMERGED.config.server.client.detectionsEnabled %}
|
||||||
{% do SOCMERGED.config.server.modules.pop('elastalertengine') %}
|
{% do SOCMERGED.config.server.modules.pop('elastalertengine') %}
|
||||||
|
|||||||
@@ -107,21 +107,18 @@ soc:
|
|||||||
advanced: True
|
advanced: True
|
||||||
helpLink: sigma.html
|
helpLink: sigma.html
|
||||||
rulesRepos:
|
rulesRepos:
|
||||||
description: 'Custom Git repos to pull Sigma rules from. License field is required, folder is optional.'
|
default: &eerulesRepos
|
||||||
|
description: "Custom Git repos to pull Sigma rules from. 'license' field is required, 'folder' is optional. 'community' disables some management options for the imported rules - they can't be deleted or edited, just tuned, duplicated and Enabled | Disabled."
|
||||||
global: True
|
global: True
|
||||||
advanced: True
|
advanced: True
|
||||||
forcedType: "[]{}"
|
forcedType: "[]{}"
|
||||||
helpLink: sigma.html
|
helpLink: sigma.html
|
||||||
|
airgap: *eerulesRepos
|
||||||
sigmaRulePackages:
|
sigmaRulePackages:
|
||||||
description: 'Defines the Sigma Community Ruleset you want to run. One of these (core | core+ | core++ | all ) as well as an optional Add-on (emerging_threats_addon). Once you have changed the ruleset here, you will need to wait for the rule update to take place (every 8 hours), or you can force the update by nagivating to Detections --> Options dropdown menu --> Elastalert --> Full Update. WARNING! Changing the ruleset will remove all existing Sigma rules of the previous ruleset and their associated overrides. This removal cannot be undone.'
|
description: 'Defines the Sigma Community Ruleset you want to run. One of these (core | core+ | core++ | all ) as well as an optional Add-on (emerging_threats_addon). Once you have changed the ruleset here, you will need to wait for the rule update to take place (every 8 hours), or you can force the update by nagivating to Detections --> Options dropdown menu --> Elastalert --> Full Update. WARNING! Changing the ruleset will remove all existing Sigma rules of the previous ruleset and their associated overrides. This removal cannot be undone.'
|
||||||
global: True
|
global: True
|
||||||
advanced: False
|
advanced: False
|
||||||
helpLink: sigma.html
|
helpLink: sigma.html
|
||||||
autoUpdateEnabled:
|
|
||||||
description: 'Set to true to enable automatic Internet-connected updates of the Sigma Community Ruleset. If this is an Airgap system, this setting will be overridden and set to false.'
|
|
||||||
global: True
|
|
||||||
advanced: True
|
|
||||||
helpLink: sigma.html
|
|
||||||
elastic:
|
elastic:
|
||||||
index:
|
index:
|
||||||
description: Comma-separated list of indices or index patterns (wildcard "*" supported) that SOC will search for records.
|
description: Comma-separated list of indices or index patterns (wildcard "*" supported) that SOC will search for records.
|
||||||
@@ -185,45 +182,39 @@ soc:
|
|||||||
advanced: True
|
advanced: True
|
||||||
strelkaengine:
|
strelkaengine:
|
||||||
allowRegex:
|
allowRegex:
|
||||||
description: 'Regex used to filter imported Yara rules. Deny regex takes precedence over the Allow regex setting.'
|
description: 'Regex used to filter imported YARA rules. Deny regex takes precedence over the Allow regex setting.'
|
||||||
global: True
|
global: True
|
||||||
advanced: True
|
advanced: True
|
||||||
helpLink: yara.html
|
helpLink: yara.html
|
||||||
autoEnabledYaraRules:
|
autoEnabledYARARules:
|
||||||
description: 'Yara rules to automatically enable on initial import. Format is $Ruleset - for example, for the default shipped ruleset: securityonion-yara'
|
description: 'YARA rules to automatically enable on initial import. Format is $Ruleset - for example, for the default shipped ruleset: securityonion-yara'
|
||||||
global: True
|
global: True
|
||||||
advanced: True
|
advanced: True
|
||||||
helpLink: sigma.html
|
helpLink: sigma.html
|
||||||
autoUpdateEnabled:
|
|
||||||
description: 'Set to true to enable automatic Internet-connected updates of the Yara rulesets. If this is an Airgap system, this setting will be overridden and set to false.'
|
|
||||||
global: True
|
|
||||||
advanced: True
|
|
||||||
denyRegex:
|
denyRegex:
|
||||||
description: 'Regex used to filter imported Yara rules. Deny regex takes precedence over the Allow regex setting.'
|
description: 'Regex used to filter imported YARA rules. Deny regex takes precedence over the Allow regex setting.'
|
||||||
global: True
|
global: True
|
||||||
advanced: True
|
advanced: True
|
||||||
helpLink: yara.html
|
helpLink: yara.html
|
||||||
communityRulesImportFrequencySeconds:
|
communityRulesImportFrequencySeconds:
|
||||||
description: 'How often to check for new Yara rules (in seconds). This applies to both Community Rules and any configured Git repos.'
|
description: 'How often to check for new YARA rules (in seconds). This applies to both Community Rules and any configured Git repos.'
|
||||||
global: True
|
global: True
|
||||||
advanced: True
|
advanced: True
|
||||||
helpLink: yara.html
|
helpLink: yara.html
|
||||||
rulesRepos:
|
rulesRepos:
|
||||||
description: 'Custom Git repos to pull Yara rules from. License field is required'
|
default: &serulesRepos
|
||||||
|
description: "Custom Git repos to pull YARA rules from. 'license' field is required, 'folder' is optional. 'community' disables some management options for the imported rules - they can't be deleted or edited, just tuned, duplicated and Enabled | Disabled."
|
||||||
global: True
|
global: True
|
||||||
advanced: True
|
advanced: True
|
||||||
forcedType: "[]{}"
|
forcedType: "[]{}"
|
||||||
helpLink: yara.html
|
helpLink: yara.html
|
||||||
|
airgap: *serulesRepos
|
||||||
suricataengine:
|
suricataengine:
|
||||||
allowRegex:
|
allowRegex:
|
||||||
description: 'Regex used to filter imported Suricata rules. Deny regex takes precedence over the Allow regex setting.'
|
description: 'Regex used to filter imported Suricata rules. Deny regex takes precedence over the Allow regex setting.'
|
||||||
global: True
|
global: True
|
||||||
advanced: True
|
advanced: True
|
||||||
helpLink: suricata.html
|
helpLink: suricata.html
|
||||||
autoUpdateEnabled:
|
|
||||||
description: 'Set to true to enable automatic Internet-connected updates of the Suricata rulesets. If this is an Airgap system, this setting will be overridden and set to false.'
|
|
||||||
global: True
|
|
||||||
advanced: True
|
|
||||||
denyRegex:
|
denyRegex:
|
||||||
description: 'Regex used to filter imported Suricata rules. Deny regex takes precedence over the Allow regex setting.'
|
description: 'Regex used to filter imported Suricata rules. Deny regex takes precedence over the Allow regex setting.'
|
||||||
global: True
|
global: True
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ strelka_backend:
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
- restart_policy: on-failure
|
- restart_policy: on-failure
|
||||||
#- watch:
|
|
||||||
#- file: strelkarules
|
|
||||||
|
|
||||||
delete_so-strelka-backend_so-status.disabled:
|
delete_so-strelka-backend_so-status.disabled:
|
||||||
file.uncomment:
|
file.uncomment:
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ def check_syntax(rule_file):
|
|||||||
|
|
||||||
def compile_yara_rules(rules_dir):
|
def compile_yara_rules(rules_dir):
|
||||||
compiled_dir = os.path.join(rules_dir, "compiled")
|
compiled_dir = os.path.join(rules_dir, "compiled")
|
||||||
compiled_rules_path = os.path.join(compiled_dir, "rules.compiled")
|
compiled_rules_path = [ os.path.join(compiled_dir, "rules.compiled"), "/opt/so/saltstack/default/salt/strelka/rules/compiled/rules.compiled" ]
|
||||||
rule_files = glob.glob(os.path.join(rules_dir, '**/*.yar'), recursive=True)
|
rule_files = glob.glob(os.path.join(rules_dir, '**/*.yar'), recursive=True)
|
||||||
files_to_compile = {}
|
files_to_compile = {}
|
||||||
removed_count = 0
|
removed_count = 0
|
||||||
@@ -57,8 +57,9 @@ def compile_yara_rules(rules_dir):
|
|||||||
# Compile all remaining valid rules into a single file
|
# Compile all remaining valid rules into a single file
|
||||||
if files_to_compile:
|
if files_to_compile:
|
||||||
compiled_rules = yara.compile(filepaths=files_to_compile)
|
compiled_rules = yara.compile(filepaths=files_to_compile)
|
||||||
compiled_rules.save(compiled_rules_path)
|
for path in compiled_rules_path:
|
||||||
print(f"All remaining rules compiled and saved into {compiled_rules_path}")
|
compiled_rules.save(path)
|
||||||
|
print(f"All remaining rules compiled and saved into {path}")
|
||||||
|
|
||||||
# Print summary of compilation results
|
# Print summary of compilation results
|
||||||
print(f"Summary: {success_count} rules compiled successfully, {removed_count} rules removed due to errors.")
|
print(f"Summary: {success_count} rules compiled successfully, {removed_count} rules removed due to errors.")
|
||||||
|
|||||||
@@ -29,6 +29,15 @@ strelkarulesdir:
|
|||||||
- group: 939
|
- group: 939
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
|
|
||||||
|
{%- if grains.role in ['so-sensor', 'so-heavynode'] %}
|
||||||
|
strelkasensorrules:
|
||||||
|
file.managed:
|
||||||
|
- name: /opt/so/conf/strelka/rules/compiled/rules.compiled
|
||||||
|
- source: salt://strelka/rules/compiled/rules.compiled
|
||||||
|
- user: 939
|
||||||
|
- group: 939
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
strelkareposdir:
|
strelkareposdir:
|
||||||
file.directory:
|
file.directory:
|
||||||
- name: /opt/so/conf/strelka/repos
|
- name: /opt/so/conf/strelka/repos
|
||||||
|
|||||||
45
salt/strelka/manager.sls
Normal file
45
salt/strelka/manager.sls
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
|
||||||
|
# or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at
|
||||||
|
# https://securityonion.net/license; you may not use this file except in compliance with the
|
||||||
|
# Elastic License 2.0.
|
||||||
|
|
||||||
|
{% from 'allowed_states.map.jinja' import allowed_states %}
|
||||||
|
{% if sls in allowed_states %}
|
||||||
|
|
||||||
|
# Strelka config
|
||||||
|
strelkaconfdir:
|
||||||
|
file.directory:
|
||||||
|
- name: /opt/so/conf/strelka/rules/compiled/
|
||||||
|
- user: 939
|
||||||
|
- group: 939
|
||||||
|
- makedirs: True
|
||||||
|
|
||||||
|
strelkacompileyara:
|
||||||
|
file.managed:
|
||||||
|
- name: /opt/so/conf/strelka/compile_yara.py
|
||||||
|
- source: salt://strelka/compile_yara/compile_yara.py
|
||||||
|
- user: 939
|
||||||
|
- group: 939
|
||||||
|
- makedirs: True
|
||||||
|
|
||||||
|
strelkarulesdir:
|
||||||
|
file.directory:
|
||||||
|
- name: /opt/so/conf/strelka/rules
|
||||||
|
- user: 939
|
||||||
|
- group: 939
|
||||||
|
- makedirs: True
|
||||||
|
|
||||||
|
strelkareposdir:
|
||||||
|
file.directory:
|
||||||
|
- name: /opt/so/conf/strelka/repos
|
||||||
|
- user: 939
|
||||||
|
- group: 939
|
||||||
|
- makedirs: True
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
{{sls}}_state_not_allowed:
|
||||||
|
test.fail_without_changes:
|
||||||
|
- name: {{sls}}_state_not_allowed
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
0
salt/strelka/rules/compiled/DO.NOT.TOUCH
Normal file
0
salt/strelka/rules/compiled/DO.NOT.TOUCH
Normal file
@@ -87,6 +87,7 @@ base:
|
|||||||
- registry
|
- registry
|
||||||
- nginx
|
- nginx
|
||||||
- influxdb
|
- influxdb
|
||||||
|
- strelka.manager
|
||||||
- soc
|
- soc
|
||||||
- kratos
|
- kratos
|
||||||
- firewall
|
- firewall
|
||||||
@@ -161,6 +162,7 @@ base:
|
|||||||
- registry
|
- registry
|
||||||
- nginx
|
- nginx
|
||||||
- influxdb
|
- influxdb
|
||||||
|
- strelka.manager
|
||||||
- soc
|
- soc
|
||||||
- kratos
|
- kratos
|
||||||
- firewall
|
- firewall
|
||||||
@@ -210,6 +212,7 @@ base:
|
|||||||
- manager
|
- manager
|
||||||
- nginx
|
- nginx
|
||||||
- influxdb
|
- influxdb
|
||||||
|
- strelka.manager
|
||||||
- soc
|
- soc
|
||||||
- kratos
|
- kratos
|
||||||
- sensoroni
|
- sensoroni
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ log_has_errors() {
|
|||||||
grep -vE "Reading first line of patchfile" | \
|
grep -vE "Reading first line of patchfile" | \
|
||||||
grep -vE "Command failed with exit code" | \
|
grep -vE "Command failed with exit code" | \
|
||||||
grep -vE "Running scope as unit" | \
|
grep -vE "Running scope as unit" | \
|
||||||
|
grep -vE "securityonion-resources/sigma/stable" | \
|
||||||
grep -vE "log-.*-pipeline_failed_attempts" &> "$error_log"
|
grep -vE "log-.*-pipeline_failed_attempts" &> "$error_log"
|
||||||
|
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ whiptail_airgap() {
|
|||||||
[[ $is_manager || $is_import ]] && node_str='manager'
|
[[ $is_manager || $is_import ]] && node_str='manager'
|
||||||
|
|
||||||
INTERWEBS=$(whiptail --title "$whiptail_title" --menu \
|
INTERWEBS=$(whiptail --title "$whiptail_title" --menu \
|
||||||
"How should this $node_str be installed?" 10 70 2 \
|
"How should this $node_str be installed?\n\nFor more information, please see:\n$DOC_BASE_URL/airgap.html" 13 70 2 \
|
||||||
"Standard " "This $node_str has access to the Internet" \
|
"Standard " "This $node_str has access to the Internet" \
|
||||||
"Airgap " "This $node_str does not have access to the Internet" 3>&1 1>&2 2>&3 )
|
"Airgap " "This $node_str does not have access to the Internet" 3>&1 1>&2 2>&3 )
|
||||||
|
|
||||||
@@ -592,8 +592,8 @@ whiptail_install_type() {
|
|||||||
"IMPORT" "Import PCAP or log files " \
|
"IMPORT" "Import PCAP or log files " \
|
||||||
"EVAL" "Evaluation mode (not for production) " \
|
"EVAL" "Evaluation mode (not for production) " \
|
||||||
"STANDALONE" "Standalone production install " \
|
"STANDALONE" "Standalone production install " \
|
||||||
"DISTRIBUTED" "Distributed install submenu " \
|
"DISTRIBUTED" "Distributed deployment " \
|
||||||
"DESKTOP" "Install Security Onion Desktop" \
|
"DESKTOP" "Security Onion Desktop" \
|
||||||
3>&1 1>&2 2>&3
|
3>&1 1>&2 2>&3
|
||||||
)
|
)
|
||||||
elif [[ "$OSVER" == "focal" ]]; then
|
elif [[ "$OSVER" == "focal" ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user