From bf477a1c19b2b21b0c1455c58f27e9fbf39a5cc0 Mon Sep 17 00:00:00 2001 From: Josh Brower Date: Fri, 18 Feb 2022 17:21:04 -0500 Subject: [PATCH] IDH - Initial whiptail --- setup/so-functions | 10 ++++++++++ setup/so-setup | 1 + setup/so-whiptail | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/setup/so-functions b/setup/so-functions index d9ec0b658..c485ed7a0 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -447,6 +447,16 @@ collect_hostname_validate() { done } +collect_idh_services() { + whiptail_idh_services + + if [ $idh_services == "Custom"; ] then + whiptail_idh_services_custom + fi + + echo $idh_services +} + collect_int_ip_mask() { whiptail_management_interface_ip_mask diff --git a/setup/so-setup b/setup/so-setup index 91a45de7e..23f3ed151 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -915,6 +915,7 @@ echo "1" > /root/accept_changes fi if [[ "$IDH" = 1 ]]; then + collect_idh_services() set_progress_str 79 "$(print_salt_state_apply 'idh')" salt-call state.apply -l info idh >> $setup_log 2>&1 diff --git a/setup/so-whiptail b/setup/so-whiptail index c7073d4be..7a26ad54c 100755 --- a/setup/so-whiptail +++ b/setup/so-whiptail @@ -717,6 +717,47 @@ whiptail_homenet_sensor() { export HNSENSOR } + +whiptail_idh_services() { + + [ -n "$TESTING" ] && return + + idh_services=$(whiptail --title "$whiptail_title" --radiolist \ + "\nThe IDH node can mimic several services.\n\nChoose one of the common options along with their default ports (TCP) or select the Custom option to build a customized set of services." 20 75 5 \ + "Linux Webserver" "Apache (80), FTP (21), SSH (22)" ON \ + "MySQL Server" "MySQL (3306), SSH (22)" OFF \ + "MSSQL Server" "Microsoft SQL (1433), VNC (5900)" OFF \ + "Custom" "Select a custom set of services on next screen" OFF 3>&1 1>&2 2>&3 ) + + local exitstatus=$? + whiptail_check_exitstatus $exitstatus +} + + +whiptail_idh_services_custom() { + + [ -n "$TESTING" ] && return + + idh_services=$(whiptail --title "$whiptail_title" --checklist \ + "\nThe IDH node can mimic many different services.\n\nChoose one or more of the following services along with their default ports (TCP). Some services have additional configuration options, please consult the documentation for further information." 20 75 6 \ + "FTP " "TCP/21, Additional Configuration Available " OFF \ + "Git " "TCP/9418 " OFF \ + "HTTP " "TCP/80, Additional Configuration Available " OFF \ + "HTTPPROXY " "TCP/8080, Additional Configuration Available " OFF \ + "MSSQL " "TCP/22 " OFF \ + "MySQL " "TCP/3306, Additional Configuration Available " OFF \ + "NTP " "TCP/123 " OFF \ + "REDIS " "TCP/6379 " OFF \ + "SNMP " "TCP/161 " OFF \ + "SSH " "TCP/22, Additional Configuration Available " OFF \ + "TELNET " "TCP/23, Additional Configuration Available " OFF \ + "TFTP " "TCP/69 " OFF \ + "VNC " "TCP/22 " OFF 3>&1 1>&2 2>&3 ) + + local exitstatus=$? + whiptail_check_exitstatus $exitstatus +} + whiptail_install_type() { [ -n "$TESTING" ] && return