From b027da6378081e1d80ad1d0198dfc5832ec2bec0 Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Wed, 29 Dec 2021 11:18:38 -0500 Subject: [PATCH 1/3] wait for the salt-minion service to be ready for requests prior to running ssl state --- setup/so-functions | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/setup/so-functions b/setup/so-functions index 7568bca28..a980d317a 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -1033,6 +1033,7 @@ copy_minion_tmp_files() { } >> "$setup_log" 2>&1 ;; esac + salt-call saltutil.sync_modules >> "$setup_log" 2>&1 } copy_ssh_key() { @@ -1443,9 +1444,13 @@ generate_ca() { generate_ssl() { { + # if the install type is a manager then we need to wait for the minion to be ready before trying + # to run the ssl state since we need the minion to sign the certs + if [[ "$install_type" =~ ^(EVAL|MANAGER|MANAGERSEARCH|STANDALONE|IMPORT|HELIXSENSOR)$ ]]; then + wait_for_salt_minion + fi echo "Applying SSL state"; salt-call state.apply ssl; - salt-call saltutil.sync_modules; } >> "$setup_log" 2>&1 } @@ -2787,6 +2792,12 @@ wait_for_file() { return 1 } +wait_for_salt_minion() { + + retry 60 5 "journalctl -u salt-minion.service | grep 'Minion is ready to receive requests'" >> "$setup_log" 2>&1 || exit 1 + +} + # Enable Zeek Logs zeek_logs_enabled() { echo "Enabling Zeek Logs" >> "$setup_log" 2>&1 From 4c54d456811731abc5f918b21a613dd9c599e720 Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Wed, 29 Dec 2021 11:36:12 -0500 Subject: [PATCH 2/3] some echos for logging --- setup/so-functions | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup/so-functions b/setup/so-functions index a980d317a..bb5b26330 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -1033,6 +1033,7 @@ copy_minion_tmp_files() { } >> "$setup_log" 2>&1 ;; esac + echo "Syncing all salt modules." >> "$setup_log" 2>&1 salt-call saltutil.sync_modules >> "$setup_log" 2>&1 } @@ -1437,7 +1438,7 @@ generate_ca() { echo "Building Certificate Authority"; salt-call state.apply ca; - echo " Confirming existence of the CA certificate" + echo "Confirming existence of the CA certificate" openssl x509 -in /etc/pki/ca.crt -noout -subject -issuer -dates } >> "$setup_log" 2>&1 } From b414e22e95be086d2616937ab87ac2c915c43a40 Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Wed, 29 Dec 2021 11:37:22 -0500 Subject: [PATCH 3/3] remove spaces in function --- setup/so-functions | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup/so-functions b/setup/so-functions index bb5b26330..5a3781f39 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -2794,9 +2794,7 @@ wait_for_file() { } wait_for_salt_minion() { - retry 60 5 "journalctl -u salt-minion.service | grep 'Minion is ready to receive requests'" >> "$setup_log" 2>&1 || exit 1 - } # Enable Zeek Logs