浏览代码

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.
Konstantin Gribov 6 年之前
父节点
当前提交
2b6434e879
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      plugins/firewalld/firewalld.plugin.zsh

+ 1 - 1
plugins/firewalld/firewalld.plugin.zsh

@@ -6,7 +6,7 @@ alias fwrp="sudo firewall-cmd --runtime-to-permanent"
 function fwl () {
 function fwl () {
   # converts output to zsh array ()
   # converts output to zsh array ()
   # @f flag split on new line
   # @f flag split on new line
-  zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v interfaces)}")
+  zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v 'interfaces\|sources')}")
 
 
   for i in $zones; do
   for i in $zones; do
     sudo firewall-cmd --zone $i --list-all
     sudo firewall-cmd --zone $i --list-all