chore: configure current repository as a version

And use it as default version.

To this end, the scripts in bin/hardening have been made generic by removing the associated recommendation number.
Only impact is if you are used to execute scripts directly from bin/hardening.
In this case, please use the "bin/hardening.sh" wrapper as intended.

I had to rename 2.3.1_disable_nis.sh to uninstall_nis.sh, as it was conflicting with 2.3.1_disable_nis.sh

Also, there was a doublon between 1.1.1.8_disable_cramfs.sh and 99.1.1.1_disable_cramfs.sh ; the former was kept
This commit is contained in:
Damien Cavagnini
2025-06-25 09:22:29 +02:00
parent 300095cfa1
commit aebb65889e
730 changed files with 244 additions and 89 deletions

View File

@ -0,0 +1,41 @@
# shellcheck shell=bash
# run-shellcheck
test_audit() {
describe Running void to generate the conf file that will later be edited
# shellcheck disable=2154
"${CIS_CHECKS_DIR}/${script}.sh" || true
# shellcheck disable=2016
echo 'EXCLUDED="$EXCLUDED ^/home/secaudit/6.1.12/.*"' >>"${CIS_CONF_DIR}/conf.d/${script}.cfg"
mkdir /home/secaudit/6.1.12/
touch /home/secaudit/6.1.12/test
chown 1200:1200 /home/secaudit/6.1.12/test
describe Running on blank host
register_test retvalshouldbe 0
register_test contain "No ungrouped files found"
# shellcheck disable=2154
run blank "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
describe Tests purposely failing
local targetfile="/home/secaudit/ungrouped"
touch "$targetfile"
chown 1200:1200 "$targetfile"
register_test retvalshouldbe 1
register_test contain "Some ungrouped files are present"
run noncompliant "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
describe Tests failing with find ignore flag
echo 'FIND_IGNORE_NOSUCHFILE_ERR=true' >>"${CIS_CONF_DIR}/conf.d/${script}.cfg"
register_test retvalshouldbe 1
register_test contain "Some ungrouped files are present"
run noncompliant "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
describe correcting situation
sed -i 's/audit/enabled/' "${CIS_CONF_DIR}/conf.d/${script}.cfg"
"${CIS_CHECKS_DIR}/${script}.sh" --apply || true
describe Checking resolved state
register_test retvalshouldbe 0
register_test contain "No ungrouped files found"
run resolved "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
}