From 1ea3cb1c615fc876b1429ada48bca2c81f62ecd7 Mon Sep 17 00:00:00 2001 From: William Wernert Date: Wed, 3 Mar 2021 14:20:26 -0500 Subject: [PATCH] [wip] Change when proxy is set up so main ip is known * Also only restart docker if the command exists (i.e. docker is installed) --- setup/so-functions | 12 ++++++++---- setup/so-setup | 4 +--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/setup/so-functions b/setup/so-functions index f0b139f6d..d61470d30 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -774,10 +774,10 @@ compare_main_nic_ip() { if ! [[ $MNIC =~ ^(tun|wg|vpn).*$ ]]; then if [[ "$MAINIP" != "$MNIC_IP" ]]; then read -r -d '' message <<- EOM - The IP being routed by Linux is not the IP address assigned to the management interface ($MNIC). + The IP being routed by Linux is not the IP address assigned to the management interface ($MNIC). This is not a supported configuration, please remediate and rerun setup. - EOM + EOM whiptail --title "Security Onion Setup" --msgbox "$message" 10 75 kill -SIGINT "$(ps --pid $$ -oppid=)"; exit 1 fi @@ -1719,9 +1719,11 @@ network_init() { if [[ "$setup_type" == 'iso' ]]; then set_management_interface fi + set_main_ip >> $setup_log 2>&1 + compare_main_nic_ip # Check if the proxy variable was set then set proxy for various apps if so if [[ -n "$so_proxy" ]]; then - set_proxy + set_proxy >> $setup_log 2>&1 fi } @@ -2235,6 +2237,8 @@ set_proxy() { echo "export no_proxy=\"${no_proxy_string}\"" } >> "$profile_d_config_file" + [[ -d '/etc/systemd/system/docker.service.d' ]] || mkdir -p '/etc/systemd/system/docker.service.d' + # Create proxy config for dockerd printf '%s\n'\ "[Service]"\ @@ -2243,7 +2247,7 @@ set_proxy() { "Environment=\"NO_PROXY=${no_proxy_string}\"" > /etc/systemd/system/docker.service.d/http-proxy.conf systemctl daemon-reload - systemctl restart docker + command -v docker &> /dev/null && systemctl restart docker # Set proxy for package manager if [ "$OS" = 'centos' ]; then diff --git a/setup/so-setup b/setup/so-setup index 65fbbe16e..f16699e58 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -537,9 +537,7 @@ catch() { exit } -# This block sets REDIRECTIT which is used by a function outside the below subshell -set_main_ip >> $setup_log 2>&1 -compare_main_nic_ip +# Set REDIRECTIT variable, which is used by a function outside the below subshell set_redirect >> $setup_log 2>&1 # Begin install