From 0fa001ed92ceb05eb14fe0cb21e1709a9b2717f5 Mon Sep 17 00:00:00 2001 From: William Wernert Date: Mon, 4 Jan 2021 09:27:22 -0500 Subject: [PATCH] [fix] Add more logic to network-only process --- setup/so-functions | 23 ++++++++--------------- setup/so-setup | 28 +++++++++++++++++++++------- setup/so-whiptail | 12 +++++++++++- 3 files changed, 40 insertions(+), 23 deletions(-) diff --git a/setup/so-functions b/setup/so-functions index b3ea2b476..d0e502941 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -1378,6 +1378,14 @@ minio_generate_keys() { } network_init() { + disable_ipv6 + set_hostname + if [[ "$setup_type" == 'iso' ]]; then + set_management_interface + fi +} + +network_init_whiptail() { case "$setup_type" in 'iso') whiptail_set_hostname @@ -1399,21 +1407,6 @@ network_init() { whiptail_management_nic ;; esac - - if [[ $is_minion ]]; then - whiptail_management_server - fi - - if [[ $is_minion || $is_iso ]]; then - whiptail_management_interface_setup - fi - - # Init networking so rest of install works - disable_ipv6 - set_hostname - if [[ "$setup_type" == 'iso' ]]; then - set_management_interface - fi } network_setup() { diff --git a/setup/so-setup b/setup/so-setup index 4fb100caa..677e46478 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -23,7 +23,7 @@ if [ "$uid" -ne 0 ]; then fi # Save the original argument array since we modify it -readarray -t original_args <<< "$@" +original_args=("$@") cd "$(dirname "$0")" || exit 255 @@ -174,12 +174,12 @@ if ! [[ -f $install_opt_file ]]; then if [[ $setup_type == 'iso' ]]; then whiptail_first_menu_iso if [[ $option == "Configure Network" ]] && ! [[ -f $net_init_file ]]; then + network_init_whiptail + whiptail_management_interface_setup network_init printf '%s\n' \ "MNIC=$MNIC" \ - "HOSTNAME=$HOSTNAME" \ - "MSRV=$MSRV" \ - "MSRVIP=$MSRVIP" > "$net_init_file" + "HOSTNAME=$HOSTNAME" > "$net_init_file" whiptail --title "Security Onion Setup" \ --msgbox "Successfully set up networking, setup will now exit." 7 75 exit 0 @@ -259,12 +259,26 @@ if ! [[ -f $install_opt_file ]]; then check_requirements "import" fi - if [[ -f $net_init_file ]]; then - source "$net_init_file" + [[ -f $net_init_file ]] && whiptail_net_reinit && reinit_networking=true + + if [[ $reinit_networking ]] || ! [[ -f $net_init_file ]]; then + network_init_whiptail else - network_init + source "$net_init_file" fi + if [[ $is_minion ]]; then + whiptail_management_server + fi + + if [[ $is_minion ]] || [[ $reinit_networking ]] || ! [[ -f $net_init_file ]]; then + whiptail_management_interface_setup + fi + + if [[ $reinit_networking ]] || ! [[ -f $net_init_file ]]; then + network_init + fi + if [[ -n "$TURBO" ]]; then use_turbo_proxy fi diff --git a/setup/so-whiptail b/setup/so-whiptail index 2cee5f7f1..b034ab679 100755 --- a/setup/so-whiptail +++ b/setup/so-whiptail @@ -771,7 +771,11 @@ whiptail_management_interface_setup() { if [[ $is_iso ]]; then if [[ $minion_msg != "" ]]; then - msg="initialize networking and $minion_msg" + if [[ -f $net_init_file ]]; then + msg=$minion_msg + else + msg="initialize networking and $minion_msg" + fi else msg="initialize networking" fi @@ -978,6 +982,12 @@ whiptail_network_notice() { } +whiptail_net_reinit() { + [ -n "$TESTING" ] && return + + whiptail --title "Security Onion Setup" --yesno "The management interface has already been configured. Do you want to reconfigure it?" 8 75 +} + whiptail_node_advanced() { [ -n "$TESTING" ] && return