Skip to content

Commit

Permalink
firewalld_sshd_port_enabled add zone to all connections
Browse files Browse the repository at this point in the history
  • Loading branch information
mildas committed Aug 1, 2024
1 parent 847ea1a commit 7fcfce3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
block:
- name: '{{{ rule_title }}} - Collect NetworkManager connections names'
ansible.builtin.shell:
cmd: nmcli -f UUID,TYPE con | grep ethernet | awk '{ print $1 }'
cmd: nmcli -g UUID,TYPE con | grep -v loopback | awk -F ':' '{ print $1 }'
register: result_nmcli_cmd_connections_names
changed_when: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ else
firewall-cmd --zone="$firewalld_sshd_zone" --add-service=ssh

# This will collect all NetworkManager connections names
readarray -t nm_connections < <(nmcli -f UUID,TYPE con | grep ethernet | awk '{ print $1 }')
readarray -t nm_connections < <(nmcli -g UUID,TYPE con | grep -v loopback | awk -F ':' '{ print $1 }')
# 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
Expand Down

0 comments on commit 7fcfce3

Please sign in to comment.