firewalld.plugin.zsh 484 Bytes
Newer Older
Rob Ede's avatar
Rob Ede committed
1
2
3
4
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"
Rob Ede's avatar
Rob Ede committed
5
6
7
8

function fwl () {
  # converts output to zsh array ()
  # @f flag split on new line
9
  zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v 'interfaces\|sources')}")
Rob Ede's avatar
Rob Ede committed
10
11

  for i in $zones; do
Rob Ede's avatar
Rob Ede committed
12
    sudo firewall-cmd --zone $i --list-all
Rob Ede's avatar
Rob Ede committed
13
14
15
  done

  echo 'Direct Rules:'
Rob Ede's avatar
Rob Ede committed
16
  sudo firewall-cmd --direct --get-all-rules
Rob Ede's avatar
Rob Ede committed
17
}