ansible-roles/vpn/bridge/templates/ifupdown.d/10-nftables

28 lines
591 B
Bash
Executable File

#!/usr/bin/env bash
if [ ${MODE} == "start" ]
then
set -ue
elif [ ${MODE} == "stop" ]
then
set -u
else
echo "$(basename ${0}): mode must be one of either 'start' or 'stop'" 1>&2
exit 1
fi
IFDIR={{ system_etc_root_directory }}/network/interfaces/${IFACE}
case ${PHASE} in
"pre-up")
/usr/bin/envsubst '${IFACE}' < ${IFDIR}/nftables/up.nft | /usr/sbin/nft -f /dev/stdin
;;
"post-up")
;;
"pre-down")
;;
"post-down")
/usr/bin/envsubst '${IFACE}' < ${IFDIR}/nftables/down.nft | /usr/sbin/nft -f /dev/stdin
;;
esac