[fix] Don't drop to shell while running so-allow

This commit is contained in:
William Wernert
2020-07-17 11:08:31 -04:00
parent 958d614bef
commit d97271cca3
2 changed files with 20 additions and 7 deletions

View File

@@ -622,24 +622,28 @@ fi
} | progress } | progress
success=$(tail -10 $setup_log | grep Failed | awk '{ print $2}') 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 if [[ -n $SO_ERROR ]]; then
echo "Errors detected during setup; skipping post-setup steps to allow for analysis of failures." >> $setup_log 2>&1 echo "Errors detected during setup; skipping post-setup steps to allow for analysis of failures." >> $setup_log 2>&1
SKIP_REBOOT=1 SKIP_REBOOT=1
whiptail_setup_failed whiptail_setup_failed
else else
{
if [[ -n $ALLOW_ROLE && -n $ALLOW_CIDR ]]; then if [[ -n $ALLOW_ROLE && -n $ALLOW_CIDR ]]; then
echo "Running so-allow -${ALLOW_ROLE} for ${ALLOW_CIDR}" >> $setup_log 2>&1 set_progress_str 98 "Running so-allow -${ALLOW_ROLE} for ${ALLOW_CIDR}"
IP=$ALLOW_CIDR so-allow -$ALLOW_ROLE >> $setup_log 2>&1 IP=$ALLOW_CIDR so-allow -$ALLOW_ROLE >> $setup_log 2>&1
fi fi
set_progress_str 99 'Waiting for TheHive to start up'
if [[ $THEHIVE == 1 ]]; then check_hive_init >> $setup_log 2>&1; fi 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 whiptail_setup_complete
fi fi
install_cleanup >> $setup_log 2>&1
if [[ -z $SKIP_REBOOT ]]; then shutdown -r now; else exit; fi if [[ -z $SKIP_REBOOT ]]; then shutdown -r now; else exit; fi

View File

@@ -1086,6 +1086,15 @@ whiptail_so_allow() {
whiptail_check_exitstatus $exitstatus 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() { whiptail_strelka_rules() {
[ -n "$TESTING" ] && return [ -n "$TESTING" ] && return