Merge branch 'master' into debian

This commit is contained in:
Jérémy Lecour 2020-08-28 10:23:45 +02:00 committed by Jérémy Lecour
commit 5de37c8eb7
4 changed files with 30 additions and 21 deletions

View file

@ -18,6 +18,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security ### Security
## [2.4.1] - 2020-08-28
### Added
* jails and incs lists are sorted alphanumerically
### Fixed
* bkctld-check-setup: forgot to increment the summary
## [2.4.0] - 2020-08-19 ## [2.4.0] - 2020-08-19
### Added ### Added

View file

@ -63,6 +63,7 @@ for jail_name in $(jails_list); do
done done
if [ "${nb_off}" -eq 0 ]; then if [ "${nb_off}" -eq 0 ]; then
output="${output}OK - all jails are in their expected state.\n" output="${output}OK - all jails are in their expected state.\n"
nb_ok=$((nb_ok + 1))
else else
output="${output}CRITICAL - ${nb_off} jail(s) shouldn't be OFF !\n" output="${output}CRITICAL - ${nb_off} jail(s) shouldn't be OFF !\n"
nb_crit=$((nb_crit + 1)) nb_crit=$((nb_crit + 1))

View file

@ -10,6 +10,4 @@ set -eu
LIBDIR="$(dirname $0)" && . "${LIBDIR}/includes" LIBDIR="$(dirname $0)" && . "${LIBDIR}/includes"
[ -d "${JAILDIR}" ] || exit 0 [ -d "${JAILDIR}" ] || exit 0
#TODO: try if this command works the same : jails_list
# find "${JAILDIR}" -mindepth 1 -maxdepth 1 -type d -printf '%f\n'
find "${JAILDIR}" -mindepth 1 -maxdepth 1 -type d|sed 's!.*/!!'

View file

@ -94,14 +94,9 @@ is_btrfs() {
# Returns the list of all jails # Returns the list of all jails
jails_list() { jails_list() {
# shellcheck disable=SC2091 # TODO: try if this command works the same :
"${LIBDIR}/bkctld-list" # find "${JAILDIR}" -mindepth 1 -maxdepth 1 -type d -printf '%f\n'
} find "${JAILDIR}" -mindepth 1 -maxdepth 1 -type d | sed 's!.*/!!' | sort -h
# Returns the list of all incs for a jail
incs_list() {
jail_name=${1:?}
# shellcheck disable=SC2091
ls "$(incs_path "${jail_name}")/"
} }
# Returns the complete path of a jail # Returns the complete path of a jail
jail_path() { jail_path() {
@ -109,6 +104,18 @@ jail_path() {
echo "${JAILDIR}/${jail_name}" echo "${JAILDIR}/${jail_name}"
} }
jail_config_dir() {
jail_name=${1:?}
echo "${CONFDIR}/${jail_name}.d"
}
jail_incs_policy_file() {
jail_name=${1:?}
jail_config_dir=$(jail_config_dir "${jail_name}")
echo "${jail_config_dir}/incs_policy"
}
# Returns the path of incs for a jail # Returns the path of incs for a jail
incs_path() { incs_path() {
jail_name=${1:?} jail_name=${1:?}
@ -131,17 +138,10 @@ inc_exists() {
# inc_path must not be quoted because it can contain globs # inc_path must not be quoted because it can contain globs
ls -d ${inc_path} > /dev/null 2>&1 ls -d ${inc_path} > /dev/null 2>&1
} }
jail_config_dir() { # Returns the list of all incs for a jail
incs_list() {
jail_name=${1:?} jail_name=${1:?}
find "$(incs_path "${jail_name}")" -mindepth 1 -maxdepth 1 -type d | sed 's!.*/!!' | sort -h
echo "${CONFDIR}/${jail_name}.d"
}
jail_incs_policy_file() {
jail_name=${1:?}
jail_config_dir=$(jail_config_dir "${jail_name}")
echo "${jail_config_dir}/incs_policy"
} }
current_jail_incs_policy_file() { current_jail_incs_policy_file() {
jail_name=${1:?} jail_name=${1:?}