mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-08 02:02:50 +01:00
remove patch pkg and patching of influx
This commit is contained in:
@@ -1026,8 +1026,6 @@ upgrade_salt() {
|
||||
else
|
||||
echo "Salt upgrade success."
|
||||
echo ""
|
||||
echo "Removing /opt/so/state files for patched Salt InfluxDB module and state. This is due to Salt being upgraded and needing to patch the files again."
|
||||
rm -vrf /opt/so/state/influxdb_continuous_query.py.patched /opt/so/state/influxdb_retention_policy.py.patched /opt/so/state/influxdbmod.py.patched
|
||||
fi
|
||||
|
||||
}
|
||||
@@ -1138,9 +1136,7 @@ fix_wazuh() {
|
||||
# Update the repo files so it can actually upgrade
|
||||
upgrade_salt
|
||||
fi
|
||||
rm -f /opt/so/state/influxdb_continuous_query.py.patched /opt/so/state/influxdbmod.py.patched /opt/so/state/influxdb_retention_policy.py.patched
|
||||
systemctl_func "start" "salt-master"
|
||||
salt-call state.apply salt.python3-influxdb -l info
|
||||
systemctl_func "start" "salt-minion"
|
||||
systemctl_func "start" "$cron_service_name"
|
||||
|
||||
@@ -1309,11 +1305,6 @@ main() {
|
||||
salt-call state.show_top -l error queue=True || fail "salt-master could not be reached. Check $SOUP_LOG for details."
|
||||
set -e
|
||||
|
||||
echo ""
|
||||
echo "Ensuring python modules for Salt are installed and patched."
|
||||
salt-call state.apply salt.python3-influxdb -l info queue=True
|
||||
echo ""
|
||||
|
||||
# update the salt-minion configs here and start the minion
|
||||
# since highstate are disabled above, minion start should not trigger a highstate
|
||||
echo ""
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
include:
|
||||
- salt.minion
|
||||
- salt.python3-influxdb
|
||||
- ssl
|
||||
|
||||
# Influx DB
|
||||
@@ -111,7 +110,6 @@ telegraf_database:
|
||||
- influxdb_host: {{ GLOBALS.manager }}
|
||||
- require:
|
||||
- docker_container: so-influxdb
|
||||
- sls: salt.python3-influxdb
|
||||
- http: wait_for_influxdb
|
||||
|
||||
{% for rp in influxdb.retention_policies.keys() %}
|
||||
@@ -131,7 +129,6 @@ telegraf_database:
|
||||
- docker_container: so-influxdb
|
||||
- influxdb_database: telegraf_database
|
||||
- file: influxdb_retention_policy.present_patch
|
||||
- sls: salt.python3-influxdb
|
||||
{% endfor %}
|
||||
|
||||
{% for dest_rp in influxdb.downsample.keys() %}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
patch_package:
|
||||
pkg.installed:
|
||||
- name: patch
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
include:
|
||||
- salt
|
||||
- salt.helper-packages
|
||||
- systemd.reload
|
||||
- repo.client
|
||||
|
||||
@@ -34,21 +33,6 @@ install_salt_minion:
|
||||
exec 2>&- # close stderr
|
||||
nohup /bin/sh -c '{{ UPGRADECOMMAND }}' &
|
||||
|
||||
{# if we are the salt master #}
|
||||
{% if grains.id.split('_')|first == grains.master %}
|
||||
remove_influxdb_continuous_query_state_file:
|
||||
file.absent:
|
||||
- name: /opt/so/state/influxdb_continuous_query.py.patched
|
||||
|
||||
remove_influxdbmod_state_file:
|
||||
file.absent:
|
||||
- name: /opt/so/state/influxdbmod.py.patched
|
||||
|
||||
remove_influxdb_retention_policy_state_file:
|
||||
file.absent:
|
||||
- name: /opt/so/state/influxdb_retention_policy.py.patched
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if INSTALLEDSALTVERSION|string == SALTVERSION|string %}
|
||||
@@ -115,8 +99,3 @@ salt_minion_service:
|
||||
- file: salt_minion_service_unit_file
|
||||
{% endif %}
|
||||
- order: last
|
||||
|
||||
|
||||
patch_pkg:
|
||||
pkg.installed:
|
||||
- name: patch
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
{% from "salt/map.jinja" import SALT_STATE_CODE_PATH with context %}
|
||||
{% from "salt/map.jinja" import SALT_MODULE_CODE_PATH with context %}
|
||||
{% from "salt/map.jinja" import PYTHON3INFLUX with context %}
|
||||
{% from "salt/map.jinja" import PYTHON3INFLUXDEPS with context %}
|
||||
{% from "salt/map.jinja" import PYTHONINSTALLER with context %}
|
||||
|
||||
include:
|
||||
- salt.helper-packages
|
||||
|
||||
python3_influxdb_dependencies:
|
||||
{{PYTHONINSTALLER}}.installed:
|
||||
- pkgs: {{ PYTHON3INFLUXDEPS }}
|
||||
|
||||
python3_influxdb:
|
||||
{{PYTHONINSTALLER}}.installed:
|
||||
- name: {{ PYTHON3INFLUX }}
|
||||
|
||||
# We circumvent the file.patch state putting ERROR in the log by using the unless and file.touch below
|
||||
# https://github.com/saltstack/salt/pull/47010 and https://github.com/saltstack/salt/issues/52329
|
||||
|
||||
#https://github.com/saltstack/salt/issues/59766
|
||||
influxdb_continuous_query.present_patch:
|
||||
file.patch:
|
||||
- name: {{ SALT_STATE_CODE_PATH }}/influxdb_continuous_query.py
|
||||
- source: salt://salt/files/influxdb_continuous_query.py.patch
|
||||
- require:
|
||||
- {{PYTHONINSTALLER}}: python3_influxdb
|
||||
- pkg: patch_package
|
||||
- unless: ls /opt/so/state/influxdb_continuous_query.py.patched
|
||||
|
||||
influxdb_continuous_query.py.patched:
|
||||
file.touch:
|
||||
- name: /opt/so/state/influxdb_continuous_query.py.patched
|
||||
- onchanges:
|
||||
- file: influxdb_continuous_query.present_patch
|
||||
|
||||
#https://github.com/saltstack/salt/issues/59761
|
||||
influxdb_retention_policy.present_patch:
|
||||
file.patch:
|
||||
- name: {{ SALT_STATE_CODE_PATH }}/influxdb_retention_policy.py
|
||||
- source: salt://salt/files/influxdb_retention_policy.py.patch
|
||||
- require:
|
||||
- {{PYTHONINSTALLER}}: python3_influxdb
|
||||
- pkg: patch_package
|
||||
- unless: ls /opt/so/state/influxdb_retention_policy.py.patched
|
||||
|
||||
influxdb_retention_policy.py.patched:
|
||||
file.touch:
|
||||
- name: /opt/so/state/influxdb_retention_policy.py.patched
|
||||
- onchanges:
|
||||
- file: influxdb_retention_policy.present_patch
|
||||
|
||||
# We should be able to set reload_modules: True in this state in order to tell salt to reload its python modules due to us possibly installing
|
||||
# and possibly modifying modules in this state. This is bugged according to https://github.com/saltstack/salt/issues/24925
|
||||
influxdbmod.py_shard_duration_patch:
|
||||
file.patch:
|
||||
- name: {{ SALT_MODULE_CODE_PATH }}/influxdbmod.py
|
||||
- source: salt://salt/files/influxdbmod.py.patch
|
||||
- require:
|
||||
- {{PYTHONINSTALLER}}: python3_influxdb
|
||||
- pkg: patch_package
|
||||
- unless: ls /opt/so/state/influxdbmod.py.patched
|
||||
|
||||
influxdbmod.py.patched:
|
||||
file.touch:
|
||||
- name: /opt/so/state/influxdbmod.py.patched
|
||||
- onchanges:
|
||||
- file: influxdbmod.py_shard_duration_patch
|
||||
|
||||
|
||||
@@ -1795,10 +1795,6 @@ reinstall_init() {
|
||||
|
||||
# Backup /opt/so since we'll be rebuilding this directory during setup
|
||||
backup_dir /opt/so "$date_string"
|
||||
# We need to restore these files during a reinstall so python3-influxdb state doesn't try to patch again
|
||||
restore_file "/opt/so_old_$date_string/state/influxdb_continuous_query.py.patched" "/opt/so/state/"
|
||||
restore_file "/opt/so_old_$date_string/state/influxdb_retention_policy.py.patched" "/opt/so/state/"
|
||||
restore_file "/opt/so_old_$date_string/state/influxdbmod.py.patched" "/opt/so/state/"
|
||||
# If the elastic license has been accepted restore the state file
|
||||
restore_file "/opt/so_old_$date_string/state/yeselastic.txt" "/opt/so/state/"
|
||||
|
||||
|
||||
@@ -577,7 +577,6 @@ if ! [[ -f $install_opt_file ]]; then
|
||||
logCmd "salt-call state.show_top"
|
||||
logCmd "salt-key -ya $MINION_ID"
|
||||
|
||||
logCmd "salt-call state.apply salt.helper-packages"
|
||||
logCmd "salt-call state.apply common.packages"
|
||||
logCmd "salt-call state.apply common"
|
||||
logCmd "salt-call state.apply docker"
|
||||
|
||||
Reference in New Issue
Block a user