Replace CIS_ROOT_DIR by a more flexible system (#204)

* Replace CIS_ROOT_DIR by a more flexible system

* Try to adapt the logic change to the functional tests
This commit is contained in:
P-EB
2023-09-25 14:24:01 +02:00
committed by GitHub
parent 5370ec2ef6
commit 32886d3a3d
493 changed files with 2060 additions and 2056 deletions

View File

@ -4,7 +4,7 @@ test_audit() {
describe Running on blank host
register_test retvalshouldbe 0
# shellcheck disable=2154
run blank /opt/debian-cis/bin/hardening/"${script}".sh --audit-all
run blank "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
local test_user="testhomeuser"
@ -13,14 +13,14 @@ test_audit() {
chown root:root /home/"$test_user"
register_test retvalshouldbe 1
register_test contain "[ KO ] The home directory (/home/$test_user) of user testhomeuser is owned by root"
run noncompliant /opt/debian-cis/bin/hardening/"${script}".sh --audit-all
run noncompliant "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
describe correcting situation
echo "EXCEPTIONS=\"/home/$test_user:$test_user:root\"" >/opt/debian-cis/etc/conf.d/"${script}".cfg
echo "EXCEPTIONS=\"/home/$test_user:$test_user:root\"" >"${CIS_CONF_DIR}/conf.d/${script}.cfg"
describe Checking resolved state
register_test retvalshouldbe 0
run resolved /opt/debian-cis/bin/hardening/"${script}".sh --audit-all
run resolved "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
# Cleanup
rm -rf "/home/${test_user:?}"