From 27ff823bc0f5b6c8bc9ae72eeb162bbeb218b85d Mon Sep 17 00:00:00 2001 From: William Wernert Date: Thu, 18 Mar 2021 13:09:46 -0400 Subject: [PATCH 1/7] [fix] Don't set is_cloud in a subshell --- setup/so-setup | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup/so-setup b/setup/so-setup index 6c77fcd5e..667951ef4 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -361,10 +361,11 @@ percentage=0 echo "Could not install packages required for setup, exiting now." >> "$setup_log" 2>&1 kill -SIGUSR1 "$setup_proc"; exit 1 fi - set_progress_str 99 "Detecting whether setup is running in the cloud." nolog - detect_cloud } | progress '...' +echo "Checking if setup is running in the cloud..." +detect_cloud + short_name=$(echo "$HOSTNAME" | awk -F. '{print $1}') MINION_ID=$(echo "${short_name}_${install_type}" | tr '[:upper:]' '[:lower:]') From 360f0d4dfd858c1ae72dad9572a6dfdec8afe209 Mon Sep 17 00:00:00 2001 From: William Wernert Date: Thu, 18 Mar 2021 13:12:16 -0400 Subject: [PATCH 2/7] Also print stdout message to log --- setup/so-functions | 2 +- setup/so-setup | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/so-functions b/setup/so-functions index 73c66c194..827b424f0 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -1942,7 +1942,7 @@ reset_proxy() { [[ -f /etc/systemd/system/docker.service.d/http-proxy.conf ]] && rm -f /etc/systemd/system/docker.service.d/http-proxy.conf systemctl daemon-reload - command -v docker &> /dev/null && echo "Restarting Docker..." && systemctl restart docker + command -v docker &> /dev/null && echo "Restarting Docker..." | tee -a "$setup_log" && systemctl restart docker [[ -f /root/.docker/config.json ]] && rm -f /root/.docker/config.json diff --git a/setup/so-setup b/setup/so-setup index 667951ef4..18455f4d1 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -363,7 +363,7 @@ percentage=0 fi } | progress '...' -echo "Checking if setup is running in the cloud..." +echo "Checking if setup is running in the cloud..." | tee -a "$setup_log" detect_cloud short_name=$(echo "$HOSTNAME" | awk -F. '{print $1}') From 0edf419bcb894a499601353dc840416a215ef7e8 Mon Sep 17 00:00:00 2001 From: William Wernert Date: Thu, 18 Mar 2021 13:16:45 -0400 Subject: [PATCH 3/7] Remove redundant message --- setup/so-functions | 2 +- setup/so-setup | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/setup/so-functions b/setup/so-functions index 827b424f0..29a58e718 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -949,7 +949,7 @@ create_repo() { } detect_cloud() { - echo "Testing if setup is running on a cloud instance..." >> "$setup_log" 2>&1 + echo "Testing if setup is running on a cloud instance..." | tee -a "$setup_log" if ( curl --fail -s -m 5 http://169.254.169.254/latest/meta-data/instance-id > /dev/null ) || ( dmidecode -s bios-vendor | grep -q Google > /dev/null); then export is_cloud="true"; fi } diff --git a/setup/so-setup b/setup/so-setup index 18455f4d1..2f0dca12e 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -363,7 +363,6 @@ percentage=0 fi } | progress '...' -echo "Checking if setup is running in the cloud..." | tee -a "$setup_log" detect_cloud short_name=$(echo "$HOSTNAME" | awk -F. '{print $1}') From 2e84af621efd7e98772d27d42fd22a9b45e98eb8 Mon Sep 17 00:00:00 2001 From: Mike Reeves Date: Thu, 18 Mar 2021 15:14:10 -0400 Subject: [PATCH 4/7] Add postloop for 2.3.40 --- salt/common/tools/sbin/soup | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/salt/common/tools/sbin/soup b/salt/common/tools/sbin/soup index 84627a4ea..2a2be0287 100755 --- a/salt/common/tools/sbin/soup +++ b/salt/common/tools/sbin/soup @@ -246,6 +246,7 @@ postupgrade_changes() { [[ "$POSTVERSION" =~ rc.1 ]] && post_rc1_to_rc2 [[ "$POSTVERSION" == 2.3.20 || "$POSTVERSION" == 2.3.21 ]] && post_2.3.2X_to_2.3.30 + [[ "$POSTVERSION" == 2.3.30 ]] && post_2.3.30_to_2.3.40 } post_rc1_to_2.3.21() { @@ -260,6 +261,12 @@ post_2.3.2X_to_2.3.30() { POSTVERSION=2.3.30 } +post_2.3.30_to_2.3.40() { + so-playbook-sigma-refresh >> /root/soup_playbook_sigma_refresh.log 2>&1 & + POSTVERSION=2.3.40 +} + + rc1_to_rc2() { # Move the static file to global.sls From 77b8aecfd94e168463830b514ed5b3b6d6db1df4 Mon Sep 17 00:00:00 2001 From: Josh Brower Date: Thu, 18 Mar 2021 15:40:12 -0400 Subject: [PATCH 5/7] add so-kibana-space-defaults --- salt/common/tools/sbin/soup | 1 + 1 file changed, 1 insertion(+) diff --git a/salt/common/tools/sbin/soup b/salt/common/tools/sbin/soup index 2a2be0287..6ff298770 100755 --- a/salt/common/tools/sbin/soup +++ b/salt/common/tools/sbin/soup @@ -263,6 +263,7 @@ post_2.3.2X_to_2.3.30() { post_2.3.30_to_2.3.40() { so-playbook-sigma-refresh >> /root/soup_playbook_sigma_refresh.log 2>&1 & + so-kibana-space-defaults POSTVERSION=2.3.40 } From b595c6ddf7be6062b8747d0e2984df558125cf72 Mon Sep 17 00:00:00 2001 From: William Wernert Date: Thu, 18 Mar 2021 16:00:13 -0400 Subject: [PATCH 6/7] Configure default Space in Kibana during setup --- setup/so-setup | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup/so-setup b/setup/so-setup index 2f0dca12e..82e414ca4 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -799,6 +799,9 @@ set_redirect >> $setup_log 2>&1 set_progress_str 70 "$(print_salt_state_apply 'kibana')" salt-call state.apply -l info kibana >> $setup_log 2>&1 + + set_progress_str 70 "Setting up default Space in Kibana" + so-kibana-space-defaults >> $setup_log 2>&1 fi if [[ "$PLAYBOOK" = 1 ]]; then From d020f1d1a178b39f26191722bd5050afb349277b Mon Sep 17 00:00:00 2001 From: Josh Brower Date: Fri, 19 Mar 2021 08:15:47 -0400 Subject: [PATCH 7/7] Fix Fleet Custom Hostname Reactor --- salt/reactor/fleet.sls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/reactor/fleet.sls b/salt/reactor/fleet.sls index bc2131427..cd548e689 100644 --- a/salt/reactor/fleet.sls +++ b/salt/reactor/fleet.sls @@ -89,7 +89,7 @@ def run(): # Update the Fleet host in the static pillar for line in fileinput.input(STATICFILE, inplace=True): - line = re.sub(r'fleet_custom_hostname:.*\n', f"fleet_custom_hostname: {CUSTOMHOSTNAME}", line.rstrip()) + line = re.sub(r'fleet_custom_hostname:.*$', f"fleet_custom_hostname: {CUSTOMHOSTNAME}", line.rstrip()) print(line) return {}