From 8a8885e14f439579d360e638d1c53130b0c42457 Mon Sep 17 00:00:00 2001 From: William Wernert Date: Mon, 30 Nov 2020 16:53:02 -0500 Subject: [PATCH] [feat] Verify that main ip = mngmt ip * Add a check to check whether the src ip in the routing table is also the ip assigned to the management nic --- setup/so-functions | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/setup/so-functions b/setup/so-functions index 4ba639fa5..e685d6940 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -1710,6 +1710,17 @@ set_network_dev_status_list() { set_main_ip() { MAINIP=$(ip route get 1 | awk '{print $7;exit}') + MNIC_IP=$(ip a s "$MNIC" | grep -oE 'inet [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d' ' -f) + + 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). + + This is not a supported configuration, please remediate and rerun setup. + EOM + whiptail --title "Security Onion Setup" --msgbox "$message" 10 75 + exit 1 + fi } # Add /usr/sbin to everyone's path