mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-05-06 19:38:51 +02:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3e49322220 | |||
| ecb92d43fc | |||
| 3b714db0bf | |||
| f17da4e68b | |||
| 77a4ad877e | |||
| 702b3585cc | |||
| 86966d2778 | |||
| ce3ad3a895 | |||
| 39d0947102 | |||
| 0085d9a353 | |||
| 2f01ce3b23 | |||
| 71b19c1b5f | |||
| 82f70bb53a | |||
| 2dcded6cca |
@@ -227,7 +227,7 @@ if [[ $EXCLUDE_KNOWN_ERRORS == 'Y' ]]; then
|
|||||||
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|from NIC checksum offloading" # zeek reporter.log
|
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|from NIC checksum offloading" # zeek reporter.log
|
||||||
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|marked for removal" # docker container getting recycled
|
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|marked for removal" # docker container getting recycled
|
||||||
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|tcp 127.0.0.1:6791: bind: address already in use" # so-elastic-fleet agent restarting. Seen starting w/ 8.18.8 https://github.com/elastic/kibana/issues/201459
|
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|tcp 127.0.0.1:6791: bind: address already in use" # so-elastic-fleet agent restarting. Seen starting w/ 8.18.8 https://github.com/elastic/kibana/issues/201459
|
||||||
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|TransformTask\] \[logs-(tychon|aws_billing|microsoft_defender_endpoint|armis|o365_metrics|microsoft_sentinel|snyk).*user so_kibana lacks the required permissions \[(logs|metrics)-\1" # Known issue with integrations starting transform jobs that are explicitly not allowed to start as a system user. (installed as so_elastic / so_kibana)
|
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|TransformTask\] \[logs-(tychon|aws_billing|microsoft_defender_endpoint|armis|o365_metrics|microsoft_sentinel|snyk|cyera|island_browser).*user so_kibana lacks the required permissions \[(logs|metrics)-\1" # Known issue with integrations starting transform jobs that are explicitly not allowed to start as a system user. This error should not be seen on fresh ES 9.3.3 installs or after SO 3.1.0 with soups addition of check_transform_health_and_reauthorize()
|
||||||
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|manifest unknown" # appears in so-dockerregistry log for so-tcpreplay following docker upgrade to 29.2.1-1
|
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|manifest unknown" # appears in so-dockerregistry log for so-tcpreplay following docker upgrade to 29.2.1-1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -18,17 +18,6 @@ so-elastic-fleet-auto-configure-logstash-outputs:
|
|||||||
- retry:
|
- retry:
|
||||||
attempts: 4
|
attempts: 4
|
||||||
interval: 30
|
interval: 30
|
||||||
|
|
||||||
{# Separate from above in order to catch elasticfleet-logstash.crt changes and force update to fleet output policy #}
|
|
||||||
so-elastic-fleet-auto-configure-logstash-outputs-force:
|
|
||||||
cmd.run:
|
|
||||||
- name: /usr/sbin/so-elastic-fleet-outputs-update --certs
|
|
||||||
- retry:
|
|
||||||
attempts: 4
|
|
||||||
interval: 30
|
|
||||||
- onchanges:
|
|
||||||
- x509: etc_elasticfleet_logstash_crt
|
|
||||||
- x509: elasticfleet_kafka_crt
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
# If enabled, automatically update Fleet Server URLs & ES Connection
|
# If enabled, automatically update Fleet Server URLs & ES Connection
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ elastic_fleet_policy_create() {
|
|||||||
--arg DESC "$DESC" \
|
--arg DESC "$DESC" \
|
||||||
--arg TIMEOUT $TIMEOUT \
|
--arg TIMEOUT $TIMEOUT \
|
||||||
--arg FLEETSERVER "$FLEETSERVER" \
|
--arg FLEETSERVER "$FLEETSERVER" \
|
||||||
'{"name": $NAME,"id":$NAME,"description":$DESC,"namespace":"default","monitoring_enabled":["logs"],"inactivity_timeout":$TIMEOUT,"has_fleet_server":$FLEETSERVER}'
|
'{"name": $NAME,"id":$NAME,"description":$DESC,"namespace":"default","monitoring_enabled":["logs"],"inactivity_timeout":$TIMEOUT,"has_fleet_server":$FLEETSERVER,"advanced_settings":{"agent_logging_level": "warning"}}'
|
||||||
)
|
)
|
||||||
# Create Fleet Policy
|
# Create Fleet Policy
|
||||||
if ! fleet_api "agent_policies" -XPOST -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d "$JSON_STRING"; then
|
if ! fleet_api "agent_policies" -XPOST -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d "$JSON_STRING"; then
|
||||||
|
|||||||
@@ -485,6 +485,130 @@ elasticsearch_backup_index_templates() {
|
|||||||
tar -czf /nsm/backup/3.0.0_elasticsearch_index_templates.tar.gz -C /opt/so/conf/elasticsearch/templates/index/ .
|
tar -czf /nsm/backup/3.0.0_elasticsearch_index_templates.tar.gz -C /opt/so/conf/elasticsearch/templates/index/ .
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elasticfleet_set_agent_logging_level_warn() {
|
||||||
|
. /usr/sbin/so-elastic-fleet-common
|
||||||
|
|
||||||
|
local current_agent_policies
|
||||||
|
if ! current_agent_policies=$(fleet_api "agent_policies?perPage=1000"); then
|
||||||
|
echo "Warning: unable to retrieve Fleet agent policies"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Only updating policies that are within Security Onion defaults and do not already have any user configured advanced_settings.
|
||||||
|
local policies_to_update
|
||||||
|
policies_to_update=$(jq -c '
|
||||||
|
.items[]
|
||||||
|
| select(has("advanced_settings") | not)
|
||||||
|
| select(
|
||||||
|
.id == "so-grid-nodes_general"
|
||||||
|
or .id == "so-grid-nodes_heavy"
|
||||||
|
or .id == "endpoints-initial"
|
||||||
|
or (.id | startswith("FleetServer_"))
|
||||||
|
)
|
||||||
|
' <<< "$current_agent_policies")
|
||||||
|
|
||||||
|
if [[ -z "$policies_to_update" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
while IFS= read -r policy; do
|
||||||
|
[[ -z "$policy" ]] && continue
|
||||||
|
|
||||||
|
local policy_id policy_name policy_namespace
|
||||||
|
policy_id=$(jq -r '.id' <<< "$policy")
|
||||||
|
policy_name=$(jq -r '.name' <<< "$policy")
|
||||||
|
policy_namespace=$(jq -r '.namespace' <<< "$policy")
|
||||||
|
|
||||||
|
local update_logging
|
||||||
|
update_logging=$(jq -n \
|
||||||
|
--arg name "$policy_name" \
|
||||||
|
--arg namespace "$policy_namespace" \
|
||||||
|
'{name: $name, namespace: $namespace, advanced_settings: {agent_logging_level: "warning"}}'
|
||||||
|
)
|
||||||
|
|
||||||
|
echo "Setting elastic agent_logging_level to warning on policy '$policy_name' ($policy_id)."
|
||||||
|
if ! fleet_api "agent_policies/$policy_id" -XPUT -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d "$update_logging" >/dev/null; then
|
||||||
|
echo " warning: failed to update agent policy '$policy_name' ($policy_id)" >&2
|
||||||
|
fi
|
||||||
|
done <<< "$policies_to_update"
|
||||||
|
}
|
||||||
|
|
||||||
|
check_transform_health_and_reauthorize() {
|
||||||
|
. /usr/sbin/so-elastic-fleet-common
|
||||||
|
|
||||||
|
echo "Checking integration transform jobs for unhealthy / unauthorized status..."
|
||||||
|
|
||||||
|
local transforms_doc stats_doc installed_doc
|
||||||
|
if ! transforms_doc=$(so-elasticsearch-query "_transform/_all?size=1000" --fail --retry 3 --retry-delay 5 2>/dev/null); then
|
||||||
|
echo "Unable to query for transform jobs, skipping reauthorization."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
if ! stats_doc=$(so-elasticsearch-query "_transform/_all/_stats?size=1000" --fail --retry 3 --retry-delay 5 2>/dev/null); then
|
||||||
|
echo "Unable to query for transform job stats, skipping reauthorization."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
if ! installed_doc=$(fleet_api "epm/packages/installed?perPage=500"); then
|
||||||
|
echo "Unable to list installed Fleet packages, skipping reauthorization."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get all transforms that meet the following
|
||||||
|
# - unhealthy (any non-green health status)
|
||||||
|
# - metadata has run_as_kibana_system: false (this fix is specific to transforms started prior to Kibana 9.3.3)
|
||||||
|
# - are not orphaned (integration is not somehow missing/corrupt/uninstalled)
|
||||||
|
local unhealthy_transforms
|
||||||
|
unhealthy_transforms=$(jq -c -n \
|
||||||
|
--argjson t "$transforms_doc" \
|
||||||
|
--argjson s "$stats_doc" \
|
||||||
|
--argjson i "$installed_doc" '
|
||||||
|
($i.items | map({key: .name, value: .version}) | from_entries) as $pkg_ver
|
||||||
|
| ($s.transforms | map({key: .id, value: .health.status}) | from_entries) as $health
|
||||||
|
| [ $t.transforms[]
|
||||||
|
| select(._meta.run_as_kibana_system == false)
|
||||||
|
| select(($health[.id] // "unknown") != "green")
|
||||||
|
| {id, pkg: ._meta.package.name, ver: ($pkg_ver[._meta.package.name])}
|
||||||
|
]
|
||||||
|
| if length == 0 then empty else . end
|
||||||
|
| (map(select(.ver == null)) | map({orphan: .id})[]),
|
||||||
|
(map(select(.ver != null))
|
||||||
|
| group_by(.pkg)
|
||||||
|
| map({pkg: .[0].pkg, ver: .[0].ver, transformIds: map(.id)})[])
|
||||||
|
')
|
||||||
|
|
||||||
|
if [[ -z "$unhealthy_transforms" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
local unhealthy_count
|
||||||
|
unhealthy_count=$(jq -s '[.[].transformIds? // empty | .[]] | length' <<< "$unhealthy_transforms")
|
||||||
|
echo "Found $unhealthy_count transform(s) needing reauthorization."
|
||||||
|
|
||||||
|
local total_failures=0
|
||||||
|
while IFS= read -r transform; do
|
||||||
|
[[ -z "$transform" ]] && continue
|
||||||
|
if jq -e 'has("orphan")' <<< "$transform" >/dev/null 2>&1; then
|
||||||
|
echo "Skipping transform not owned by any installed Fleet package: $(jq -r '.orphan' <<< "$transform")"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
local pkg ver body resp
|
||||||
|
pkg=$(jq -r '.pkg' <<< "$transform")
|
||||||
|
ver=$(jq -r '.ver' <<< "$transform")
|
||||||
|
body=$(jq -c '{transforms: (.transformIds | map({transformId: .}))}' <<< "$transform")
|
||||||
|
|
||||||
|
echo "Reauthorizing transform(s) for ${pkg}-${ver}..."
|
||||||
|
resp=$(fleet_api "epm/packages/${pkg}/${ver}/transforms/authorize" \
|
||||||
|
-XPOST -H 'kbn-xsrf: true' -H 'Content-Type: application/json' \
|
||||||
|
-d "$body") || { echo "Could not reauthorize transform(s) for ${pkg}-${ver}"; continue; }
|
||||||
|
|
||||||
|
(( total_failures += $(jq 'map(select(.success != true)) | length' <<< "$resp" 2>/dev/null) ))
|
||||||
|
done <<< "$unhealthy_transforms"
|
||||||
|
|
||||||
|
if [[ "$total_failures" -gt 0 ]]; then
|
||||||
|
echo "Some transform(s) failed to reauthorize."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
ensure_postgres_local_pillar() {
|
ensure_postgres_local_pillar() {
|
||||||
# Postgres was added as a service after 3.0.0, so the new pillar/top.sls
|
# Postgres was added as a service after 3.0.0, so the new pillar/top.sls
|
||||||
# references postgres.soc_postgres / postgres.adv_postgres unconditionally.
|
# references postgres.soc_postgres / postgres.adv_postgres unconditionally.
|
||||||
@@ -553,6 +677,12 @@ post_to_3.1.0() {
|
|||||||
# file_roots of its own and --local would fail with "No matching sls found".
|
# file_roots of its own and --local would fail with "No matching sls found".
|
||||||
salt-call state.apply postgres.telegraf_users queue=True || true
|
salt-call state.apply postgres.telegraf_users queue=True || true
|
||||||
|
|
||||||
|
# Update default agent policies to use logging level warn.
|
||||||
|
elasticfleet_set_agent_logging_level_warn || true
|
||||||
|
|
||||||
|
# Check for unhealthy / unauthorized integration transform jobs and attempt reauthorizations
|
||||||
|
check_transform_health_and_reauthorize || true
|
||||||
|
|
||||||
POSTVERSION=3.1.0
|
POSTVERSION=3.1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,11 +24,6 @@
|
|||||||
|
|
||||||
{% do SOCDEFAULTS.soc.config.server.modules.elastic.update({'username': GLOBALS.elasticsearch.auth.users.so_elastic_user.user, 'password': GLOBALS.elasticsearch.auth.users.so_elastic_user.pass}) %}
|
{% do SOCDEFAULTS.soc.config.server.modules.elastic.update({'username': GLOBALS.elasticsearch.auth.users.so_elastic_user.user, 'password': GLOBALS.elasticsearch.auth.users.so_elastic_user.pass}) %}
|
||||||
|
|
||||||
{% if GLOBALS.postgres is defined and GLOBALS.postgres.auth is defined %}
|
|
||||||
{% set PG_ADMIN_PASS = salt['pillar.get']('secrets:postgres_pass', '') %}
|
|
||||||
{% do SOCDEFAULTS.soc.config.server.modules.update({'postgres': {'hostUrl': GLOBALS.manager_ip, 'port': 5432, 'username': GLOBALS.postgres.auth.users.so_postgres_user.user, 'password': GLOBALS.postgres.auth.users.so_postgres_user.pass, 'adminUser': 'postgres', 'adminPassword': PG_ADMIN_PASS, 'dbname': 'securityonion', 'sslMode': 'require', 'assistantEnabled': true, 'esHostUrl': 'https://' ~ GLOBALS.manager_ip ~ ':9200', 'esUsername': GLOBALS.elasticsearch.auth.users.so_elastic_user.user, 'esPassword': GLOBALS.elasticsearch.auth.users.so_elastic_user.pass, 'esVerifyCert': false}}) %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% do SOCDEFAULTS.soc.config.server.modules.influxdb.update({'hostUrl': 'https://' ~ GLOBALS.influxdb_host ~ ':8086'}) %}
|
{% do SOCDEFAULTS.soc.config.server.modules.influxdb.update({'hostUrl': 'https://' ~ GLOBALS.influxdb_host ~ ':8086'}) %}
|
||||||
{% do SOCDEFAULTS.soc.config.server.modules.influxdb.update({'token': INFLUXDB_TOKEN}) %}
|
{% do SOCDEFAULTS.soc.config.server.modules.influxdb.update({'token': INFLUXDB_TOKEN}) %}
|
||||||
{% for tool in SOCDEFAULTS.soc.config.server.client.tools %}
|
{% for tool in SOCDEFAULTS.soc.config.server.client.tools %}
|
||||||
|
|||||||
+61
-2
@@ -745,6 +745,56 @@ configure_network_sensor() {
|
|||||||
return $err
|
return $err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configure_management_bond() {
|
||||||
|
local bond_name="bond1"
|
||||||
|
local bond_mode=${MBOND_MODE:-active-backup}
|
||||||
|
|
||||||
|
info "Setting up $bond_name management interface with mode $bond_mode"
|
||||||
|
|
||||||
|
if [[ ${#MBNICS[@]} -eq 0 ]]; then
|
||||||
|
error "[ERROR] No management bond NICs were selected."
|
||||||
|
fail_setup
|
||||||
|
fi
|
||||||
|
|
||||||
|
nmcli -t -f NAME con show | grep -Fxq "$bond_name"
|
||||||
|
local found_int=$?
|
||||||
|
|
||||||
|
if [[ $found_int != 0 ]]; then
|
||||||
|
nmcli con add type bond ifname "$bond_name" con-name "$bond_name" mode "$bond_mode" -- \
|
||||||
|
ipv6.method ignore \
|
||||||
|
connection.autoconnect yes >> "$setup_log" 2>&1
|
||||||
|
else
|
||||||
|
nmcli con mod "$bond_name" \
|
||||||
|
bond.options "mode=$bond_mode" \
|
||||||
|
ipv6.method ignore \
|
||||||
|
connection.autoconnect yes >> "$setup_log" 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local err=0
|
||||||
|
for MBNIC in "${MBNICS[@]}"; do
|
||||||
|
local slave_name="$bond_name-slave-$MBNIC"
|
||||||
|
|
||||||
|
nmcli -t -f NAME con show | grep -Fxq "$slave_name"
|
||||||
|
found_int=$?
|
||||||
|
|
||||||
|
if [[ $found_int != 0 ]]; then
|
||||||
|
nmcli con add type ethernet ifname "$MBNIC" con-name "$slave_name" master "$bond_name" -- \
|
||||||
|
connection.autoconnect yes >> "$setup_log" 2>&1
|
||||||
|
else
|
||||||
|
nmcli con mod "$slave_name" \
|
||||||
|
connection.master "$bond_name" \
|
||||||
|
connection.slave-type bond \
|
||||||
|
connection.autoconnect yes >> "$setup_log" 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
nmcli con up "$slave_name" >> "$setup_log" 2>&1
|
||||||
|
local ret=$?
|
||||||
|
[[ $ret -eq 0 ]] || err=$ret
|
||||||
|
done
|
||||||
|
|
||||||
|
return $err
|
||||||
|
}
|
||||||
|
|
||||||
configure_hyper_bridge() {
|
configure_hyper_bridge() {
|
||||||
info "Setting up hypervisor bridge"
|
info "Setting up hypervisor bridge"
|
||||||
info "Checking $MNIC ipv4.method is auto or manual"
|
info "Checking $MNIC ipv4.method is auto or manual"
|
||||||
@@ -999,6 +1049,11 @@ filter_unused_nics() {
|
|||||||
grep_string="$grep_string\|$BONDNIC"
|
grep_string="$grep_string\|$BONDNIC"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
if [[ $MBNICS ]]; then
|
||||||
|
for BONDNIC in "${MBNICS[@]}"; do
|
||||||
|
grep_string="$grep_string\|$BONDNIC"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Finally, set filtered_nics to any NICs we aren't using (and ignore interfaces that aren't of use)
|
# Finally, set filtered_nics to any NICs we aren't using (and ignore interfaces that aren't of use)
|
||||||
filtered_nics=$(ip link | awk -F: '$0 !~ "lo|vir|veth|br|docker|wl|^[^0-9]"{print $2}' | grep -vwe "$grep_string" | sed 's/ //g' | sed -r 's/(.*)(\.[0-9]+)@\1/\1\2/g')
|
filtered_nics=$(ip link | awk -F: '$0 !~ "lo|vir|veth|br|docker|wl|^[^0-9]"{print $2}' | grep -vwe "$grep_string" | sed 's/ //g' | sed -r 's/(.*)(\.[0-9]+)@\1/\1\2/g')
|
||||||
@@ -1388,7 +1443,7 @@ network_init() {
|
|||||||
title "Initializing Network"
|
title "Initializing Network"
|
||||||
disable_ipv6
|
disable_ipv6
|
||||||
set_hostname
|
set_hostname
|
||||||
if [[ ( $is_iso || $is_desktop_iso ) ]]; then
|
if [[ $is_iso || $is_desktop_iso ]]; then
|
||||||
set_management_interface
|
set_management_interface
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -2084,8 +2139,12 @@ set_initial_firewall_access() {
|
|||||||
# Set up the management interface on the ISO
|
# Set up the management interface on the ISO
|
||||||
set_management_interface() {
|
set_management_interface() {
|
||||||
title "Setting up the main interface"
|
title "Setting up the main interface"
|
||||||
|
if [[ $MNIC == "bond1" ]]; then
|
||||||
|
configure_management_bond || fail_setup
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$address_type" = 'DHCP' ]; then
|
if [ "$address_type" = 'DHCP' ]; then
|
||||||
logCmd "nmcli con mod $MNIC connection.autoconnect yes"
|
logCmd "nmcli con mod $MNIC connection.autoconnect yes ipv4.method auto"
|
||||||
logCmd "nmcli con up $MNIC"
|
logCmd "nmcli con up $MNIC"
|
||||||
logCmd "nmcli -p connection show $MNIC"
|
logCmd "nmcli -p connection show $MNIC"
|
||||||
else
|
else
|
||||||
|
|||||||
+83
-2
@@ -845,18 +845,99 @@ whiptail_management_nic() {
|
|||||||
[ -n "$TESTING" ] && return
|
[ -n "$TESTING" ] && return
|
||||||
|
|
||||||
filter_unused_nics
|
filter_unused_nics
|
||||||
|
local management_nic_options=( "${nic_list_management[@]}" )
|
||||||
|
if [[ $is_iso || $is_desktop_iso ]]; then
|
||||||
|
management_nic_options+=( "BOND" "Configure a bonded management interface" )
|
||||||
|
fi
|
||||||
|
|
||||||
MNIC=$(whiptail --title "$whiptail_title" --menu "Please select the NIC you would like to use for management.\n\nUse the arrow keys to move around and the Enter key to select." 20 75 12 "${nic_list_management[@]}" 3>&1 1>&2 2>&3 )
|
MNIC=$(whiptail --title "$whiptail_title" --menu "Please select the NIC you would like to use for management.\n\nUse the arrow keys to move around and the Enter key to select." 20 75 12 "${management_nic_options[@]}" 3>&1 1>&2 2>&3 )
|
||||||
local exitstatus=$?
|
local exitstatus=$?
|
||||||
whiptail_check_exitstatus $exitstatus
|
whiptail_check_exitstatus $exitstatus
|
||||||
|
|
||||||
while [ -z "$MNIC" ]
|
while [ -z "$MNIC" ]
|
||||||
do
|
do
|
||||||
MNIC=$(whiptail --title "$whiptail_title" --menu "Please select the NIC you would like to use for management.\n\nUse the arrow keys to move around and the Enter key to select." 22 75 12 "${nic_list_management[@]}" 3>&1 1>&2 2>&3 )
|
MNIC=$(whiptail --title "$whiptail_title" --menu "Please select the NIC you would like to use for management.\n\nUse the arrow keys to move around and the Enter key to select." 22 75 12 "${management_nic_options[@]}" 3>&1 1>&2 2>&3 )
|
||||||
local exitstatus=$?
|
local exitstatus=$?
|
||||||
whiptail_check_exitstatus $exitstatus
|
whiptail_check_exitstatus $exitstatus
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ $MNIC == "BOND" ]]; then
|
||||||
|
whiptail_management_bond
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
whiptail_management_bond() {
|
||||||
|
|
||||||
|
[ -n "$TESTING" ] && return
|
||||||
|
|
||||||
|
MBOND_MODE=$(whiptail --title "$whiptail_title" --menu \
|
||||||
|
"Choose the bond mode for the management interface.\n\nThe management bond will be created as bond1." 20 75 7 \
|
||||||
|
"active-backup" "One active NIC with failover (recommended)" \
|
||||||
|
"balance-rr" "Round-robin transmit policy" \
|
||||||
|
"balance-xor" "Transmit based on selected hash policy" \
|
||||||
|
"broadcast" "Transmit everything on all slave interfaces" \
|
||||||
|
"802.3ad" "Dynamic link aggregation (requires switch support)" \
|
||||||
|
"balance-tlb" "Adaptive transmit load balancing" \
|
||||||
|
"balance-alb" "Adaptive load balancing" 3>&1 1>&2 2>&3)
|
||||||
|
local exitstatus=$?
|
||||||
|
whiptail_check_exitstatus $exitstatus
|
||||||
|
|
||||||
|
while [ -z "$MBOND_MODE" ]
|
||||||
|
do
|
||||||
|
MBOND_MODE=$(whiptail --title "$whiptail_title" --menu \
|
||||||
|
"Choose the bond mode for the management interface.\n\nThe management bond will be created as bond1." 20 75 7 \
|
||||||
|
"active-backup" "One active NIC with failover (recommended)" \
|
||||||
|
"balance-rr" "Round-robin transmit policy" \
|
||||||
|
"balance-xor" "Transmit based on selected hash policy" \
|
||||||
|
"broadcast" "Transmit everything on all slave interfaces" \
|
||||||
|
"802.3ad" "Dynamic link aggregation (requires switch support)" \
|
||||||
|
"balance-tlb" "Adaptive transmit load balancing" \
|
||||||
|
"balance-alb" "Adaptive load balancing" 3>&1 1>&2 2>&3)
|
||||||
|
local exitstatus=$?
|
||||||
|
whiptail_check_exitstatus $exitstatus
|
||||||
|
done
|
||||||
|
|
||||||
|
whiptail_management_bond_nics
|
||||||
|
MNIC="bond1"
|
||||||
|
|
||||||
|
export MBOND_MODE MNIC
|
||||||
|
}
|
||||||
|
|
||||||
|
whiptail_management_bond_nics() {
|
||||||
|
|
||||||
|
[ -n "$TESTING" ] && return
|
||||||
|
|
||||||
|
MBNICS=()
|
||||||
|
filter_unused_nics
|
||||||
|
|
||||||
|
MBNICS=$(whiptail --title "$whiptail_title" --checklist "Please add NICs to the Management Interface:" 20 75 12 "${nic_list[@]}" 3>&1 1>&2 2>&3)
|
||||||
|
local exitstatus=$?
|
||||||
|
whiptail_check_exitstatus $exitstatus
|
||||||
|
|
||||||
|
while [ -z "$MBNICS" ]
|
||||||
|
do
|
||||||
|
MBNICS=$(whiptail --title "$whiptail_title" --checklist "Please add NICs to the Management Interface:" 20 75 12 "${nic_list[@]}" 3>&1 1>&2 2>&3)
|
||||||
|
local exitstatus=$?
|
||||||
|
whiptail_check_exitstatus $exitstatus
|
||||||
|
done
|
||||||
|
|
||||||
|
MBNICS=$(echo "$MBNICS" | tr -d '"')
|
||||||
|
|
||||||
|
IFS=' ' read -ra MBNICS <<< "$MBNICS"
|
||||||
|
|
||||||
|
for bond_nic in "${MBNICS[@]}"; do
|
||||||
|
for dev_status in "${nmcli_dev_status_list[@]}"; do
|
||||||
|
if [[ $dev_status == "${bond_nic}:unmanaged" ]]; then
|
||||||
|
whiptail \
|
||||||
|
--title "$whiptail_title" \
|
||||||
|
--msgbox "$bond_nic is unmanaged by Network Manager. Please remove it from other network management tools then re-run setup." \
|
||||||
|
8 75
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
export MBNICS
|
||||||
}
|
}
|
||||||
|
|
||||||
whiptail_net_method() {
|
whiptail_net_method() {
|
||||||
|
|||||||
Reference in New Issue
Block a user