mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
Merge pull request #12348 from Security-Onion-Solutions/TOoSmOotH-patch-4
Update soup
This commit is contained in:
@@ -247,67 +247,6 @@ check_sudoers() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_log_size_limit() {
|
|
||||||
local num_minion_pillars
|
|
||||||
num_minion_pillars=$(find /opt/so/saltstack/local/pillar/minions/ -type f | wc -l)
|
|
||||||
|
|
||||||
if [[ $num_minion_pillars -gt 1 ]]; then
|
|
||||||
if find /opt/so/saltstack/local/pillar/minions/ -type f | grep -q "_heavynode"; then
|
|
||||||
lsl_msg='distributed'
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
local minion_id
|
|
||||||
minion_id=$(lookup_salt_value "id" "" "grains" "" "local")
|
|
||||||
|
|
||||||
local minion_arr
|
|
||||||
IFS='_' read -ra minion_arr <<< "$minion_id"
|
|
||||||
|
|
||||||
local node_type="${minion_arr[0]}"
|
|
||||||
|
|
||||||
local current_limit
|
|
||||||
# since it is possible for the salt-master service to be stopped when this is run, we need to check the pillar values locally
|
|
||||||
# we need to combine default local and default pillars before doing this so we can define --pillar-root in salt-call
|
|
||||||
local epoch_date=$(date +%s%N)
|
|
||||||
mkdir -vp /opt/so/saltstack/soup_tmp_${epoch_date}/
|
|
||||||
cp -r /opt/so/saltstack/default/pillar/ /opt/so/saltstack/soup_tmp_${epoch_date}/
|
|
||||||
# use \cp here to overwrite any pillar files from default with those in local for the tmp directory
|
|
||||||
\cp -r /opt/so/saltstack/local/pillar/ /opt/so/saltstack/soup_tmp_${epoch_date}/
|
|
||||||
current_limit=$(salt-call pillar.get elasticsearch:log_size_limit --local --pillar-root=/opt/so/saltstack/soup_tmp_${epoch_date}/pillar --out=newline_values_only)
|
|
||||||
rm -rf /opt/so/saltstack/soup_tmp_${epoch_date}/
|
|
||||||
|
|
||||||
local percent
|
|
||||||
case $node_type in
|
|
||||||
'standalone' | 'eval')
|
|
||||||
percent=50
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
percent=80
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
local disk_dir="/"
|
|
||||||
if [ -d /nsm ]; then
|
|
||||||
disk_dir="/nsm"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local disk_size_1k
|
|
||||||
disk_size_1k=$(df $disk_dir | grep -v "^Filesystem" | awk '{print $2}')
|
|
||||||
|
|
||||||
local ratio="1048576"
|
|
||||||
|
|
||||||
local disk_size_gb
|
|
||||||
disk_size_gb=$( echo "$disk_size_1k" "$ratio" | awk '{print($1/$2)}' )
|
|
||||||
|
|
||||||
local new_limit
|
|
||||||
new_limit=$( echo "$disk_size_gb" "$percent" | awk '{printf("%.0f", $1 * ($2/100))}')
|
|
||||||
|
|
||||||
if [[ $current_limit != "$new_limit" ]]; then
|
|
||||||
lsl_msg='single-node'
|
|
||||||
lsl_details=( "$current_limit" "$new_limit" "$minion_id" )
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
check_os_updates() {
|
check_os_updates() {
|
||||||
# Check to see if there are OS updates
|
# Check to see if there are OS updates
|
||||||
echo "Checking for OS updates."
|
echo "Checking for OS updates."
|
||||||
|
|||||||
Reference in New Issue
Block a user