mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-06-15 14:48:43 +02:00
Improve soup version checks and migrate pcap pillar to suricata
Consolidate version checks to use regex patterns for 2.4.21X and 3.x versions. Add migrate_pcap_to_suricata to move pcap.enabled to suricata.pcap.enabled in minion and pcap pillar files during upgrade.
This commit is contained in:
@@ -362,7 +362,7 @@ preupgrade_changes() {
|
|||||||
# This function is to add any new pillar items if needed.
|
# This function is to add any new pillar items if needed.
|
||||||
echo "Checking to see if changes are 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
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,12 +370,12 @@ postupgrade_changes() {
|
|||||||
# This function is to add any new pillar items if needed.
|
# This function is to add any new pillar items if needed.
|
||||||
echo "Running post upgrade processes."
|
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
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
check_minimum_version() {
|
check_minimum_version() {
|
||||||
if [[ "$INSTALLEDVERSION" != "2.4.210" ]] && [[ "$INSTALLEDVERSION" != "2.4.211" ]] && [[ ! "$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"
|
echo "You must be on at least Security Onion 2.4.210 to upgrade. Currently installed version: $INSTALLEDVERSION"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -385,10 +385,23 @@ check_minimum_version() {
|
|||||||
|
|
||||||
up_to_3.0.0() {
|
up_to_3.0.0() {
|
||||||
determine_elastic_agent_upgrade
|
determine_elastic_agent_upgrade
|
||||||
|
migrate_pcap_to_suricata
|
||||||
|
|
||||||
INSTALLEDVERSION=3.0.0
|
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 "$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() {
|
post_to_3.0.0() {
|
||||||
echo "Nothing to apply"
|
echo "Nothing to apply"
|
||||||
POSTVERSION=3.0.0
|
POSTVERSION=3.0.0
|
||||||
|
|||||||
Reference in New Issue
Block a user