2024-12-13 01:04:11 -03:00
|
|
|
SRC = ./
|
2024-12-13 04:44:12 -03:00
|
|
|
NFT = nftables.conf
|
2024-12-13 01:04:11 -03:00
|
|
|
|
|
|
|
all:
|
|
|
|
$(info run make makeconf to unify .nft files into nftables.conf)
|
|
|
|
$(info run make install to install nftables.conf in /etc and set as current ruleset)
|
|
|
|
$(info run make uninstall to replace /etc/nftables.conf with backup and set as current ruleset)
|
|
|
|
|
|
|
|
makeconf:
|
|
|
|
$(info running makeconf.sh)
|
|
|
|
$(SRC)makeconf.sh
|
|
|
|
|
2024-12-13 05:04:50 -03:00
|
|
|
test: makeconf
|
|
|
|
$(info checking configuration for errors and possible optimizations)
|
|
|
|
nft -c -o -f $(SRC)$(NFT)
|
|
|
|
|
2024-12-13 11:27:03 -03:00
|
|
|
backup:
|
2024-12-13 01:04:11 -03:00
|
|
|
$(info backing up current nftables rules)
|
|
|
|
cp /etc/nftables.conf $(SRC)backup.conf || nft list ruleset > $(SRC)backup.conf
|
2024-12-13 11:27:03 -03:00
|
|
|
|
|
|
|
install: test backup
|
2024-12-13 01:04:11 -03:00
|
|
|
$(info installing new nftables rules)
|
|
|
|
cp $(SRC)$(NFT) /etc/nftables.conf
|
|
|
|
$(info reloading nftables rules)
|
|
|
|
nft -f /etc/nftables.conf
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
$(info replacing nftables.conf with backup)
|
|
|
|
cp $(SRC)backup.conf /etc/nftables.conf
|
|
|
|
$(info reloading nftables rules)
|
|
|
|
nft -f /etc/nftables.conf
|