minifirewall: upstream release 23.02
All checks were successful
gitea/ansible-roles/pipeline/head This commit looks good

This commit is contained in:
Jérémy Lecour 2023-02-01 11:27:40 +01:00 committed by Jérémy Lecour
parent d3765ada56
commit 3f0eecc056

View file

@ -29,7 +29,7 @@
# Description: Firewall designed for standalone server # Description: Firewall designed for standalone server
### END INIT INFO ### END INIT INFO
VERSION="22.06" VERSION="23.02"
NAME="minifirewall" NAME="minifirewall"
# shellcheck disable=SC2034 # shellcheck disable=SC2034
@ -147,6 +147,9 @@ fi
# } # }
## Beware that commands executed from included files are not modified by this trick. ## Beware that commands executed from included files are not modified by this trick.
remove_colors() {
sed -r 's/\x1B\[(;?[0-9]{1,3})+[mGK]//g'
}
syslog_info() { syslog_info() {
if [ -x "${LOGGER_BIN}" ]; then if [ -x "${LOGGER_BIN}" ]; then
${LOGGER_BIN} -t "${NAME}" -p daemon.info "$1" ${LOGGER_BIN} -t "${NAME}" -p daemon.info "$1"
@ -268,9 +271,9 @@ check_unpersisted_state() {
elif [ -z "${diff_bin}" ]; then elif [ -z "${diff_bin}" ]; then
printf "${YELLOW}skip state comparison (Can't find diff command)${RESET}\n" >&2 printf "${YELLOW}skip state comparison (Can't find diff command)${RESET}\n" >&2
else else
# store current state # store current state (without colors)
mkdir -p "$(dirname "${STATE_FILE_CURRENT}")" mkdir -p "$(dirname "${STATE_FILE_CURRENT}")"
status_without_numbers > "${STATE_FILE_CURRENT}" status_without_numbers | remove_colors > "${STATE_FILE_CURRENT}"
# clean previous diff file # clean previous diff file
rm -f "${STATE_FILE_DIFF}" rm -f "${STATE_FILE_DIFF}"
@ -310,9 +313,9 @@ report_state_changes() {
check_unpersisted_state check_unpersisted_state
fi fi
# Then reset the known state # Then reset the known state (without colors)
mkdir -p "$(dirname "${STATE_FILE_LATEST}")" mkdir -p "$(dirname "${STATE_FILE_LATEST}")"
status_without_numbers > "${STATE_FILE_LATEST}" status_without_numbers | remove_colors > "${STATE_FILE_LATEST}"
# But if there is a previous known state # But if there is a previous known state
# let's compare with the new known state # let's compare with the new known state
@ -920,8 +923,9 @@ stop() {
printf "${BLUE}flushing all rules and accepting everything${RESET}\n" printf "${BLUE}flushing all rules and accepting everything${RESET}\n"
# Save previous state (without colors)
mkdir -p "$(dirname "${STATE_FILE_PREVIOUS}")" mkdir -p "$(dirname "${STATE_FILE_PREVIOUS}")"
status_without_numbers > "${STATE_FILE_PREVIOUS}" status_without_numbers | remove_colors > "${STATE_FILE_PREVIOUS}"
# Delete all rules # Delete all rules
${IPT} -F INPUT ${IPT} -F INPUT