SHARE
TWEET

Untitled

a guest May 25th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # vi: noexpandtab ts=4 sw=4 ff=unix fenc=utf-8 ft=sh
  3.  
  4. function error() {
  5.     printf "\e[31mERROR: %s\e[m\n" "${1:-'unknown'}"
  6.     exit 1
  7. }
  8.  
  9. if ! which firewall-cmd &> /dev/null; then
  10.     error "firewall-cmd not found."
  11. fi
  12. if ! firewall-cmd --version &> /dev/null; then
  13.     error "You need to be root to perform this command."
  14. fi
  15.  
  16. for z in $(firewall-cmd --get-active-zones | grep -v ':'); do
  17.     firewall-cmd --info-zone $z | grep -Ev '^[\s]*$|:[\s ]+$'
  18.  
  19.     for s in $(firewall-cmd --list-services  --zone=$z); do
  20.         firewall-cmd --info-service $s | grep -Ev '^[\s]*$|:[\s ]+$' | sed -r 's/(.*)/  \1/g'
  21.     done
  22.     printf "\n"
  23. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top