From 4dc3a6aa35280f84978ca2e4251841e44776f175 Mon Sep 17 00:00:00 2001 From: William Wernert Date: Wed, 13 Jan 2021 11:36:20 -0500 Subject: [PATCH] [refactor] Standardize list inputs to comma separated --- salt/common/tools/sbin/so-common | 2 +- setup/so-functions | 2 ++ setup/so-whiptail | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/salt/common/tools/sbin/so-common b/salt/common/tools/sbin/so-common index 9fd4ef7dc..1f8a36d23 100755 --- a/salt/common/tools/sbin/so-common +++ b/salt/common/tools/sbin/so-common @@ -264,7 +264,7 @@ valid_cidr_list() { valid_dns_list() { local all_valid=0 - read -r -a dns_arr <<< "$1" + IFS="," read -r -a dns_arr <<< "$1" for addr in "${dns_arr[@]}"; do valid_ip4 "$addr" || all_valid=1 diff --git a/setup/so-functions b/setup/so-functions index d31305c5d..25407c8fa 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -392,6 +392,8 @@ collect_dns() { whiptail_invalid_input whiptail_management_interface_dns done + + MDNS=$(echo "$MDNS" | tr -s "," " ") # MDNS needs to be space separated, we prompt for comma separated for consistency } collect_dns_domain() { diff --git a/setup/so-whiptail b/setup/so-whiptail index a182fec5a..ad9e42f28 100755 --- a/setup/so-whiptail +++ b/setup/so-whiptail @@ -669,10 +669,11 @@ whiptail_management_interface_dns() { [ -n "$TESTING" ] && return MDNS=$(whiptail --title "Security Onion Setup" --inputbox \ - "Enter your DNS servers separated by a space:" 10 60 8.8.8.8 8.8.4.4 3>&1 1>&2 2>&3) + "Enter your DNS servers separated by commas:" 10 60 "8.8.8.8,8.8.4.4" 3>&1 1>&2 2>&3) local exitstatus=$? whiptail_check_exitstatus $exitstatus + } whiptail_management_interface_dns_search() {