Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # vi: noexpandtab ts=4 sw=4 ff=unix fenc=utf-8 ft=sh
- function error() {
- printf "\e[31mERROR: %s\e[m\n" "${1:-'unknown'}"
- exit 1
- }
- if ! which firewall-cmd &> /dev/null; then
- error "firewall-cmd not found."
- fi
- if ! firewall-cmd --version &> /dev/null; then
- error "You need to be root to perform this command."
- fi
- for z in $(firewall-cmd --get-active-zones | grep -v ':'); do
- firewall-cmd --info-zone $z | grep -Ev '^[\s]*$|:[\s ]+$'
- for s in $(firewall-cmd --list-services --zone=$z); do
- firewall-cmd --info-service $s | grep -Ev '^[\s]*$|:[\s ]+$' | sed -r 's/(.*)/ \1/g'
- done
- printf "\n"
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement