feat: add debian12 scripts

- auditd_logs_full_halt.sh			-> 6.3.2.3
- systemd_journal_upload_remote_auth.sh		-> 6.2.1.2.2
- sudo_auth_timeout.sh 				-> 5.2.6
- libpam_modules_is_installed.sh 		-> 5.3.1.2
- ufw_not_installed_with_nftables.sh 		-> 4.2.2
- ufw_not_installed_with_iptables.sh 		-> 4.3.1.3
This commit is contained in:
damien cavagnini
2025-08-01 09:49:21 +02:00
parent ffab7bcb3e
commit c22ce20f9d
13 changed files with 614 additions and 1 deletions

View File

@@ -0,0 +1,46 @@
# shellcheck shell=bash
# run-shellcheck
test_audit() {
describe prepare failing test disk_full
apt install -y auditd
sed -i -e '/disk_full_action/d' -e '/disk_error_action/d' /etc/audit/auditd.conf
echo "disk_full_action = SUSPEND" >>/etc/audit/auditd.conf
echo "disk_error_action = halt" >>/etc/audit/auditd.conf
describe Running failed 'disk_full_action'
register_test retvalshouldbe 1
# shellcheck disable=2154
run failed "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
describe Correcting situation
sed -i 's/audit/enabled/' "${CIS_CONF_DIR}/conf.d/${script}.cfg"
# shellcheck disable=2154
"${CIS_CHECKS_DIR}/${script}.sh" || true
describe Checking resolved state
register_test retvalshouldbe 0
run resolved "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
describe prepare failing test disk_error
apt install -y auditd
sed -i -e '/disk_full_action/d' -e '/disk_error_action/d' /etc/audit/auditd.conf
echo "disk_full_action = halt" >>/etc/audit/auditd.conf
echo "disk_error_action = suspend" >>/etc/audit/auditd.conf
describe Running failed 'disk_error_action'
register_test retvalshouldbe 1
# shellcheck disable=2154
run failed "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
describe Correcting situation
# shellcheck disable=2154
"${CIS_CHECKS_DIR}/${script}.sh" || true
describe Checking resolved state
register_test retvalshouldbe 0
run resolved "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
apt purge -y auditd
apt autoremove -y
}

View File

@@ -0,0 +1,10 @@
# shellcheck shell=bash
# run-shellcheck
test_audit() {
# it should be installed by default
describe Checking blank host
register_test retvalshouldbe 0
# shellcheck disable=2154
run blank "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
}

View File

@@ -0,0 +1,27 @@
# shellcheck shell=bash
# run-shellcheck
test_audit() {
describe prepare test
echo "Defaults timestamp_timeout=15" >/etc/sudoers.d/test_1
echo "Defaults timestamp_timeout=20" >/etc/sudoers.d/test_2
# by default authentication should not be configured
describe Running failed
register_test retvalshouldbe 1
# shellcheck disable=2154
run failed "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
describe Fix the situation
sed -i 's/audit/enabled/' "${CIS_CONF_DIR}/conf.d/${script}.cfg"
"${CIS_CHECKS_DIR}/${script}.sh" || true
# by default authentication should not be configured
describe Running resolved
register_test retvalshouldbe 0
# shellcheck disable=2154
run resolved "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
describe clean test
rm -f /etc/sudoers.d/test_1 /etc/sudoers.d/test_2
}

View File

@@ -0,0 +1,27 @@
# shellcheck shell=bash
# run-shellcheck
test_audit() {
describe prepare test
apt install systemd-journal-remote -y
# by default authentication should not be configured
describe Running failed
register_test retvalshouldbe 1
# shellcheck disable=2154
run failed "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
describe Fix situation
for i in "URL" "ServerKeyFile" "ServerCertificateFile" "TrustedCertificateFile"; do
echo "$i=" >>/etc/systemd/journal-upload.conf
done
describe Running resolved
register_test retvalshouldbe 0
# shellcheck disable=2154
run resolved "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
describe clean test
apt purge systemd-journal-remote -y
apt autoremove -y
}

View File

@@ -0,0 +1,21 @@
# shellcheck shell=bash
# run-shellcheck
test_audit() {
describe Prepare test
apt install -y nftables ufw
describe Checking failed
register_test retvalshouldbe 1
# shellcheck disable=2154
run failed "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
describe fix situation
sed -i 's/audit/enabled/' "${CIS_CONF_DIR}/conf.d/${script}.cfg"
"${CIS_CHECKS_DIR}/${script}.sh" || true
describe Checking resolved
register_test retvalshouldbe 0
# shellcheck disable=2154
run resolved "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
}

View File

@@ -0,0 +1,21 @@
# shellcheck shell=bash
# run-shellcheck
test_audit() {
describe Prepare test
apt install -y nftables ufw
describe Checking failed
register_test retvalshouldbe 1
# shellcheck disable=2154
run failed "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
describe fix situation
sed -i 's/audit/enabled/' "${CIS_CONF_DIR}/conf.d/${script}.cfg"
"${CIS_CHECKS_DIR}/${script}.sh" || true
describe Checking resolved
register_test retvalshouldbe 0
# shellcheck disable=2154
run resolved "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
}