add option to query specific set

This commit is contained in:
Matthew Saunders Brown 2023-08-21 10:31:31 -07:00
parent fd3bbd0e75
commit 84a85274cc

View File

@ -1,7 +1,16 @@
#!/bin/bash
# firewalld is using nftables
nft list table inet firewalld
# call this script without any options to output the entire ruleset
# or provide one argument as a "set" (e.g. "fail2ban") to return only that IP set.
# if "set" arg is provided only return that info
if [ -n "$1" ]; then
nft list set inet firewalld $1
else
# no "set" specified, return entire table
nft list table inet firewalld
fi
# you can also export the current ruleset in json format:
# nft -j list ruleset