bkctld-check-incs: Protect jail_config_epoch

Test if `incs_policy_file` exists before using it. Fixes #43.
This commit is contained in:
Brice Waegeneire 2021-02-08 11:12:57 +01:00
parent 68a7da6b88
commit c2353b03a5
2 changed files with 5 additions and 3 deletions

View file

@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
* bkctld-check-incs: Protect `jail_config_epoch`
### Security
## [2.8.0] - 2020-11-28

View file

@ -20,10 +20,10 @@ for jail_name in $("${LIBDIR}/bkctld-list"); do
# Today in ISO format
today_iso=$(date +"%Y-%m-%d")
# get jail last configuration date
jail_config_epoch=$(date --date "$(stat -c %y ${incs_policy_file})" +"%s")
if [ -n "${incs_policy_file}" ]; then
# get jail last configuration date
jail_config_epoch=$(date --date "$(stat -c %y ${incs_policy_file})" +"%s")
# loop for each line in jail configuration
for line in $(cat ${incs_policy_file}); do
# inc date in ISO format