From 649f52dac7a039f7f1fa05089d434c087755b026 Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Mon, 13 May 2024 10:37:56 -0400 Subject: [PATCH 1/4] create_local_directories in soup too --- salt/common/tools/sbin/so-common | 15 +++++++++++++++ salt/manager/tools/sbin/soup | 2 ++ setup/so-functions | 15 --------------- setup/so-setup | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/salt/common/tools/sbin/so-common b/salt/common/tools/sbin/so-common index a71d67f814..d6cd4c4e8b 100755 --- a/salt/common/tools/sbin/so-common +++ b/salt/common/tools/sbin/so-common @@ -179,6 +179,21 @@ copy_new_files() { cd /tmp } +create_local_directories() { + info "Creating local pillar and salt directories if needed" + PILLARSALTDIR=$1 + for i in "pillar" "salt"; do + for d in $(find $PILLARSALTDIR/$i -type d); do + suffixdir=${d//$PILLARSALTDIR/} + if [ ! -d "$local_salt_dir/$suffixdir" ]; then + logCmd "mkdir -pv $local_salt_dir$suffixdir" + fi + done + logCmd "chown -R socore:socore $local_salt_dir/$i" + done + +} + disable_fastestmirror() { sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf } diff --git a/salt/manager/tools/sbin/soup b/salt/manager/tools/sbin/soup index aaa703ba9f..5a8f707717 100755 --- a/salt/manager/tools/sbin/soup +++ b/salt/manager/tools/sbin/soup @@ -1026,6 +1026,7 @@ main() { backup_old_states_pillars fi copy_new_files + create_local_directories "/opt/so/saltstack/default" apply_hotfix echo "Hotfix applied" update_version @@ -1092,6 +1093,7 @@ main() { echo "Copying new Security Onion code from $UPDATE_DIR to $DEFAULT_SALT_DIR." copy_new_files echo "" + create_local_directories "/opt/so/saltstack/default" update_version echo "" diff --git a/setup/so-functions b/setup/so-functions index 3cdaee9caf..d91161203f 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -762,21 +762,6 @@ copy_salt_master_config() { logCmd "systemctl restart salt-master" } -create_local_directories() { - info "Creating local pillar and salt directories" - PILLARSALTDIR=${SCRIPTDIR::-5} - for i in "pillar" "salt"; do - for d in $(find $PILLARSALTDIR/$i -type d); do - suffixdir=${d//$PILLARSALTDIR/} - if [ ! -d "$local_salt_dir/$suffixdir" ]; then - logCmd "mkdir -pv $local_salt_dir$suffixdir" - fi - done - logCmd "chown -R socore:socore $local_salt_dir/$i" - done - -} - create_local_nids_rules() { title "Create a local.rules file so it doesn't get removed on updates" logCmd "mkdir -p /opt/so/saltstack/local/salt/idstools" diff --git a/setup/so-setup b/setup/so-setup index cb535469be..0387da0deb 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -672,7 +672,7 @@ if ! [[ -f $install_opt_file ]]; then # Add the socore user add_socore_user_manager - create_local_directories + create_local_directories ${SCRIPTDIR::-5} setup_salt_master_dirs create_manager_pillars From 2643da978b282a8c55d7ae8cdd42e117caeeb859 Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Mon, 13 May 2024 11:51:10 -0400 Subject: [PATCH 2/4] those functions in so-functions --- salt/common/tools/sbin/so-common | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/salt/common/tools/sbin/so-common b/salt/common/tools/sbin/so-common index d6cd4c4e8b..77e80ee8c1 100755 --- a/salt/common/tools/sbin/so-common +++ b/salt/common/tools/sbin/so-common @@ -180,13 +180,13 @@ copy_new_files() { } create_local_directories() { - info "Creating local pillar and salt directories if needed" + echo "Creating local pillar and salt directories if needed" PILLARSALTDIR=$1 for i in "pillar" "salt"; do for d in $(find $PILLARSALTDIR/$i -type d); do suffixdir=${d//$PILLARSALTDIR/} if [ ! -d "$local_salt_dir/$suffixdir" ]; then - logCmd "mkdir -pv $local_salt_dir$suffixdir" + mkdir -pv $local_salt_dir$suffixdir fi done logCmd "chown -R socore:socore $local_salt_dir/$i" From eb038582308021c606490449aea8caf22a7300b7 Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Mon, 13 May 2024 12:44:57 -0400 Subject: [PATCH 3/4] missed one --- salt/common/tools/sbin/so-common | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/salt/common/tools/sbin/so-common b/salt/common/tools/sbin/so-common index 77e80ee8c1..0ed7a662d2 100755 --- a/salt/common/tools/sbin/so-common +++ b/salt/common/tools/sbin/so-common @@ -189,9 +189,8 @@ create_local_directories() { mkdir -pv $local_salt_dir$suffixdir fi done - logCmd "chown -R socore:socore $local_salt_dir/$i" + chown -R socore:socore $local_salt_dir/$i done - } disable_fastestmirror() { From 1ef9509aac03a4b3911d9df343a249222056a61c Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Mon, 13 May 2024 14:34:22 -0400 Subject: [PATCH 4/4] define local_salt_dir --- salt/common/tools/sbin/so-common | 1 + 1 file changed, 1 insertion(+) diff --git a/salt/common/tools/sbin/so-common b/salt/common/tools/sbin/so-common index 0ed7a662d2..8d4d9f8abf 100755 --- a/salt/common/tools/sbin/so-common +++ b/salt/common/tools/sbin/so-common @@ -182,6 +182,7 @@ copy_new_files() { create_local_directories() { echo "Creating local pillar and salt directories if needed" PILLARSALTDIR=$1 + local_salt_dir="/opt/so/saltstack/local" for i in "pillar" "salt"; do for d in $(find $PILLARSALTDIR/$i -type d); do suffixdir=${d//$PILLARSALTDIR/}