change whiptail selections from radiolist to menu where appropriate

This commit is contained in:
Doug Burks
2023-02-06 11:52:42 -05:00
parent 22a18d8855
commit cd38ecb300
2 changed files with 45 additions and 41 deletions

View File

@@ -1152,22 +1152,26 @@ filter_unused_nics() {
readarray -t filtered_nics <<< "$filtered_nics"
nic_list=()
nic_list_management=()
for nic in "${filtered_nics[@]}"; do
local nic_mac=$(cat "/sys/class/net/${nic}/address" 2>/dev/null)
case $(cat "/sys/class/net/${nic}/carrier" 2>/dev/null) in
1)
nic_list+=("$nic" "$nic_mac Link UP " "OFF")
nic_list_management+=("$nic" "$nic_mac Link UP " )
;;
0)
nic_list+=("$nic" "$nic_mac Link DOWN " "OFF")
nic_list_management+=("$nic" "$nic_mac Link DOWN " )
;;
*)
nic_list+=("$nic" "$nic_mac Link UNKNOWN " "OFF")
nic_list_management+=("$nic" "$nic_mac Link UNKNOWN " )
;;
esac
done
export nic_list
export nic_list nic_list_management
}
# Generate Firewall Templates

View File

@@ -262,10 +262,10 @@ whiptail_dhcp_or_static() {
[ -n "$TESTING" ] && return
address_type=$(whiptail --title "$whiptail_title" --radiolist \
address_type=$(whiptail --title "$whiptail_title" --menu \
"Choose how to set up your management interface:" 20 78 4 \
"STATIC" "Set a static IPv4 address" ON \
"DHCP" "Use DHCP to configure the Management Interface" OFF 3>&1 1>&2 2>&3 )
"STATIC" "Set a static IPv4 address" \
"DHCP" "Use DHCP to configure the Management Interface" 3>&1 1>&2 2>&3 )
local exitstatus=$?
whiptail_check_exitstatus $exitstatus
@@ -471,13 +471,13 @@ whiptail_install_type() {
[ -n "$TESTING" ] && return
# What kind of install are we doing?
install_type=$(whiptail --title "$whiptail_title" --radiolist \
install_type=$(whiptail --title "$whiptail_title" --menu \
"What kind of installation would you like to do?\n\nFor more information, please see:\n$DOC_BASE_URL/architecture.html" 18 65 5 \
"IMPORT" "Import PCAP or log files " ON \
"EVAL" "Evaluation mode (not for production) " OFF \
"STANDALONE" "Standalone production install " OFF \
"DISTRIBUTED" "Distributed install submenu " OFF \
"OTHER" "Other install types" OFF \
"IMPORT" "Import PCAP or log files " \
"EVAL" "Evaluation mode (not for production) " \
"STANDALONE" "Standalone production install " \
"DISTRIBUTED" "Distributed install submenu " \
"OTHER" "Other install types" \
3>&1 1>&2 2>&3
)
@@ -503,8 +503,8 @@ whiptail_install_type_dist() {
[ -n "$TESTING" ] && return
dist_option=$(whiptail --title "$whiptail_title" --menu "Do you want to start a new deployment or join this box to \nan existing deployment?" 11 75 2 \
"Existing Deployment " "Join to an existing Security Onion deployment " \
"New Deployment " "Create a new Security Onion deployment" \
"Existing Deployment " "Join to an existing Security Onion deployment " \
3>&1 1>&2 2>&3
)
local exitstatus=$?
@@ -525,9 +525,9 @@ whiptail_install_type_dist_new() {
Note: MANAGER is the recommended option for most users. MANAGERSEARCH should only be used in very specific situations.
EOM
install_type=$(whiptail --title "$whiptail_title" --radiolist "$mngr_msg" 15 75 2 \
"MANAGER" "New grid, requires separate search node(s) " ON \
"MANAGERSEARCH" "New grid, separate search node(s) are optional " OFF \
install_type=$(whiptail --title "$whiptail_title" --menu "$mngr_msg" 20 75 2 \
"MANAGER" "New grid, requires separate search node(s) " \
"MANAGERSEARCH" "New grid, separate search node(s) are optional " \
3>&1 1>&2 2>&3
)
@@ -545,18 +545,18 @@ whiptail_install_type_dist_existing() {
Note: Heavy nodes (HEAVYNODE) are NOT recommended for most users.
EOM
install_type=$(whiptail --title "$whiptail_title" --radiolist "$node_msg" 19 58 6 \
"SENSOR" "Create a forward only sensor " ON \
"SEARCHNODE" "Add a search node with parsing " OFF \
"FLEET" "Dedicated Fleet Osquery Node " OFF \
"HEAVYNODE" "Sensor + Search Node " OFF \
"IDH" "Intrusion Detection Honeypot Node " OFF \
"RECEIVER" "Receiver Node " OFF \
install_type=$(whiptail --title "$whiptail_title" --menu "$node_msg" 19 75 6 \
"SENSOR" "Create a forward only sensor " \
"SEARCHNODE" "Add a search node with parsing " \
"FLEET" "Dedicated Fleet Osquery Node " \
"HEAVYNODE" "Sensor + Search Node " \
"IDH" "Intrusion Detection Honeypot Node " \
"RECEIVER" "Receiver Node " \
3>&1 1>&2 2>&3
# "HOTNODE" "Add Hot Node (Uses Elastic Clustering)" OFF \ # TODO
# "WARMNODE" "Add Warm Node to existing Hot or Search node" OFF \ # TODO
# "WAZUH" "Stand Alone Wazuh Server" OFF \ # TODO
# "STRELKA" "Stand Alone Strelka Node" OFF \ # TODO
# "HOTNODE" "Add Hot Node (Uses Elastic Clustering)" \ # TODO
# "WARMNODE" "Add Warm Node to existing Hot or Search node" \ # TODO
# "WAZUH" "Stand Alone Wazuh Server" \ # TODO
# "STRELKA" "Stand Alone Strelka Node" \ # TODO
)
if [ "$install_type" = 'EVAL' ]; then
is_eval=true
@@ -597,10 +597,10 @@ whiptail_install_type_other() {
[ -n "$TESTING" ] && return
install_type=$(whiptail --title "$whiptail_title" --radiolist \
"Choose node type:" 9 65 2 \
"ANALYST" "Setup will run 'so-setup analyst' " ON \
"HELIXSENSOR" "Create a Helix sensor " OFF \
install_type=$(whiptail --title "$whiptail_title" --menu \
"Choose node type:" 10 65 2 \
"ANALYST" "Setup will run 'so-setup analyst' " \
"HELIXSENSOR" "Create a Helix sensor " \
3>&1 1>&2 2>&3
)
@@ -788,13 +788,13 @@ whiptail_management_nic() {
filter_unused_nics
MNIC=$(whiptail --title "$whiptail_title" --radiolist "Please select the NIC you would like to use for management.\n\nUse the arrow keys to move around and the space bar to select." 22 75 12 "${nic_list[@]}" 3>&1 1>&2 2>&3 )
MNIC=$(whiptail --title "$whiptail_title" --menu "Please select the NIC you would like to use for management.\n\nUse the arrow keys to move around and the Enter key to select." 20 75 12 "${nic_list_management[@]}" 3>&1 1>&2 2>&3 )
local exitstatus=$?
whiptail_check_exitstatus $exitstatus
while [ -z "$MNIC" ]
do
MNIC=$(whiptail --title "$whiptail_title" --radiolist "Please select the NIC you would like to use for management.\n\nUse the arrow keys to move around and the space bar to select." 22 75 12 "${nic_list[@]}" 3>&1 1>&2 2>&3 )
MNIC=$(whiptail --title "$whiptail_title" --menu "Please select the NIC you would like to use for management.\n\nUse the arrow keys to move around and the Enter key to select." 22 75 12 "${nic_list_management[@]}" 3>&1 1>&2 2>&3 )
local exitstatus=$?
whiptail_check_exitstatus $exitstatus
done
@@ -878,10 +878,10 @@ whiptail_manager_adv() {
[ -n "$TESTING" ] && return
MANAGERADV=$(whiptail --title "$whiptail_title" --radiolist \
MANAGERADV=$(whiptail --title "$whiptail_title" --menu \
"Choose which type of manager to install:" 20 75 4 \
"BASIC" "Install manager with recommended settings" ON \
"ADVANCED" "Do additional configuration to the manager" OFF 3>&1 1>&2 2>&3 )
"BASIC" "Install manager with recommended settings" \
"ADVANCED" "Do additional configuration to the manager" 3>&1 1>&2 2>&3 )
local exitstatus=$?
whiptail_check_exitstatus $exitstatus
@@ -1121,10 +1121,10 @@ whiptail_sensor_config() {
[ -n "$TESTING" ] && return
NSMSETUP=$(whiptail --title "$whiptail_title" --radiolist \
NSMSETUP=$(whiptail --title "$whiptail_title" --menu \
"What type of configuration would you like to use?" 20 75 4 \
"BASIC" "Install NSM components with recommended settings" ON \
"ADVANCED" "Configure each component individually" OFF 3>&1 1>&2 2>&3 )
"BASIC" "Install NSM components with recommended settings" \
"ADVANCED" "Configure each component individually" 3>&1 1>&2 2>&3 )
local exitstatus=$?
whiptail_check_exitstatus $exitstatus
@@ -1189,11 +1189,11 @@ whiptail_set_redirect() {
[ -n "$TESTING" ] && return
local options=()
options+=( "IP" "Use IP address to access the web interface" ON )
[[ $no_use_hostname != true ]] && options+=( "HOSTNAME" "Use hostname to access the web interface" OFF )
options+=("OTHER" "Use a different name like a FQDN or Load Balancer" OFF)
options+=( "IP" "Use IP address to access the web interface" )
[[ $no_use_hostname != true ]] && options+=( "HOSTNAME" "Use hostname to access the web interface" )
options+=("OTHER" "Use a different name like a FQDN or Load Balancer" )
REDIRECTINFO=$(whiptail --title "$whiptail_title" --radiolist \
REDIRECTINFO=$(whiptail --title "$whiptail_title" --menu \
"How would you like to access the web interface?\n\nWhatever you choose here will be the only way that you can access the web interface.\n\nIf you choose something other than IP address, then you'll need to ensure that you can resolve the name via DNS or hosts entry. If you are unsure, please select IP." 20 75 4 \
"${options[@]}" \
3>&1 1>&2 2>&3