[refactor] Set enabled components in whiptail function

This commit is contained in:
William Wernert
2020-04-18 18:26:27 -04:00
parent 6ca5827ce6
commit 043f2df7e3
3 changed files with 20 additions and 19 deletions

View File

@@ -983,22 +983,6 @@ patch_schedule_os_new() {
}
process_components() {
CLEAN=${COMPONENTS//\"}
GRAFANA=0
OSQUERY=0
WAZUH=0
THEHIVE=0
PLAYBOOK=0
STRELKA=0
IFS=$' '
for item in $(echo "$CLEAN"); do
let $item=1
done
unset IFS
}
reserve_group_ids() {
# This is a hack to fix CentOS from taking group IDs that we need

View File

@@ -279,7 +279,6 @@ if (whiptail_you_sure) ; then
# Find out how to handle updates
whiptail_master_updates
whiptail_enable_components
process_components
# Do Advacned Setup if they chose it
if [ "$MASTERADV" == 'ADVANCED' ]; then
@@ -561,7 +560,6 @@ if (whiptail_you_sure) ; then
NIDS=Suricata
BROVERSION=ZEEK
CURCLOSEDAYS=30
process_components
if [ $INSTALLTYPE == 'MASTERSEARCH' ]; then
# Find out how to handle updates
whiptail_master_updates

View File

@@ -269,6 +269,20 @@ whiptail_enable_components() {
"PLAYBOOK" "Enable Playbook" ON \
"STRELKA" "Enable Strelka" ON 3>&1 1>&2 2>&3 )
# Init the environment variables
GRAFANA=0
OSQUERY=0
WAZUH=0
THEHIVE=0
PLAYBOOK=0
STRELKA=0
# Set any variables to 1 if they exist in COMPONENTS
for component in "${COMPONENTS[@]}"; do
component="$(echo -e "$component" | tr -d '"')"
eval "$component"="1"
done
local exitstatus=$?
whiptail_check_exitstatus $exitstatus
@@ -659,9 +673,12 @@ whiptail_node_ls_input_batch_count() {
}
#TODO: helper function to display error message or exit if batch mode
whiptail_passwords_dont_match() {
[ -z "$QUIET" ] && return
# exit_if_batch "Error string" Error code (int)
whiptail --title "Security Onion Setup" --msgbox "Passwords don't match. Please re-enter." 8 75
@@ -948,6 +965,8 @@ whiptail_you_sure() {
[ -z "$QUIET" ] && return
echo "whiptail_you_sure called" >> $SETUPLOG 2>&1
whiptail --title "Security Onion Setup" --yesno "Are you sure you want to install Security Onion over the internet?" 8 75