From d97271cca34107d35d74f89f9c4dd03bcc5b6168 Mon Sep 17 00:00:00 2001 From: William Wernert Date: Fri, 17 Jul 2020 11:08:31 -0400 Subject: [PATCH] [fix] Don't drop to shell while running so-allow --- setup/so-setup | 18 +++++++++++------- setup/so-whiptail | 9 +++++++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/setup/so-setup b/setup/so-setup index 7cf0c70f8..7f8862841 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -622,24 +622,28 @@ fi } | progress success=$(tail -10 $setup_log | grep Failed | awk '{ print $2}') +if [[ $success != 0 ]]; then SO_ERROR=1; fi -if [[ $success != 0 ]]; then SO_ERROR=1; fi # evaluate success first so it doesn't check against the output of so-allow if [[ -n $SO_ERROR ]]; then echo "Errors detected during setup; skipping post-setup steps to allow for analysis of failures." >> $setup_log 2>&1 SKIP_REBOOT=1 whiptail_setup_failed else - if [[ -n $ALLOW_ROLE && -n $ALLOW_CIDR ]]; then - echo "Running so-allow -${ALLOW_ROLE} for ${ALLOW_CIDR}" >> $setup_log 2>&1 - IP=$ALLOW_CIDR so-allow -$ALLOW_ROLE >> $setup_log 2>&1 - fi + { + if [[ -n $ALLOW_ROLE && -n $ALLOW_CIDR ]]; then + set_progress_str 98 "Running so-allow -${ALLOW_ROLE} for ${ALLOW_CIDR}" + IP=$ALLOW_CIDR so-allow -$ALLOW_ROLE >> $setup_log 2>&1 + fi - if [[ $THEHIVE == 1 ]]; then check_hive_init >> $setup_log 2>&1; fi + set_progress_str 99 'Waiting for TheHive to start up' + if [[ $THEHIVE == 1 ]]; then check_hive_init >> $setup_log 2>&1; fi - install_cleanup >> $setup_log 2>&1 + } | whiptail_gauge_post_setup "Running post-installation steps..." whiptail_setup_complete fi +install_cleanup >> $setup_log 2>&1 + if [[ -z $SKIP_REBOOT ]]; then shutdown -r now; else exit; fi diff --git a/setup/so-whiptail b/setup/so-whiptail index 3556a8245..358a18909 100755 --- a/setup/so-whiptail +++ b/setup/so-whiptail @@ -1086,6 +1086,15 @@ whiptail_so_allow() { whiptail_check_exitstatus $exitstatus } +whiptail_gauge_post_setup() { + + [ -n "$TESTING" ] && return + + local msg=$1 + + whiptail --title "Security Onion Setup" --guage "$msg" 6 60 96 +} + whiptail_strelka_rules() { [ -n "$TESTING" ] && return