From cbe448c4d2ea49d33c7e4cbab9b27fc8585f4e6f Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Thu, 13 Feb 2025 13:18:09 -0700 Subject: [PATCH] rdr: Remove old format after new format is loaded --- usr/local/share/bastille/rdr.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/usr/local/share/bastille/rdr.sh b/usr/local/share/bastille/rdr.sh index 97897226..2c6ec54f 100644 --- a/usr/local/share/bastille/rdr.sh +++ b/usr/local/share/bastille/rdr.sh @@ -337,6 +337,12 @@ while [ "$#" -gt 0 ]; do validate_rdr_rule $RDR_IF $RDR_SRC $RDR_DST $1 $2 $3 persist_rdr_rule $RDR_INET $RDR_IF $RDR_SRC $RDR_DST $1 $2 $3 load_rdr_rule $RDR_INET $RDR_IF $RDR_SRC $RDR_DST $1 $2 $3 + # Temp block to remove old format after new format is loaded the first time + while read rules; do + if [ "$(echo ${rules} | wc -w)" -lt 6 ]; then + sed -i '' "/^${rules}$/d" "${bastille_jailsdir}/${_jail}/rdr.conf" + fi + done < "${bastille_jailsdir}/${_jail}/rdr.conf" shift "$#" else case "${4}" in