router/firewall-edit.sh

11 lines
303 B
Bash
Executable file

#!/usr/bin/env bash
# TODO: diff with existing before just overwriting what's here in git?
f="$(dirname "$(realpath "$0")")/nftables"
sudo rm "$f"
printf "flush ruleset\n\n" > "$f"
sudo nft -s list ruleset >> "$f"
sudo nvim "$f" && sudo nft -f "$f"
# TODO: should this be sync'd to /etc/nftables.conf