diff options
author | Marc Cornellà <marc.cornella@live.com> | 2016-09-12 17:38:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-12 17:38:13 +0200 |
commit | c3a87e7df8bfd7eca64ef8a3d019c619d098960c (patch) | |
tree | 84682585cff54a94923c9053327270d356ed4f82 | |
parent | 3ad92a57f194f2a00a0a4c3e3241ce494e791c02 (diff) | |
parent | db31d5157669b77b016a105dfdc53db9160a53d0 (diff) | |
download | zsh-c3a87e7df8bfd7eca64ef8a3d019c619d098960c.tar.gz zsh-c3a87e7df8bfd7eca64ef8a3d019c619d098960c.tar.bz2 zsh-c3a87e7df8bfd7eca64ef8a3d019c619d098960c.zip |
Add FirewallD plugin (#5386)
-rw-r--r-- | plugins/firewalld/firewalld.plugin.zsh | 17 | ||||
-rw-r--r-- | plugins/firewalld/readme.md | 22 |
2 files changed, 39 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 +} diff --git a/plugins/firewalld/readme.md b/plugins/firewalld/readme.md new file mode 100644 index 000000000..8b5bc74d4 --- /dev/null +++ b/plugins/firewalld/readme.md @@ -0,0 +1,22 @@ +# FirewallD Plugin + +This plugin adds some aliases and functions for FirewallD using the `firewalld-cmd` command. To use it, add firewalld to your plugins array. + +```zsh +plugins=(... firewalld) +``` + +## Aliases + +| Alias | Command | Description | +| :---- | :----------------------------------------- | :--------------------------- | +| fw | `sudo firewall-cmd` | Shorthand | +| fwr | `sudo firewall-cmd --reload` | Reload current configuration | +| fwp | `sudo firewall-cmd --permanent` | Create permanent rule | +| fwrp | `sudo firewall-cmd --runtime-to-permanent` | Save current configuration | + +## Functions + +| Function | Description | +| :------- | :--------------------------------------------------------- | +| fwl | Lists configuration from all active zones and direct rules | |