only generate pf ruleset if in start or restart mode

This commit is contained in:
Thomas von Dein
2021-07-02 19:46:56 +02:00
parent 7e5c2ad591
commit 830ca86afe

8
jaildk
View File

@@ -303,6 +303,12 @@ jaildk_rc_pf() {
load-jail-config $jail load-jail-config $jail
# TODO:
# - put this into a separate function
# - clean up if generation of pf-ruleset.conf fails somehow
# - make a syntax check of the generated rules, if possible
case $mode in
start|restart)
if test -n "$rules" -o -n "$maps"; then if test -n "$rules" -o -n "$maps"; then
# generate a pf.conf based on config variables # generate a pf.conf based on config variables
echo "# generated pf ruleset for jail, generated on ` date`" > $ruleset echo "# generated pf ruleset for jail, generated on ` date`" > $ruleset
@@ -389,6 +395,8 @@ jaildk_rc_pf() {
fi fi
done done
fi fi
;;
esac
if test -s $ruleset; then if test -s $ruleset; then
anchor="$jail/jaildk" anchor="$jail/jaildk"