2b6434e8793a876e5465edd9c75819166878aba6

Author
Konstantin Gribov <grossws@gmail.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Fixed `fwl` function in `firewalld` plugin when `sources` used (#7011)

`firewall-cmd --get-active-zones` returns something like this:

```
dmz
  sources: ipset:dmz-hosts
public
  interfaces: eth0
```

if zone binding is based on source ips, so strings with `sources: ...` should be excluded along with `interfaces: ...` to get zones list.

Diff

 1diff --git a/plugins/firewalld/firewalld.plugin.zsh b/plugins/firewalld/firewalld.plugin.zsh
 2index bfbf6f48fd58102698305b1bda69001934c4f7a8..5b1090636c7a367948f3ce4f245f30170be2229f 100644
 3--- a/plugins/firewalld/firewalld.plugin.zsh
 4+++ b/plugins/firewalld/firewalld.plugin.zsh
 5@@ -6,7 +6,7 @@ alias fwrp="sudo firewall-cmd --runtime-to-permanent"
 6 function fwl () {
 7   # converts output to zsh array ()
 8   # @f flag split on new line
 9-  zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v interfaces)}")
10+  zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v 'interfaces\|sources')}")
11 
12   for i in $zones; do
13     sudo firewall-cmd --zone $i --list-all