[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)
This commit is contained in:
William Wernert
2021-03-03 14:20:26 -05:00
parent 4ffa0fbc13
commit 1ea3cb1c61
2 changed files with 9 additions and 7 deletions

View File

@@ -774,10 +774,10 @@ compare_main_nic_ip() {
if ! [[ $MNIC =~ ^(tun|wg|vpn).*$ ]]; then if ! [[ $MNIC =~ ^(tun|wg|vpn).*$ ]]; then
if [[ "$MAINIP" != "$MNIC_IP" ]]; then if [[ "$MAINIP" != "$MNIC_IP" ]]; then
read -r -d '' message <<- EOM 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. This is not a supported configuration, please remediate and rerun setup.
EOM EOM
whiptail --title "Security Onion Setup" --msgbox "$message" 10 75 whiptail --title "Security Onion Setup" --msgbox "$message" 10 75
kill -SIGINT "$(ps --pid $$ -oppid=)"; exit 1 kill -SIGINT "$(ps --pid $$ -oppid=)"; exit 1
fi fi
@@ -1719,9 +1719,11 @@ network_init() {
if [[ "$setup_type" == 'iso' ]]; then if [[ "$setup_type" == 'iso' ]]; then
set_management_interface set_management_interface
fi 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 # Check if the proxy variable was set then set proxy for various apps if so
if [[ -n "$so_proxy" ]]; then if [[ -n "$so_proxy" ]]; then
set_proxy set_proxy >> $setup_log 2>&1
fi fi
} }
@@ -2235,6 +2237,8 @@ set_proxy() {
echo "export no_proxy=\"${no_proxy_string}\"" echo "export no_proxy=\"${no_proxy_string}\""
} >> "$profile_d_config_file" } >> "$profile_d_config_file"
[[ -d '/etc/systemd/system/docker.service.d' ]] || mkdir -p '/etc/systemd/system/docker.service.d'
# Create proxy config for dockerd # Create proxy config for dockerd
printf '%s\n'\ printf '%s\n'\
"[Service]"\ "[Service]"\
@@ -2243,7 +2247,7 @@ set_proxy() {
"Environment=\"NO_PROXY=${no_proxy_string}\"" > /etc/systemd/system/docker.service.d/http-proxy.conf "Environment=\"NO_PROXY=${no_proxy_string}\"" > /etc/systemd/system/docker.service.d/http-proxy.conf
systemctl daemon-reload systemctl daemon-reload
systemctl restart docker command -v docker &> /dev/null && systemctl restart docker
# Set proxy for package manager # Set proxy for package manager
if [ "$OS" = 'centos' ]; then if [ "$OS" = 'centos' ]; then

View File

@@ -537,9 +537,7 @@ catch() {
exit exit
} }
# This block sets REDIRECTIT which is used by a function outside the below subshell # Set REDIRECTIT variable, which is used by a function outside the below subshell
set_main_ip >> $setup_log 2>&1
compare_main_nic_ip
set_redirect >> $setup_log 2>&1 set_redirect >> $setup_log 2>&1
# Begin install # Begin install