mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-03-18 10:46:29 +01:00
Compare commits
44 Commits
TOoSmOotH-
...
zeekload
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0e0e3e97b | ||
|
|
6b039b3f94 | ||
|
|
e6ee7dac7c | ||
|
|
70597a77ab | ||
|
|
f5faf86cb3 | ||
|
|
be4e253620 | ||
|
|
ebc1152376 | ||
|
|
625bfb3ba7 | ||
|
|
c11b83c712 | ||
|
|
a3b471c1d1 | ||
|
|
64bb0dfb5b | ||
|
|
ddb26a9f42 | ||
|
|
5b2def6fdd | ||
|
|
9b6d29212d | ||
|
|
c1bff03b1c | ||
|
|
b00f113658 | ||
|
|
7dcd923ebf | ||
|
|
1fcd8a7c1a | ||
|
|
4a89f7f26b | ||
|
|
a9196348ab | ||
|
|
12dec366e0 | ||
|
|
1713f6af76 | ||
|
|
7f4adb70bd | ||
|
|
e2483e4be0 | ||
|
|
322c0b8d56 | ||
|
|
81c1d8362d | ||
|
|
d1156ee3fd | ||
|
|
18f971954b | ||
|
|
e55ac7062c | ||
|
|
c178eada22 | ||
|
|
92213e302f | ||
|
|
72193b0249 | ||
|
|
066d7106b0 | ||
|
|
89f144df75 | ||
|
|
cfccbe2bed | ||
|
|
0360d4145c | ||
|
|
398bd0c1da | ||
|
|
32241faf55 | ||
|
|
88de779ff7 | ||
|
|
d452694c55 | ||
|
|
7fba8ac2b4 | ||
|
|
6809a40257 | ||
|
|
cea55a72c3 | ||
|
|
e38a4a21ee |
2
.github/workflows/pythontest.yml
vendored
2
.github/workflows/pythontest.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.13"]
|
||||
python-version: ["3.14"]
|
||||
python-code-path: ["salt/sensoroni/files/analyzers", "salt/manager/tools/sbin"]
|
||||
|
||||
steps:
|
||||
|
||||
@@ -67,7 +67,7 @@ delete_so-hydra_so-status.disabled:
|
||||
|
||||
wait_for_hydra:
|
||||
http.wait_for_successful_query:
|
||||
- name: 'http://{{ GLOBALS.manager }}:4444/'
|
||||
- name: 'http://{{ GLOBALS.manager }}:4444/health/alive'
|
||||
- ssl: True
|
||||
- verify_ssl: False
|
||||
- status:
|
||||
|
||||
@@ -134,8 +134,8 @@ function require() {
|
||||
function verifyEnvironment() {
|
||||
require "jq"
|
||||
require "curl"
|
||||
response=$(curl -Ss -L ${hydraUrl}/)
|
||||
[[ "$response" != *"Error 404"* ]] && fail "Unable to communicate with Hydra; specify URL via HYDRA_URL environment variable"
|
||||
response=$(curl -Ss -L ${hydraUrl}/health/alive)
|
||||
[[ "$response" != '{"status":"ok"}' ]] && fail "Unable to communicate with Hydra; specify URL via HYDRA_URL environment variable"
|
||||
}
|
||||
|
||||
function createFile() {
|
||||
|
||||
@@ -462,19 +462,14 @@ function add_sensor_to_minion() {
|
||||
echo " lb_procs: '$CORECOUNT'"
|
||||
echo "suricata:"
|
||||
echo " enabled: True "
|
||||
echo " pcap:"
|
||||
echo " enabled: True"
|
||||
if [[ $is_pcaplimit ]]; then
|
||||
echo " pcap:"
|
||||
echo " maxsize: $MAX_PCAP_SPACE"
|
||||
fi
|
||||
echo " config:"
|
||||
echo " af-packet:"
|
||||
echo " threads: '$CORECOUNT'"
|
||||
echo "pcap:"
|
||||
echo " enabled: True"
|
||||
if [[ $is_pcaplimit ]]; then
|
||||
echo " config:"
|
||||
echo " diskfreepercentage: $DFREEPERCENT"
|
||||
fi
|
||||
echo " "
|
||||
} >> $PILLARFILE
|
||||
if [ $? -ne 0 ]; then
|
||||
|
||||
@@ -22,7 +22,7 @@ def showUsage(args):
|
||||
print(' removelistitem - Remove a list item from a yaml key, if it exists and is a list. Requires KEY and LISTITEM args.', file=sys.stderr)
|
||||
print(' replacelistobject - Replace a list object based on a condition. Requires KEY, CONDITION_FIELD, CONDITION_VALUE, and JSON_OBJECT args.', file=sys.stderr)
|
||||
print(' add - Add a new key and set its value. Fails if key already exists. Requires KEY and VALUE args.', file=sys.stderr)
|
||||
print(' get - Displays (to stdout) the value stored in the given key. Requires KEY arg.', file=sys.stderr)
|
||||
print(' get [-r] - Displays (to stdout) the value stored in the given key. Requires KEY arg. Use -r for raw output without YAML formatting.', file=sys.stderr)
|
||||
print(' remove - Removes a yaml key, if it exists. Requires KEY arg.', file=sys.stderr)
|
||||
print(' replace - Replaces (or adds) a new key and set its value. Requires KEY and VALUE args.', file=sys.stderr)
|
||||
print(' help - Prints this usage information.', file=sys.stderr)
|
||||
@@ -256,7 +256,7 @@ def replacelistobject(args):
|
||||
def addKey(content, key, value):
|
||||
pieces = key.split(".", 1)
|
||||
if len(pieces) > 1:
|
||||
if not pieces[0] in content:
|
||||
if pieces[0] not in content or content[pieces[0]] is None:
|
||||
content[pieces[0]] = {}
|
||||
addKey(content[pieces[0]], pieces[1], value)
|
||||
elif key in content:
|
||||
@@ -332,6 +332,11 @@ def getKeyValue(content, key):
|
||||
|
||||
|
||||
def get(args):
|
||||
raw = False
|
||||
if len(args) > 0 and args[0] == '-r':
|
||||
raw = True
|
||||
args = args[1:]
|
||||
|
||||
if len(args) != 2:
|
||||
print('Missing filename or key arg', file=sys.stderr)
|
||||
showUsage(None)
|
||||
@@ -346,7 +351,15 @@ def get(args):
|
||||
print(f"Key '{key}' not found by so-yaml.py", file=sys.stderr)
|
||||
return 2
|
||||
|
||||
print(yaml.safe_dump(output))
|
||||
if raw:
|
||||
if isinstance(output, bool):
|
||||
print(str(output).lower())
|
||||
elif isinstance(output, (dict, list)):
|
||||
print(yaml.safe_dump(output).strip())
|
||||
else:
|
||||
print(output)
|
||||
else:
|
||||
print(yaml.safe_dump(output))
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
@@ -395,6 +395,17 @@ class TestRemove(unittest.TestCase):
|
||||
self.assertEqual(result, 0)
|
||||
self.assertIn("45\n...", mock_stdout.getvalue())
|
||||
|
||||
def test_get_int_raw(self):
|
||||
with patch('sys.stdout', new=StringIO()) as mock_stdout:
|
||||
filename = "/tmp/so-yaml_test-get.yaml"
|
||||
file = open(filename, "w")
|
||||
file.write("{key1: { child1: 123, child2: { deep1: 45 } }, key2: false, key3: [e,f,g]}")
|
||||
file.close()
|
||||
|
||||
result = soyaml.get(["-r", filename, "key1.child2.deep1"])
|
||||
self.assertEqual(result, 0)
|
||||
self.assertEqual("45\n", mock_stdout.getvalue())
|
||||
|
||||
def test_get_str(self):
|
||||
with patch('sys.stdout', new=StringIO()) as mock_stdout:
|
||||
filename = "/tmp/so-yaml_test-get.yaml"
|
||||
@@ -406,6 +417,51 @@ class TestRemove(unittest.TestCase):
|
||||
self.assertEqual(result, 0)
|
||||
self.assertIn("hello\n...", mock_stdout.getvalue())
|
||||
|
||||
def test_get_str_raw(self):
|
||||
with patch('sys.stdout', new=StringIO()) as mock_stdout:
|
||||
filename = "/tmp/so-yaml_test-get.yaml"
|
||||
file = open(filename, "w")
|
||||
file.write("{key1: { child1: 123, child2: { deep1: \"hello\" } }, key2: false, key3: [e,f,g]}")
|
||||
file.close()
|
||||
|
||||
result = soyaml.get(["-r", filename, "key1.child2.deep1"])
|
||||
self.assertEqual(result, 0)
|
||||
self.assertEqual("hello\n", mock_stdout.getvalue())
|
||||
|
||||
def test_get_bool(self):
|
||||
with patch('sys.stdout', new=StringIO()) as mock_stdout:
|
||||
filename = "/tmp/so-yaml_test-get.yaml"
|
||||
file = open(filename, "w")
|
||||
file.write("{key1: { child1: 123, child2: { deep1: 45 } }, key2: false, key3: [e,f,g]}")
|
||||
file.close()
|
||||
|
||||
result = soyaml.get([filename, "key2"])
|
||||
self.assertEqual(result, 0)
|
||||
self.assertIn("false\n...", mock_stdout.getvalue())
|
||||
|
||||
def test_get_bool_raw(self):
|
||||
with patch('sys.stdout', new=StringIO()) as mock_stdout:
|
||||
filename = "/tmp/so-yaml_test-get.yaml"
|
||||
file = open(filename, "w")
|
||||
file.write("{key1: { child1: 123, child2: { deep1: 45 } }, key2: false, key3: [e,f,g]}")
|
||||
file.close()
|
||||
|
||||
result = soyaml.get(["-r", filename, "key2"])
|
||||
self.assertEqual(result, 0)
|
||||
self.assertEqual("false\n", mock_stdout.getvalue())
|
||||
|
||||
def test_get_dict_raw(self):
|
||||
with patch('sys.stdout', new=StringIO()) as mock_stdout:
|
||||
filename = "/tmp/so-yaml_test-get.yaml"
|
||||
file = open(filename, "w")
|
||||
file.write("{key1: { child1: 123, child2: { deep1: 45 } }, key2: false, key3: [e,f,g]}")
|
||||
file.close()
|
||||
|
||||
result = soyaml.get(["-r", filename, "key1"])
|
||||
self.assertEqual(result, 0)
|
||||
self.assertIn("child1: 123", mock_stdout.getvalue())
|
||||
self.assertNotIn("...", mock_stdout.getvalue())
|
||||
|
||||
def test_get_list(self):
|
||||
with patch('sys.stdout', new=StringIO()) as mock_stdout:
|
||||
filename = "/tmp/so-yaml_test-get.yaml"
|
||||
|
||||
@@ -88,7 +88,7 @@ check_err() {
|
||||
echo 'No route to host'
|
||||
;;
|
||||
160)
|
||||
echo 'Incompatiable Elasticsearch upgrade'
|
||||
echo 'Incompatible Elasticsearch upgrade'
|
||||
;;
|
||||
161)
|
||||
echo 'Required intermediate Elasticsearch upgrade not complete'
|
||||
@@ -362,7 +362,7 @@ preupgrade_changes() {
|
||||
# This function is to add any new pillar items if needed.
|
||||
echo "Checking to see if changes are needed."
|
||||
|
||||
[[ "$INSTALLEDVERSION" == 2.4.210 ]] && up_to_3.0.0
|
||||
[[ "$INSTALLEDVERSION" =~ ^2\.4\.21[0-9]+$ ]] && up_to_3.0.0
|
||||
true
|
||||
}
|
||||
|
||||
@@ -370,12 +370,12 @@ postupgrade_changes() {
|
||||
# This function is to add any new pillar items if needed.
|
||||
echo "Running post upgrade processes."
|
||||
|
||||
[[ "$POSTVERSION" == 2.4.210 ]] && post_to_3.0.0
|
||||
[[ "$POSTVERSION" =~ ^2\.4\.21[0-9]+$ ]] && post_to_3.0.0
|
||||
true
|
||||
}
|
||||
|
||||
check_minimum_version() {
|
||||
if [[ "$INSTALLEDVERSION" != "2.4.210" ]] && [[ ! "$INSTALLEDVERSION" =~ ^3\. ]]; then
|
||||
if [[ ! "$INSTALLEDVERSION" =~ ^(2\.4\.21[0-9]+|3\.) ]]; then
|
||||
echo "You must be on at least Security Onion 2.4.210 to upgrade. Currently installed version: $INSTALLEDVERSION"
|
||||
exit 1
|
||||
fi
|
||||
@@ -385,10 +385,23 @@ check_minimum_version() {
|
||||
|
||||
up_to_3.0.0() {
|
||||
determine_elastic_agent_upgrade
|
||||
migrate_pcap_to_suricata
|
||||
|
||||
INSTALLEDVERSION=3.0.0
|
||||
}
|
||||
|
||||
migrate_pcap_to_suricata() {
|
||||
local MINIONDIR=/opt/so/saltstack/local/pillar/minions
|
||||
local PCAPFILE=/opt/so/saltstack/local/pillar/pcap/soc_pcap.sls
|
||||
|
||||
for pillar_file in "$PCAPFILE" "$MINIONDIR"/*.sls; do
|
||||
[[ -f "$pillar_file" ]] || continue
|
||||
pcap_enabled=$(so-yaml.py get -r "$pillar_file" pcap.enabled 2>/dev/null) || continue
|
||||
so-yaml.py add "$pillar_file" suricata.pcap.enabled "$pcap_enabled"
|
||||
so-yaml.py remove "$pillar_file" pcap
|
||||
done
|
||||
}
|
||||
|
||||
post_to_3.0.0() {
|
||||
echo "Nothing to apply"
|
||||
POSTVERSION=3.0.0
|
||||
|
||||
@@ -387,15 +387,13 @@ http {
|
||||
error_page 429 = @error429;
|
||||
|
||||
location @error401 {
|
||||
if ($request_uri ~* (^/connect/.*|^/oauth2/.*)) {
|
||||
if ($request_uri ~* (^/api/.*|^/connect/.*|^/oauth2/.*)) {
|
||||
return 401;
|
||||
}
|
||||
|
||||
if ($request_uri ~* ^/(?!(^/api/.*))) {
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
|
||||
}
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
|
||||
|
||||
if ($request_uri ~* ^/(?!(api/|login|auth|oauth2|$))) {
|
||||
if ($request_uri ~* ^/(?!(login|auth|oauth2|$))) {
|
||||
add_header Set-Cookie "AUTH_REDIRECT=$request_uri;Path=/;Max-Age=14400";
|
||||
}
|
||||
return 302 /auth/self-service/login/browser;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,7 @@
|
||||
suricata:
|
||||
enabled: False
|
||||
pcap:
|
||||
enabled: "no"
|
||||
filesize: 1000mb
|
||||
maxsize: 25
|
||||
compression: "none"
|
||||
@@ -141,8 +142,6 @@ suricata:
|
||||
enabled: "no"
|
||||
tls-store:
|
||||
enabled: "no"
|
||||
pcap-log:
|
||||
enabled: "no"
|
||||
alert-debug:
|
||||
enabled: "no"
|
||||
alert-prelude:
|
||||
|
||||
@@ -11,13 +11,18 @@
|
||||
{# before we change outputs back to list, enable pcap-log if suricata is the pcapengine #}
|
||||
{% if GLOBALS.pcap_engine in ["SURICATA"] %}
|
||||
|
||||
{# initialize pcap-log in config.outputs since we dont put it in defaults #}
|
||||
{% if 'pcap-log' not in SURICATAMERGED.config.outputs %}
|
||||
{% do SURICATAMERGED.config.outputs.update({'pcap-log': {}}) %}
|
||||
{% endif %}
|
||||
|
||||
{% from 'bpf/pcap.map.jinja' import PCAPBPF, PCAP_BPF_STATUS %}
|
||||
{% if PCAPBPF and PCAP_BPF_STATUS %}
|
||||
{% do SURICATAMERGED.config.outputs['pcap-log'].update({'bpf-filter': PCAPBPF|join(" ")}) %}
|
||||
{% endif %}
|
||||
|
||||
{% do SURICATAMERGED.config.outputs['pcap-log'].update({'enabled': 'yes'}) %}
|
||||
{# move the items in suricata.pcap into suricata.config.outputs.pcap-log. these items were placed under suricata.config for ease of access in SOC #}
|
||||
{% do SURICATAMERGED.config.outputs['pcap-log'].update({'enabled': SURICATAMERGED.pcap.enabled}) %}
|
||||
{% do SURICATAMERGED.config.outputs['pcap-log'].update({'compression': SURICATAMERGED.pcap.compression}) %}
|
||||
{% do SURICATAMERGED.config.outputs['pcap-log'].update({'lz4-checksum': SURICATAMERGED.pcap['lz4-checksum']}) %}
|
||||
{% do SURICATAMERGED.config.outputs['pcap-log'].update({'lz4-level': SURICATAMERGED.pcap['lz4-level']}) %}
|
||||
|
||||
@@ -22,6 +22,10 @@ suricata:
|
||||
title: Classifications
|
||||
helpLink: suricata.html
|
||||
pcap:
|
||||
enabled:
|
||||
description: Enables or disables the Suricata packet recording process.
|
||||
forcedType: bool
|
||||
helpLink: suricata.html
|
||||
filesize:
|
||||
description: Maximum file size for individual PCAP files written by Suricata. Increasing this number could improve write performance at the expense of pcap retrieval time.
|
||||
advanced: True
|
||||
@@ -209,12 +213,6 @@ suricata:
|
||||
header:
|
||||
description: Header name where the actual IP address will be reported.
|
||||
helpLink: suricata.html
|
||||
pcap-log:
|
||||
enabled:
|
||||
description: This value is ignored by SO. pcapengine in globals takes precedence.
|
||||
readonly: True
|
||||
helpLink: suricata.html
|
||||
advanced: True
|
||||
asn1-max-frames:
|
||||
description: Maximum nuber of asn1 frames to decode.
|
||||
helpLink: suricata.html
|
||||
|
||||
@@ -32,6 +32,15 @@ zeekpolicydir:
|
||||
- group: 939
|
||||
- makedirs: True
|
||||
|
||||
zeekzkgsync:
|
||||
file.recurse:
|
||||
- name: /opt/so/conf/zeek/zkg
|
||||
- source: salt://zeek/zkg
|
||||
- user: 937
|
||||
- group: 939
|
||||
- makedirs: True
|
||||
- exclude_pat: README
|
||||
|
||||
# Zeek Log Directory
|
||||
zeeklogdir:
|
||||
file.directory:
|
||||
|
||||
@@ -35,6 +35,7 @@ so-zeek:
|
||||
- /opt/so/conf/zeek/policy/intel:/opt/zeek/share/zeek/policy/intel:rw
|
||||
- /opt/so/conf/zeek/bpf:/opt/zeek/etc/bpf:ro
|
||||
- /opt/so/conf/zeek/config.zeek:/opt/zeek/share/zeek/site/packages/ja4/config.zeek:ro
|
||||
- /opt/so/conf/zeek/zkg:/opt/so/conf/zeek/zkg:ro
|
||||
{% if DOCKER.containers['so-zeek'].custom_bind_mounts %}
|
||||
{% for BIND in DOCKER.containers['so-zeek'].custom_bind_mounts %}
|
||||
- {{ BIND }}
|
||||
|
||||
1
salt/zeek/zkg/README
Normal file
1
salt/zeek/zkg/README
Normal file
@@ -0,0 +1 @@
|
||||
# Place custom Zeek packages in /opt/so/saltstack/local/salt/zeek/zkg/
|
||||
Reference in New Issue
Block a user