Merge pull request #11177 from Security-Onion-Solutions/wheelwatchdog

new python watchdog
This commit is contained in:
Josh Patterson
2023-08-25 15:32:52 -04:00
committed by GitHub
4 changed files with 31 additions and 5 deletions

View File

@@ -21,7 +21,6 @@ commonpkgs:
- python3-dateutil - python3-dateutil
- python3-docker - python3-docker
- python3-packaging - python3-packaging
- python3-watchdog
- python3-lxml - python3-lxml
- git - git
- rsync - rsync
@@ -74,7 +73,6 @@ commonpkgs:
- python3-packaging - python3-packaging
- python3-pyyaml - python3-pyyaml
- python3-rich - python3-rich
- python3-watchdog
- rsync - rsync
- sqlite - sqlite
- tcpdump - tcpdump

View File

@@ -446,6 +446,10 @@ set_os() {
OS=centos OS=centos
OSVER=9 OSVER=9
is_centos=true is_centos=true
elif grep -q "Oracle Linux Server release 9" /etc/system-release; then
OS=oel
OSVER=9
is_oracle=true
fi fi
cron_service_name="crond" cron_service_name="crond"
else else

View File

@@ -303,6 +303,7 @@ check_log_size_limit() {
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."
NEEDUPDATES="We have detected missing operating system (OS) updates. Do you want to install these OS updates now? This could take a while depending on the size of your grid and how many packages are missing, but it is recommended to keep your system updated." NEEDUPDATES="We have detected missing operating system (OS) updates. Do you want to install these OS updates now? This could take a while depending on the size of your grid and how many packages are missing, but it is recommended to keep your system updated."
OSUPDATES=$(dnf -q list updates | grep -v docker | grep -v containerd | grep -v salt | grep -v Available | wc -l) OSUPDATES=$(dnf -q list updates | grep -v docker | grep -v containerd | grep -v salt | grep -v Available | wc -l)
if [[ "$OSUPDATES" -gt 0 ]]; then if [[ "$OSUPDATES" -gt 0 ]]; then
@@ -437,6 +438,11 @@ post_to_2.4.20() {
POSTVERSION=2.4.20 POSTVERSION=2.4.20
} }
repo_sync() {
echo "Sync the local repo."
su socore -c '/usr/sbin/so-repo-sync'
}
stop_salt_master() { stop_salt_master() {
# kill all salt jobs across the grid because the hang indefinitely if they are queued and salt-master restarts # kill all salt jobs across the grid because the hang indefinitely if they are queued and salt-master restarts
set +e set +e
@@ -762,9 +768,7 @@ main() {
fi fi
echo "Verifying we have the latest soup script." echo "Verifying we have the latest soup script."
verify_latest_update_script verify_latest_update_script
echo "Checking for OS updates."
check_os_updates
echo "Let's see if we need to update Security Onion." echo "Let's see if we need to update Security Onion."
upgrade_check upgrade_check
upgrade_space upgrade_space
@@ -776,6 +780,10 @@ main() {
if [[ $is_airgap -eq 0 ]]; then if [[ $is_airgap -eq 0 ]]; then
yum clean all yum clean all
check_os_updates check_os_updates
elif [[ $OS == 'oel' || $OS == 'rocky'|| $OS == 'centos' ]]; then
# sync remote repo down to local if not airgap
repo_sync
check_os_updates
fi fi
if [ "$is_hotfix" == "true" ]; then if [ "$is_hotfix" == "true" ]; then

View File

@@ -47,6 +47,21 @@ filestream_config:
FILESTREAMCONFIG: {{ STRELKAMERGED.filestream.config }} FILESTREAMCONFIG: {{ STRELKAMERGED.filestream.config }}
# Filecheck Section # Filecheck Section
{% if GLOBALS.os_family == 'Debian' %}
install_watchdog:
pkg.installed:
- name: python3-watchdog
{% elif GLOBALS.os_family == 'RedHat' %}
remove_old_watchdog:
pkg.removed:
- name: python3-watchdog
install_watchdog:
pkg.installed:
- name: securityonion-python39-watchdog
{% endif %}
filecheck_logdir: filecheck_logdir:
file.directory: file.directory:
- name: /opt/so/log/strelka - name: /opt/so/log/strelka
@@ -127,6 +142,7 @@ filecheck_restart:
- onchanges: - onchanges:
- file: filecheck_script - file: filecheck_script
- file: filecheck_conf - file: filecheck_conf
- pkg: install_watchdog
filcheck_history_clean: filcheck_history_clean:
cron.present: cron.present: