Setup Script - added cancel message and exit

This commit is contained in:
Mike Reeves
2018-03-23 16:16:48 -04:00
parent 225dfe3b9c
commit 3ab522875d

View File

@@ -296,8 +296,17 @@ whiptail_bond_nics() {
BNICS=$(whiptail --title "NIC Setup" --checklist "Please add NICs to the Monitor Interface" 20 78 12 ${FNICS[@]} 3>&1 1>&2 2>&3 ) BNICS=$(whiptail --title "NIC Setup" --checklist "Please add NICs to the Monitor Interface" 20 78 12 ${FNICS[@]} 3>&1 1>&2 2>&3 )
local exitstatus=$?
whiptail_check_exitstatus $exitstatus
} }
whiptail_check_exitstatus() {
if [ $1 == '1' ]; then
echo " They hit cancel"
whiptail_cancel
fi
}
whiptail_install_type() { whiptail_install_type() {
# What kind of install are we doing? # What kind of install are we doing?
@@ -309,27 +318,21 @@ whiptail_install_type() {
"STORAGENODE" "Add a Storage Node" OFF 3>&1 1>&2 2>&3 ) "STORAGENODE" "Add a Storage Node" OFF 3>&1 1>&2 2>&3 )
local exitstatus=$? local exitstatus=$?
if [[ "$exitstatus" = 1 ]]; then whiptail_check_exitstatus $exitstatus
echo " They hit cancel"
whiptail_menu
fi
} }
whiptail_management_nic() { whiptail_management_nic() {
MNIC=$(whiptail --title "NIC Setup" --radiolist "Please select your management NIC" 20 78 12 ${NICS[@]} 3>&1 1>&2 2>&3 ) MNIC=$(whiptail --title "NIC Setup" --radiolist "Please select your management NIC" 20 78 12 ${NICS[@]} 3>&1 1>&2 2>&3 )
local exitstatus=$?
whiptail_check_exitstatus $exitstatus
} }
whiptail_menu() { whiptail_cancel() {
MENU=$(whiptail --title "Menu example" --menu "Choose an option" 25 78 16 \ whiptail --title "Security Onion Setup" --msgbox "Cancelling Setup. No changes have been made." 8 78
"<-- Back" "Return to the main menu." \ exit
"Add User" "Add a user to the system." \
"Modify User" "Modify an existing user." \
"List Users" "List all users on the system." \
"Add Group" "Add a user group to the system." \
"Modify Group" "Modify a group and its list of members." \
"List Groups" "List all groups on the system." 3>&2 2>&1 1>&3)
} }
whiptail_nids() { whiptail_nids() {
@@ -338,6 +341,9 @@ whiptail_nids() {
"Choose which IDS to run:" 20 78 4 \ "Choose which IDS to run:" 20 78 4 \
"Suricata" "Evaluate all the things" ON 3>&1 1>&2 2>&3 ) "Suricata" "Evaluate all the things" ON 3>&1 1>&2 2>&3 )
local exitstatus=$?
whiptail_check_exitstatus $exitstatus
} }
whiptail_oinkcode() { whiptail_oinkcode() {
@@ -345,18 +351,27 @@ whiptail_oinkcode() {
OINKCODE=$(whiptail --title "Security Onion Setup" --inputbox \ OINKCODE=$(whiptail --title "Security Onion Setup" --inputbox \
"Enter your oinkcode" 10 60 XXXXXXX 3>&1 1>&2 2>&3) "Enter your oinkcode" 10 60 XXXXXXX 3>&1 1>&2 2>&3)
local exitstatus=$?
whiptail_check_exitstatus $exitstatus
} }
whiptail_management_server() { whiptail_management_server() {
MASTERSRV=$(whiptail --title "Enter your Master Server IP Address" --inputbox 10 60 1.2.3.4 3>&1 1>&2 2>&3) MASTERSRV=$(whiptail --title "Enter your Master Server IP Address" --inputbox 10 60 1.2.3.4 3>&1 1>&2 2>&3)
local exitstatus=$?
whiptail_check_exitstatus $exitstatus
} }
whiptail_network_notice() { whiptail_network_notice() {
whiptail --title "Security Onion Setup" --msgbox "Since this is a network install we assume the management interface, DNS, Hostname, etc are already set up. You must hit OK to continue." 8 78 whiptail --title "Security Onion Setup" --msgbox "Since this is a network install we assume the management interface, DNS, Hostname, etc are already set up. You must hit OK to continue." 8 78
local exitstatus=$?
whiptail_check_exitstatus $exitstatus
} }
whiptail_rule_setup() { whiptail_rule_setup() {
@@ -369,6 +384,9 @@ whiptail_rule_setup() {
"TALOSET" "Snort Subscriber (Talos) ruleset and Emerging Threats NoGPL ruleset - requires Snort Subscriber oinkcode" OFF \ "TALOSET" "Snort Subscriber (Talos) ruleset and Emerging Threats NoGPL ruleset - requires Snort Subscriber oinkcode" OFF \
"TALOS" "Snort Subscriber (Talos) ruleset only and set a Snort Subscriber policy - requires Snort Subscriber oinkcode" OFF 3>&1 1>&2 2>&3 ) "TALOS" "Snort Subscriber (Talos) ruleset only and set a Snort Subscriber policy - requires Snort Subscriber oinkcode" OFF 3>&1 1>&2 2>&3 )
local exitstatus=$?
whiptail_check_exitstatus $exitstatus
} }
whiptail_sensor_config() { whiptail_sensor_config() {
@@ -378,6 +396,9 @@ whiptail_sensor_config() {
"BASIC" "Install NSM components with recommended settings" ON \ "BASIC" "Install NSM components with recommended settings" ON \
"ADVANCED" "Configure each component individually" OFF 3>&1 1>&2 2>&3 ) "ADVANCED" "Configure each component individually" OFF 3>&1 1>&2 2>&3 )
local exitstatus=$?
whiptail_check_exitstatus $exitstatus
} }
whiptail_you_sure() { whiptail_you_sure() {