X-Git-Url: https://git.ao2.it/config/iptables.git/blobdiff_plain/8c51ee4053d736c9ae6a60c5f96c5e0fb4d3c5fe..refs/heads/master:/Makefile diff --git a/Makefile b/Makefile index 1c26fe1..aec4351 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,19 @@ all: deploy-workstation: - command -v /usr/sbin/nft > /dev/null && sudo nft flush ruleset + -[ -x /usr/sbin/nft ] && sudo nft flush ruleset sudo ./iptables-workstation.sh - sudo iptables-save > iptables - sudo ip6tables-save > ip6tables + sudo sh -c "iptables-save > rules.v4" + sudo sh -c "ip6tables-save > rules.v6" + -if [ -x /usr/sbin/netfilter-persistent ]; \ + then \ + [ -d /etc/iptables ] && sudo mkdir /etc/iptables; \ + sudo mv rules.v[46] /etc/iptables; \ + sudo etckeeper vcs add iptables; \ + if ! sudo etckeeper vcs diff --staged --no-patch --exit-code -- iptables; \ + then \ + sudo etckeeper vcs commit -m "iptables: update rules" -- iptables; \ + fi; \ + sudo systemctl restart netfilter-persistent.service; \ + fi +