bkctld-check-setup: compatibility with minifirewall 22.03+

This commit is contained in:
Jérémy Lecour 2022-03-30 15:07:45 +02:00 committed by Jérémy Lecour
parent 9c3813716e
commit 3b0e6934d9
2 changed files with 13 additions and 5 deletions

View File

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Tell sed to follow symlinks
* evobackup : exclude tmp directories of LXC containers.
* Add a header in `bkctld status` output and improved columns width.
* bkctld-check-setup: compatibility with minifirewall 22.03+
### Changed

View File

@ -29,17 +29,24 @@ fi
# Check if the firewall file is sourced
minifirewall_config=/etc/default/minifirewall
minifirewall_version=$(/etc/init.d/minifirewall status | head -1 | cut -d ' ' -f 3)
if [ -n "${FIREWALL_RULES}" ] \
&& [ -r "${FIREWALL_RULES}" ] \
&& [ -f "${minifirewall_config}" ]; then
if grep -qE "^(\.|source) ${FIREWALL_RULES}" "${minifirewall_config}"; then
if [ -n "${minifirewall_version}" ] && dpkg --compare-versions "${minifirewall_version}" ge "22.03"; then
# Minifirewall 22.03+ includes files automatically
nb_ok=$((nb_ok + 1))
output="${output}OK - Firewall file \`${FIREWALL_RULES}' is sourced by \`${minifirewall_config}'.\n"
output="${output}OK - Firewall file \`${FIREWALL_RULES}' is present.\n"
else
nb_warn=$((nb_warn + 1))
output="${output}WARNING - Firewall file \`${FIREWALL_RULES}' doesn't seem to be sourced by \`${minifirewall_config}'\n"
[ "${return}" -le 1 ] && return=1
if grep -qE "^(\.|source) ${FIREWALL_RULES}" "${minifirewall_config}"; then
nb_ok=$((nb_ok + 1))
output="${output}OK - Firewall file \`${FIREWALL_RULES}' is sourced by \`${minifirewall_config}'.\n"
else
nb_warn=$((nb_warn + 1))
output="${output}WARNING - Firewall file \`${FIREWALL_RULES}' doesn't seem to be sourced by \`${minifirewall_config}'\n"
[ "${return}" -le 1 ] && return=1
fi
fi
fi