mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-18 11:50:07 +00:00
2b6434e879
`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.
17 lines
484 B
Bash
17 lines
484 B
Bash
alias fw="sudo firewall-cmd"
|
|
alias fwp="sudo firewall-cmd --permanent"
|
|
alias fwr="sudo firewall-cmd --reload"
|
|
alias fwrp="sudo firewall-cmd --runtime-to-permanent"
|
|
|
|
function fwl () {
|
|
# converts output to zsh array ()
|
|
# @f flag split on new line
|
|
zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v 'interfaces\|sources')}")
|
|
|
|
for i in $zones; do
|
|
sudo firewall-cmd --zone $i --list-all
|
|
done
|
|
|
|
echo 'Direct Rules:'
|
|
sudo firewall-cmd --direct --get-all-rules
|
|
}
|