mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-08 18:22:47 +01:00
Merge pull request #15185 from Security-Onion-Solutions/salt300616
Upgrade Salt 3006.16
This commit is contained in:
@@ -220,12 +220,22 @@ compare_es_versions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
copy_new_files() {
|
copy_new_files() {
|
||||||
|
# Define files to exclude from deletion (relative to their respective base directories)
|
||||||
|
local EXCLUDE_FILES=(
|
||||||
|
"salt/hypervisor/soc_hypervisor.yaml"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Build rsync exclude arguments
|
||||||
|
local EXCLUDE_ARGS=()
|
||||||
|
for file in "${EXCLUDE_FILES[@]}"; do
|
||||||
|
EXCLUDE_ARGS+=(--exclude="$file")
|
||||||
|
done
|
||||||
|
|
||||||
# Copy new files over to the salt dir
|
# Copy new files over to the salt dir
|
||||||
cd $UPDATE_DIR
|
cd $UPDATE_DIR
|
||||||
rsync -a salt $DEFAULT_SALT_DIR/ --delete
|
rsync -a salt $DEFAULT_SALT_DIR/ --delete "${EXCLUDE_ARGS[@]}"
|
||||||
rsync -a pillar $DEFAULT_SALT_DIR/ --delete
|
rsync -a pillar $DEFAULT_SALT_DIR/ --delete "${EXCLUDE_ARGS[@]}"
|
||||||
chown -R socore:socore $DEFAULT_SALT_DIR/
|
chown -R socore:socore $DEFAULT_SALT_DIR/
|
||||||
chmod 755 $DEFAULT_SALT_DIR/pillar/firewall/addfirewall.sh
|
|
||||||
cd /tmp
|
cd /tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ whiptail_title='Security Onion UPdater'
|
|||||||
NOTIFYCUSTOMELASTICCONFIG=false
|
NOTIFYCUSTOMELASTICCONFIG=false
|
||||||
TOPFILE=/opt/so/saltstack/default/salt/top.sls
|
TOPFILE=/opt/so/saltstack/default/salt/top.sls
|
||||||
BACKUPTOPFILE=/opt/so/saltstack/default/salt/top.sls.backup
|
BACKUPTOPFILE=/opt/so/saltstack/default/salt/top.sls.backup
|
||||||
|
SALTUPGRADED=false
|
||||||
|
SALT_CLOUD_INSTALLED=false
|
||||||
# used to display messages to the user at the end of soup
|
# used to display messages to the user at the end of soup
|
||||||
declare -a FINAL_MESSAGE_QUEUE=()
|
declare -a FINAL_MESSAGE_QUEUE=()
|
||||||
|
|
||||||
@@ -1260,24 +1262,39 @@ upgrade_check_salt() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
upgrade_salt() {
|
upgrade_salt() {
|
||||||
SALTUPGRADED=True
|
|
||||||
echo "Performing upgrade of Salt from $INSTALLEDSALTVERSION to $NEWSALTVERSION."
|
echo "Performing upgrade of Salt from $INSTALLEDSALTVERSION to $NEWSALTVERSION."
|
||||||
echo ""
|
echo ""
|
||||||
# If rhel family
|
# If rhel family
|
||||||
if [[ $is_rpm ]]; then
|
if [[ $is_rpm ]]; then
|
||||||
|
# Check if salt-cloud is installed
|
||||||
|
if rpm -q salt-cloud &>/dev/null; then
|
||||||
|
SALT_CLOUD_INSTALLED=true
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Removing yum versionlock for Salt."
|
echo "Removing yum versionlock for Salt."
|
||||||
echo ""
|
echo ""
|
||||||
yum versionlock delete "salt"
|
yum versionlock delete "salt"
|
||||||
yum versionlock delete "salt-minion"
|
yum versionlock delete "salt-minion"
|
||||||
yum versionlock delete "salt-master"
|
yum versionlock delete "salt-master"
|
||||||
|
# Remove salt-cloud versionlock if installed
|
||||||
|
if [[ $SALT_CLOUD_INSTALLED == true ]]; then
|
||||||
|
yum versionlock delete "salt-cloud"
|
||||||
|
fi
|
||||||
echo "Updating Salt packages."
|
echo "Updating Salt packages."
|
||||||
echo ""
|
echo ""
|
||||||
set +e
|
set +e
|
||||||
# if oracle run with -r to ignore repos set by bootstrap
|
# if oracle run with -r to ignore repos set by bootstrap
|
||||||
if [[ $OS == 'oracle' ]]; then
|
if [[ $OS == 'oracle' ]]; then
|
||||||
|
# Add -L flag only if salt-cloud is already installed
|
||||||
|
if [[ $SALT_CLOUD_INSTALLED == true ]]; then
|
||||||
|
run_check_net_err \
|
||||||
|
"sh $UPDATE_DIR/salt/salt/scripts/bootstrap-salt.sh -X -r -L -F -M stable \"$NEWSALTVERSION\"" \
|
||||||
|
"Could not update salt, please check $SOUP_LOG for details."
|
||||||
|
else
|
||||||
run_check_net_err \
|
run_check_net_err \
|
||||||
"sh $UPDATE_DIR/salt/salt/scripts/bootstrap-salt.sh -X -r -F -M stable \"$NEWSALTVERSION\"" \
|
"sh $UPDATE_DIR/salt/salt/scripts/bootstrap-salt.sh -X -r -F -M stable \"$NEWSALTVERSION\"" \
|
||||||
"Could not update salt, please check $SOUP_LOG for details."
|
"Could not update salt, please check $SOUP_LOG for details."
|
||||||
|
fi
|
||||||
# if another rhel family variant we want to run without -r to allow the bootstrap script to manage repos
|
# if another rhel family variant we want to run without -r to allow the bootstrap script to manage repos
|
||||||
else
|
else
|
||||||
run_check_net_err \
|
run_check_net_err \
|
||||||
@@ -1290,6 +1307,10 @@ upgrade_salt() {
|
|||||||
yum versionlock add "salt-0:$NEWSALTVERSION-0.*"
|
yum versionlock add "salt-0:$NEWSALTVERSION-0.*"
|
||||||
yum versionlock add "salt-minion-0:$NEWSALTVERSION-0.*"
|
yum versionlock add "salt-minion-0:$NEWSALTVERSION-0.*"
|
||||||
yum versionlock add "salt-master-0:$NEWSALTVERSION-0.*"
|
yum versionlock add "salt-master-0:$NEWSALTVERSION-0.*"
|
||||||
|
# Add salt-cloud versionlock if installed
|
||||||
|
if [[ $SALT_CLOUD_INSTALLED == true ]]; then
|
||||||
|
yum versionlock add "salt-cloud-0:$NEWSALTVERSION-0.*"
|
||||||
|
fi
|
||||||
# Else do Ubuntu things
|
# Else do Ubuntu things
|
||||||
elif [[ $is_deb ]]; then
|
elif [[ $is_deb ]]; then
|
||||||
echo "Removing apt hold for Salt."
|
echo "Removing apt hold for Salt."
|
||||||
@@ -1322,6 +1343,7 @@ upgrade_salt() {
|
|||||||
echo ""
|
echo ""
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
|
SALTUPGRADED=true
|
||||||
echo "Salt upgrade success."
|
echo "Salt upgrade success."
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
@@ -1565,6 +1587,11 @@ main() {
|
|||||||
# ensure the mine is updated and populated before highstates run, following the salt-master restart
|
# ensure the mine is updated and populated before highstates run, following the salt-master restart
|
||||||
update_salt_mine
|
update_salt_mine
|
||||||
|
|
||||||
|
if [[ $SALT_CLOUD_INSTALLED == true && $SALTUPGRADED == true ]]; then
|
||||||
|
echo "Updating salt-cloud config to use the new Salt version"
|
||||||
|
salt-call state.apply salt.cloud.config concurrent=True
|
||||||
|
fi
|
||||||
|
|
||||||
enable_highstate
|
enable_highstate
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ sool9_{{host}}:
|
|||||||
private_key: /etc/ssh/auth_keys/soqemussh/id_ecdsa
|
private_key: /etc/ssh/auth_keys/soqemussh/id_ecdsa
|
||||||
sudo: True
|
sudo: True
|
||||||
deploy_command: sh /tmp/.saltcloud-*/deploy.sh
|
deploy_command: sh /tmp/.saltcloud-*/deploy.sh
|
||||||
script_args: -r -F -x python3 stable 3006.9
|
script_args: -r -F -x python3 stable {{ SALTVERSION }}
|
||||||
minion:
|
minion:
|
||||||
master: {{ grains.host }}
|
master: {{ grains.host }}
|
||||||
master_port: 4506
|
master_port: 4506
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
{% if '.'.join(sls.split('.')[:2]) in allowed_states %}
|
{% if '.'.join(sls.split('.')[:2]) in allowed_states %}
|
||||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||||
{% set HYPERVISORS = salt['pillar.get']('hypervisor:nodes', {} ) %}
|
{% set HYPERVISORS = salt['pillar.get']('hypervisor:nodes', {} ) %}
|
||||||
|
{% from 'salt/map.jinja' import SALTVERSION %}
|
||||||
|
|
||||||
{% if HYPERVISORS %}
|
{% if HYPERVISORS %}
|
||||||
cloud_providers:
|
cloud_providers:
|
||||||
@@ -32,6 +33,7 @@ cloud_profiles:
|
|||||||
HYPERVISORS: {{ HYPERVISORS }}
|
HYPERVISORS: {{ HYPERVISORS }}
|
||||||
MANAGERHOSTNAME: {{ grains.host }}
|
MANAGERHOSTNAME: {{ grains.host }}
|
||||||
MANAGERIP: {{ pillar.host.mainip }}
|
MANAGERIP: {{ pillar.host.mainip }}
|
||||||
|
SALTVERSION: {{ SALTVERSION }}
|
||||||
- template: jinja
|
- template: jinja
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# version cannot be used elsewhere in this pillar as soup is grepping for it to determine if Salt needs to be patched
|
# version cannot be used elsewhere in this pillar as soup is grepping for it to determine if Salt needs to be patched
|
||||||
salt:
|
salt:
|
||||||
master:
|
master:
|
||||||
version: '3006.9'
|
version: '3006.16'
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# version cannot be used elsewhere in this pillar as soup is grepping for it to determine if Salt needs to be patched
|
# version cannot be used elsewhere in this pillar as soup is grepping for it to determine if Salt needs to be patched
|
||||||
salt:
|
salt:
|
||||||
minion:
|
minion:
|
||||||
version: '3006.9'
|
version: '3006.16'
|
||||||
check_threshold: 3600 # in seconds, threshold used for so-salt-minion-check. any value less than 600 seconds may cause a lot of salt-minion restarts since the job to touch the file occurs every 5-8 minutes by default
|
check_threshold: 3600 # in seconds, threshold used for so-salt-minion-check. any value less than 600 seconds may cause a lot of salt-minion restarts since the job to touch the file occurs every 5-8 minutes by default
|
||||||
|
|||||||
Reference in New Issue
Block a user