mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
Merge pull request #10070 from Security-Onion-Solutions/fix/cloud_test
Fix cloud sniffing interface configuration
This commit is contained in:
@@ -54,33 +54,37 @@ add_interface_bond0() {
|
|||||||
ethtool -K "$BNIC" $i off &>/dev/null
|
ethtool -K "$BNIC" $i off &>/dev/null
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
# Check if the bond slave connection has already been created
|
|
||||||
nmcli -f name,uuid -p con | grep -q "bond0-slave-$BNIC"
|
|
||||||
local found_int=$?
|
|
||||||
|
|
||||||
if [[ $found_int != 0 ]]; then
|
if ! [[ $is_cloud ]]; then
|
||||||
# Create the slave interface and assign it to the bond
|
# Check if the bond slave connection has already been created
|
||||||
nmcli con add type ethernet ifname "$BNIC" con-name "bond0-slave-$BNIC" master bond0 -- \
|
nmcli -f name,uuid -p con | grep -q "bond0-slave-$BNIC"
|
||||||
ethernet.mtu "$MTU" \
|
local found_int=$?
|
||||||
connection.autoconnect "yes"
|
|
||||||
else
|
|
||||||
local int_uuid
|
|
||||||
int_uuid=$(nmcli -f name,uuid -p con | sed -n "s/bond0-slave-$BNIC //p" | tr -d ' ')
|
|
||||||
|
|
||||||
nmcli con mod "$int_uuid" \
|
if [[ $found_int != 0 ]]; then
|
||||||
ethernet.mtu "$MTU" \
|
# Create the slave interface and assign it to the bond
|
||||||
connection.autoconnect "yes"
|
nmcli con add type ethernet ifname "$BNIC" con-name "bond0-slave-$BNIC" master bond0 -- \
|
||||||
fi
|
ethernet.mtu "$MTU" \
|
||||||
|
connection.autoconnect "yes"
|
||||||
|
else
|
||||||
|
local int_uuid
|
||||||
|
int_uuid=$(nmcli -f name,uuid -p con | sed -n "s/bond0-slave-$BNIC //p" | tr -d ' ')
|
||||||
|
|
||||||
|
nmcli con mod "$int_uuid" \
|
||||||
|
ethernet.mtu "$MTU" \
|
||||||
|
connection.autoconnect "yes"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
ip link set dev "$BNIC" arp off multicast off allmulticast off promisc on
|
ip link set dev "$BNIC" arp off multicast off allmulticast off promisc on
|
||||||
|
|
||||||
# Bring the slave interface up
|
if ! [[ $is_cloud ]]; then
|
||||||
if [[ $verbose == true ]]; then
|
# Bring the slave interface up
|
||||||
nmcli con up "bond0-slave-$BNIC"
|
if [[ $verbose == true ]]; then
|
||||||
else
|
nmcli con up "bond0-slave-$BNIC"
|
||||||
nmcli con up "bond0-slave-$BNIC" &>/dev/null
|
else
|
||||||
|
nmcli con up "bond0-slave-$BNIC" &>/dev/null
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$nic_error" != 0 ]; then
|
if [ "$nic_error" != 0 ]; then
|
||||||
return "$nic_error"
|
return "$nic_error"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -802,9 +802,11 @@ compare_main_nic_ip() {
|
|||||||
configure_network_sensor() {
|
configure_network_sensor() {
|
||||||
info "Setting up sensor interface"
|
info "Setting up sensor interface"
|
||||||
|
|
||||||
if [[ $is_cloud ]]; then
|
if [[ $is_cloud ]]; then
|
||||||
|
info "Configuring traditional interface settings, since this is a cloud installation..."
|
||||||
local nmcli_con_args=( "type" "ethernet" )
|
local nmcli_con_args=( "type" "ethernet" )
|
||||||
else
|
else
|
||||||
|
info "Configuring bond interface settings, since this is a not a cloud installation..."
|
||||||
local nmcli_con_args=( "type" "bond" "mode" "0" )
|
local nmcli_con_args=( "type" "bond" "mode" "0" )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -909,7 +911,7 @@ create_repo() {
|
|||||||
|
|
||||||
detect_cloud() {
|
detect_cloud() {
|
||||||
info "Testing if setup is running on a cloud instance..."
|
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() {
|
detect_os() {
|
||||||
@@ -1247,11 +1249,12 @@ generate_interface_vars() {
|
|||||||
export MTU
|
export MTU
|
||||||
|
|
||||||
# Set interface variable
|
# Set interface variable
|
||||||
if [[ $is_cloud ]]; then
|
if [[ $is_cloud ]]; then
|
||||||
INTERFACE=${BNICS[0]}
|
INTERFACE=${BNICS[0]}
|
||||||
else
|
else
|
||||||
INTERFACE='bond0'
|
INTERFACE='bond0'
|
||||||
fi
|
fi
|
||||||
|
info "Interface set to $INTERFACE"
|
||||||
export INTERFACE
|
export INTERFACE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -566,7 +566,7 @@ if ! [[ -f $install_opt_file ]]; then
|
|||||||
export NODE_DESCRIPTION=$NODE_DESCRIPTION
|
export NODE_DESCRIPTION=$NODE_DESCRIPTION
|
||||||
export MAINIP=$MAINIP
|
export MAINIP=$MAINIP
|
||||||
export PATCHSCHEDULENAME=$PATCHSCHEDULENAME
|
export PATCHSCHEDULENAME=$PATCHSCHEDULENAME
|
||||||
export INTERFACE="bond0"
|
export INTERFACE=$INTERFACE
|
||||||
export CORECOUNT=$lb_procs
|
export CORECOUNT=$lb_procs
|
||||||
export LSHOSTNAME=$HOSTNAME
|
export LSHOSTNAME=$HOSTNAME
|
||||||
export LSHEAP=$LS_HEAP_SIZE
|
export LSHEAP=$LS_HEAP_SIZE
|
||||||
|
|||||||
Reference in New Issue
Block a user