From 4780371ebe796113aa87880f9708d2372579a8b0 Mon Sep 17 00:00:00 2001 From: reyesj2 <94730068+reyesj2@users.noreply.github.com> Date: Thu, 18 Dec 2025 19:21:52 -0600 Subject: [PATCH] WIP soup changes --- salt/manager/tools/sbin/soup | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/salt/manager/tools/sbin/soup b/salt/manager/tools/sbin/soup index 7d2f71400..1b8f1d629 100755 --- a/salt/manager/tools/sbin/soup +++ b/salt/manager/tools/sbin/soup @@ -1619,6 +1619,60 @@ verify_latest_update_script() { fi } + +verify_es_version_compatibility() { + + # Define supported upgrade paths for SO ES versions + declare -A es_upgrade_map=( + ["8.14.3"]="8.17.3 8.18.4 8.18.6 8.18.8" + ["8.17.3"]="8.18.4 8.18.6 8.18.8" + ["8.18.4"]="8.18.6 8.18.8 9.0.8" + ["8.18.6"]="8.18.8 9.0.8" + ["8.18.8"]="9.0.8" + ) + + # ES version stepping stones. Elasticsearch MUST upgrade through these versions + declare -A es_to_so_version=( + ["8.18.8"]="2.4.190-20251024" + ["9.0.8"]="2.4.210" + ) + + # Get current Elasticsearch version + if es_version_raw=$(so-elasticsearch-query / --fail --retry 5 --retry-delay 10); then + es_version=$(echo "$es_version_raw" | jq -r '.version.number' ) + else + echo "Could not determine current Elasticsearch version to validate compatibility with post soup Elasticsearch version." + exit 1 + fi + + # Get the target ES version from the updatedir + # DOUBLE TAP ON THIS SOMEONE FROM AN OLD VERSION UPGRADING TO ANOTHER VERSION OLDER THAN 2.4.110 WOULD HAVE AN ERROR HERE. Prior to this version there was no version defined in defaults.yaml + target_es_version=$(so-yaml.py get $UPDATE_DIR/salt/elasticsearch/defaults.yaml elasticsearch.version | sed -n '1p') + + if [[ " ${es_upgrade_map[$es_version]} " =~ " $target_es_version " ]]; then + # supported upgrade + return 0 + else + compatible_versions=${es_upgrade_map[$es_version]} + next_step_so_version=${es_to_so_version[${compatible_versions##* }]} + echo "" + echo "You are currently running Security Onion $INSTALLEDVERSION. You will need to update to version $next_step_so_version before updating to $(cat $UPDATE_DIR/VERSION)." + echo "" + + if [[ $is_airgap -eq 0 ]]; then + echo "You can download the $next_step_so_version ISO image from https://download.securityonion.net/file/securityonion/securityonion-$next_step_so_version.iso" + else + echo "You can use the following soup command to upgrade to $next_step_so_version;" + echo " sudo BRANCH=$next_step_so_version soup" + echo "" + fi + echo "*** Once you have updated to $next_step_so_version, you can then run soup again to update to $(cat $UPDATE_DIR/VERSION). ***" + echo "" + exit 1 + fi + +} + # Keeping this block in case we need to do a hotfix that requires salt update apply_hotfix() { if [[ "$INSTALLEDVERSION" == "2.4.20" ]] ; then @@ -1715,6 +1769,8 @@ main() { echo "Verifying we have the latest soup script." verify_latest_update_script + verify_es_version_compatibility + echo "Let's see if we need to update Security Onion." upgrade_check upgrade_space