Skip to content

Commit

Permalink
Fix loop over array in bash remediation
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusburghardt committed Oct 20, 2022
1 parent ba293d7 commit b68020f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if firewall-cmd --state -q; then

# If the connection is not yet assigned to a firewalld zone, assign it to the proper zone.
# This will not change connections which are already assigned to any firewalld zone.
for connection in $nm_connections; do
for connection in "${nm_connections[@]}"; do
current_zone=$(nmcli -f connection.zone connection show "$connection" | awk '{ print $2}')
if [ $current_zone = "--" ]; then
nmcli connection modify "$connection" connection.zone $firewalld_sshd_zone
Expand All @@ -38,7 +38,7 @@ if firewall-cmd --state -q; then
# It is possible that traffic is comming by any active interface and consequently any
# active zone. So, this make sure all active zones are permanently allowing SSH service.
readarray -t firewalld_active_zones < <(firewall-cmd --get-active-zones | grep -v interfaces)
for zone in $firewalld_active_zones; do
for zone in "${firewalld_active_zones[@]}"; do
firewall-cmd --permanent --zone="$zone" --add-service=ssh
done
firewall-cmd --reload
Expand Down

0 comments on commit b68020f

Please sign in to comment.