__ungleich_nftables/files/nftables-init

38 lines
636 B
Text
Raw Normal View History

2018-07-02 22:10:40 +00:00
#!/bin/sh
# Nico Schottelius, nico.schottelius at ungleich.ch
# 2017-07-01
### BEGIN INIT INFO
# Provides: nftables
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nftable rules
### END INIT INFO
2020-01-30 09:42:30 +00:00
CONF=/etc/firewall.nft
2018-07-02 22:10:40 +00:00
BIN=/usr/sbin/nft
[ -x "$BIN" ] || exit 0
case "$1" in
start)
$BIN flush ruleset
$BIN -f $CONF
;;
restart)
$0 stop && $0 start
;;
stop)
$BIN flush ruleset
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
exit 1
;;
esac