summaryrefslogtreecommitdiff
path: root/plugins/firewalld/firewalld.plugin.zsh
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2016-09-12 17:38:13 +0200
committerGitHub <noreply@github.com>2016-09-12 17:38:13 +0200
commitc3a87e7df8bfd7eca64ef8a3d019c619d098960c (patch)
tree84682585cff54a94923c9053327270d356ed4f82 /plugins/firewalld/firewalld.plugin.zsh
parent3ad92a57f194f2a00a0a4c3e3241ce494e791c02 (diff)
parentdb31d5157669b77b016a105dfdc53db9160a53d0 (diff)
downloadzsh-c3a87e7df8bfd7eca64ef8a3d019c619d098960c.tar.gz
zsh-c3a87e7df8bfd7eca64ef8a3d019c619d098960c.tar.bz2
zsh-c3a87e7df8bfd7eca64ef8a3d019c619d098960c.zip
Add FirewallD plugin (#5386)
Diffstat (limited to 'plugins/firewalld/firewalld.plugin.zsh')
-rw-r--r--plugins/firewalld/firewalld.plugin.zsh17
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/firewalld/firewalld.plugin.zsh b/plugins/firewalld/firewalld.plugin.zsh
new file mode 100644
index 000000000..bfbf6f48f
--- /dev/null
+++ b/plugins/firewalld/firewalld.plugin.zsh
@@ -0,0 +1,17 @@
+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)}")
+
+ for i in $zones; do
+ sudo firewall-cmd --zone $i --list-all
+ done
+
+ echo 'Direct Rules:'
+ sudo firewall-cmd --direct --get-all-rules
+}