mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-08 10:12:53 +01:00
configure bridge during setup
This commit is contained in:
@@ -742,25 +742,41 @@ configure_network_sensor() {
|
|||||||
|
|
||||||
configure_hyper_bridge() {
|
configure_hyper_bridge() {
|
||||||
info "Setting up hypervisor bridge"
|
info "Setting up hypervisor bridge"
|
||||||
info "Checking $MNIC is using static or DHCP"
|
info "Checking $MNIC ipv4.method is auto or manual"
|
||||||
sod=$(nmcli -f ipv4.method con show $MNIC)
|
ipmethod=$(nmcli -f ipv4.method con show "$MNIC" | cut -d ':' -f 2 | xargs)
|
||||||
|
info "ipv4.method found $ipmethod"
|
||||||
# Create the bond interface only if it doesn't already exist
|
# Create the bond interface only if it doesn't already exist
|
||||||
nmcli -f name,uuid -p con | grep -q br0
|
nmcli -f name,uuid -p con | grep -q br0
|
||||||
local found_int=$?
|
local found_int=$?
|
||||||
|
|
||||||
if [[ $found_int != 0 ]]; then
|
if [[ $found_int != 0 ]]; then
|
||||||
|
info "Creating bridge br0"
|
||||||
nmcli con add ifname br0 type bridge con-name br0 >> "$setup_log" 2>&1
|
nmcli con add ifname br0 type bridge con-name br0 >> "$setup_log" 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# as mgmt interface as slave
|
# add mgmt interface as slave
|
||||||
nmcli con add type bridge-slave ifname "$MNIC" master br0
|
logCmd "nmcli con add type bridge-slave ifname $MNIC master br0"
|
||||||
|
|
||||||
local err=0
|
# if static ip was set transfer settings to the bridge
|
||||||
nmcli con down "$MNIC"
|
if [[ "$ipmethod" == "manual" ]]; then
|
||||||
nmcli con up br0
|
local addresses=$(nmcli -f ipv4.addresses con show "$MNIC" | cut -d ':' -f 2 | xargs)
|
||||||
|
local gateway=$(nmcli -f ipv4.gateway con show "$MNIC" | cut -d ':' -f 2 | xargs)
|
||||||
|
local dns=$(nmcli -f ipv4.dns con show "$MNIC" | cut -d ':' -f 2 | xargs)
|
||||||
|
local dnssearch=$(nmcli -f ipv4.dns-search con show "$MNIC" | cut -d ':' -f 2 | xargs)
|
||||||
|
# will need to check for proxy
|
||||||
|
#local proxy=
|
||||||
|
|
||||||
return $err
|
logCmd "nmcli con mod br0 ipv4.addresses $addresses"
|
||||||
|
logCmd "nmcli con mod br0 ipv4.gateway $gateway"
|
||||||
|
logCmd "nmcli con mod br0 ipv4.dns $dns"
|
||||||
|
logCmd "nmcli con mod br0 ipv4.dns-search $dns-search"
|
||||||
|
logCmd "nmcli con mod br0 ipv4.method manual"
|
||||||
|
logCmd "nmcli con up br0"
|
||||||
|
# we cant bring down MNIC here since it would disrupt ssh sessions. we will need to bring it down at the end of the first highstate
|
||||||
|
# network comms will take place on MNIC until it is brought down and switches to br0
|
||||||
|
fi
|
||||||
|
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_salt_master_config() {
|
copy_salt_master_config() {
|
||||||
|
|||||||
Reference in New Issue
Block a user