Merge pull request #10070 from Security-Onion-Solutions/fix/cloud_test

Fix cloud sniffing interface configuration
This commit is contained in:
weslambert
2023-03-30 14:41:59 -04:00
committed by GitHub
3 changed files with 33 additions and 26 deletions

View File

@@ -54,6 +54,8 @@ add_interface_bond0() {
ethtool -K "$BNIC" $i off &>/dev/null
fi
done
if ! [[ $is_cloud ]]; then
# Check if the bond slave connection has already been created
nmcli -f name,uuid -p con | grep -q "bond0-slave-$BNIC"
local found_int=$?
@@ -71,16 +73,18 @@ add_interface_bond0() {
ethernet.mtu "$MTU" \
connection.autoconnect "yes"
fi
fi
ip link set dev "$BNIC" arp off multicast off allmulticast off promisc on
if ! [[ $is_cloud ]]; then
# Bring the slave interface up
if [[ $verbose == true ]]; then
nmcli con up "bond0-slave-$BNIC"
else
nmcli con up "bond0-slave-$BNIC" &>/dev/null
fi
fi
if [ "$nic_error" != 0 ]; then
return "$nic_error"
fi

View File

@@ -803,8 +803,10 @@ configure_network_sensor() {
info "Setting up sensor interface"
if [[ $is_cloud ]]; then
info "Configuring traditional interface settings, since this is a cloud installation..."
local nmcli_con_args=( "type" "ethernet" )
else
info "Configuring bond interface settings, since this is a not a cloud installation..."
local nmcli_con_args=( "type" "bond" "mode" "0" )
fi
@@ -909,7 +911,7 @@ create_repo() {
detect_cloud() {
info "Testing if setup is running on a cloud instance..."
if ( curl --fail -s -m 5 http://169.254.169.254/latest/meta-data/instance-id > /dev/null ) || ( dmidecode -s bios-vendor | grep -q Google > /dev/null) || [ -f /var/log/waagent.log ]; then export is_cloud="true"; fi
if ( curl --fail -s -m 5 http://169.254.169.254/latest/meta-data/instance-id > /dev/null ) || ( dmidecode -s bios-vendor | grep -q Google > /dev/null) || [ -f /var/log/waagent.log ]; then info "Detected a cloud installation..." && export is_cloud="true"; fi
}
detect_os() {
@@ -1252,6 +1254,7 @@ generate_interface_vars() {
else
INTERFACE='bond0'
fi
info "Interface set to $INTERFACE"
export INTERFACE
}

View File

@@ -566,7 +566,7 @@ if ! [[ -f $install_opt_file ]]; then
export NODE_DESCRIPTION=$NODE_DESCRIPTION
export MAINIP=$MAINIP
export PATCHSCHEDULENAME=$PATCHSCHEDULENAME
export INTERFACE="bond0"
export INTERFACE=$INTERFACE
export CORECOUNT=$lb_procs
export LSHOSTNAME=$HOSTNAME
export LSHEAP=$LS_HEAP_SIZE