mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
Merge pull request #6949 from Security-Onion-Solutions/issue/6811
Issue/6811
This commit is contained in:
@@ -405,6 +405,21 @@ set_version() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
systemctl_func() {
|
||||||
|
local action=$1
|
||||||
|
local echo_action=$1
|
||||||
|
local service_name=$2
|
||||||
|
|
||||||
|
if [[ "$echo_action" == "stop" ]]; then
|
||||||
|
echo_action="stopp"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "${echo_action^}ing $service_name service at $(date +"%T.%6N")"
|
||||||
|
systemctl $action $service_name && echo "Successfully ${echo_action}ed $service_name." || echo "Failed to $action $service_name."
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
has_uppercase() {
|
has_uppercase() {
|
||||||
local string=$1
|
local string=$1
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,10 @@ check_err() {
|
|||||||
if [[ $exit_code -ge 64 && $exit_code -le 113 ]]; then
|
if [[ $exit_code -ge 64 && $exit_code -le 113 ]]; then
|
||||||
echo "$err_msg"
|
echo "$err_msg"
|
||||||
fi
|
fi
|
||||||
|
set +e
|
||||||
|
systemctl_func "start" "$cron_service_name"
|
||||||
|
echo "Ensuring highstate is enabled."
|
||||||
|
salt-call state.enable highstate --local
|
||||||
exit $exit_code
|
exit $exit_code
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -483,10 +487,7 @@ stop_salt_master() {
|
|||||||
echo "Storing salt-master pid."
|
echo "Storing salt-master pid."
|
||||||
MASTERPID=$(pgrep salt-master | head -1)
|
MASTERPID=$(pgrep salt-master | head -1)
|
||||||
echo "Found salt-master PID $MASTERPID"
|
echo "Found salt-master PID $MASTERPID"
|
||||||
echo ""
|
systemctl_func "stop" "salt-master"
|
||||||
echo "Stopping Salt Master service at $(date +"%T.%6N")"
|
|
||||||
systemctl stop salt-master
|
|
||||||
echo ""
|
|
||||||
timeout 30 tail --pid=$MASTERPID -f /dev/null || echo "salt-master still running at $(date +"%T.%6N") after waiting 30s. We cannot kill due to systemd restart option."
|
timeout 30 tail --pid=$MASTERPID -f /dev/null || echo "salt-master still running at $(date +"%T.%6N") after waiting 30s. We cannot kill due to systemd restart option."
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,8 +506,7 @@ stop_salt_minion() {
|
|||||||
echo "Storing salt-minion pid."
|
echo "Storing salt-minion pid."
|
||||||
MINIONPID=$(pgrep salt-minion | head -1)
|
MINIONPID=$(pgrep salt-minion | head -1)
|
||||||
echo "Found salt-minion PID $MINIONPID"
|
echo "Found salt-minion PID $MINIONPID"
|
||||||
echo "Stopping Salt Minion service at $(date +"%T.%6N")."
|
systemctl_func "stop" "salt-minion"
|
||||||
systemctl stop salt-minion
|
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
timeout 30 tail --pid=$MINIONPID -f /dev/null || echo "Killing salt-minion at $(date +"%T.%6N") after waiting 30s" && pkill -9 -ef /usr/bin/salt-minion
|
timeout 30 tail --pid=$MINIONPID -f /dev/null || echo "Killing salt-minion at $(date +"%T.%6N") after waiting 30s" && pkill -9 -ef /usr/bin/salt-minion
|
||||||
@@ -1033,9 +1033,7 @@ main() {
|
|||||||
echo "Performing upgrade from Security Onion $INSTALLEDVERSION to Security Onion $NEWVERSION."
|
echo "Performing upgrade from Security Onion $INSTALLEDVERSION to Security Onion $NEWVERSION."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo "Stopping $cron_service_name service at $(date +"%T.%6N")."
|
systemctl_func "stop" "$cron_service_name"
|
||||||
echo ""
|
|
||||||
systemctl stop "$cron_service_name"
|
|
||||||
|
|
||||||
# update mine items prior to stopping salt-minion and salt-master
|
# update mine items prior to stopping salt-minion and salt-master
|
||||||
update_salt_mine
|
update_salt_mine
|
||||||
@@ -1104,9 +1102,7 @@ main() {
|
|||||||
echo "Locking down Salt Master for upgrade at $(date +"%T.%6N")."
|
echo "Locking down Salt Master for upgrade at $(date +"%T.%6N")."
|
||||||
masterlock
|
masterlock
|
||||||
|
|
||||||
echo ""
|
systemctl_func "start" "salt-master"
|
||||||
echo "Starting Salt Master service at $(date +"%T.%6N")."
|
|
||||||
systemctl start salt-master
|
|
||||||
|
|
||||||
# Testing that salt-master is up by checking that is it connected to itself
|
# Testing that salt-master is up by checking that is it connected to itself
|
||||||
set +e
|
set +e
|
||||||
@@ -1150,9 +1146,7 @@ main() {
|
|||||||
|
|
||||||
masterunlock
|
masterunlock
|
||||||
|
|
||||||
echo ""
|
systemctl_func "start" "salt-master"
|
||||||
echo "Starting Salt Master service at $(date +"%T.%6N") ."
|
|
||||||
systemctl start salt-master
|
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
echo "Waiting on the Salt Master service to be ready."
|
echo "Waiting on the Salt Master service to be ready."
|
||||||
@@ -1191,6 +1185,8 @@ main() {
|
|||||||
echo "Checking for necessary user migrations."
|
echo "Checking for necessary user migrations."
|
||||||
so-user migrate
|
so-user migrate
|
||||||
|
|
||||||
|
systemctl_func "start" "$cron_service_name"
|
||||||
|
|
||||||
if [[ -n $lsl_msg ]]; then
|
if [[ -n $lsl_msg ]]; then
|
||||||
case $lsl_msg in
|
case $lsl_msg in
|
||||||
'distributed')
|
'distributed')
|
||||||
@@ -1207,9 +1203,6 @@ main() {
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Starting $cron_service_name service at $(date +"%T.%6N")."
|
|
||||||
systemctl start "$cron_service_name"
|
|
||||||
|
|
||||||
if [[ $NUM_MINIONS -gt 1 ]]; then
|
if [[ $NUM_MINIONS -gt 1 ]]; then
|
||||||
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
enable_highstate:
|
|
||||||
module.run:
|
|
||||||
- state.enable:
|
|
||||||
- states:
|
|
||||||
- highstate
|
|
||||||
- unless: pgrep soup
|
|
||||||
|
|
||||||
@@ -20,7 +20,6 @@
|
|||||||
base:
|
base:
|
||||||
|
|
||||||
'*':
|
'*':
|
||||||
- salt.enable_highstate
|
|
||||||
- cron.running
|
- cron.running
|
||||||
|
|
||||||
'not G@saltversion:{{saltversion}}':
|
'not G@saltversion:{{saltversion}}':
|
||||||
|
|||||||
Reference in New Issue
Block a user