V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m31s

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-10-13 19:51:43 +01:00
parent f222665cad
commit ad4c56fdb5
24 changed files with 52 additions and 137 deletions

View File

@@ -31,39 +31,21 @@ installation_packages() {
if [[ "${VAR_APT_FULL_UPGRADE}" == "true" ]]; then
chroot_script "${TARGET}" "
export INITRD=No
apt-get update 2>&1 | tee -a ${var_logfile}
RC=( \${PIPESTATUS[@]} )
echo ExitCode of PIPESTATUS[0]: \${RC[0]} >> ${var_logfile}
apt-get upgrade -y 2>&1 | tee -a ${var_logfile}
RC=( \${PIPESTATUS[@]} )
echo ExitCode of PIPESTATUS[0]: \${RC[0]} >> ${var_logfile}
apt-get update -qq 2>&1 | tee -a ${var_logfile}
apt-get upgrade -y 2>&1 | tee -a ${var_logfile}
"
fi
chroot_script "${TARGET}" "
export INITRD=No
apt-get install -y --no-install-recommends --no-install-suggests ${ARY_PACKAGES[*]} 2>&1 | tee -a ${var_logfile}
RC=( \${PIPESTATUS[@]} )
echo ExitCode of PIPESTATUS[0]: \${RC[0]} >> ${var_logfile}
"
chroot_script "${TARGET}" "
export INITRD=No
apt-get autoclean -y 2>&1 | tee -a ${var_logfile}
RC=( \${PIPESTATUS[@]} )
echo ExitCode of PIPESTATUS[0]: \${RC[0]} >> ${var_logfile}
apt-get autopurge -y 2>&1 | tee -a ${var_logfile}
RC=( \${PIPESTATUS[@]} )
echo ExitCode of PIPESTATUS[0]: \${RC[0]} >> ${var_logfile}
apt-get autoremove -y 2>&1 | tee -a ${var_logfile}
RC=( \${PIPESTATUS[@]} )
echo ExitCode of PIPESTATUS[0]: \${RC[0]} >> ${var_logfile}
"
guard_dir && return 0

View File

@@ -39,8 +39,6 @@ installation_security() {
chroot_script "${TARGET}" "
export INITRD=No
apt-get install -y --no-install-recommends --no-install-suggests ${ary_fw[*]} 2>&1 | tee -a ${var_logfile}
RC=( \${PIPESTATUS[@]} )
echo ExitCode of PIPESTATUS[0]: \${RC[0]} >> ${var_logfile}
if [[ ${VAR_SEC_FW} == apparmor ]]; then
systemctl enable apparmor 2>&1 | tee -a ${var_logfile} || true

View File

@@ -34,8 +34,6 @@ install_verification() {
chroot_script "${TARGET}" "
export INITRD=No
apt-get install -y --no-install-recommends --no-install-suggests auditd 2>&1 | tee -a ${var_logfile}
RC=( \${PIPESTATUS[@]} )
echo ExitCode of PIPESTATUS[0]: \${RC[0]} >> ${var_logfile}
"
rm -f "${TARGET}/etc/audit/rules.d/audit.rules"
@@ -340,8 +338,6 @@ EOF
chroot_script "${TARGET}" "
systemctl enable auditd.service 2>&1 | tee -a ${var_logfile}
RC=( \${PIPESTATUS[@]} )
echo ExitCode of PIPESTATUS[0]: \${RC[0]} >> ${var_logfile}
"
### Validate and build audit rules now; fail early if syntax is wrong.
@@ -349,8 +345,6 @@ EOF
if command -v augenrules >/dev/null 2>&1; then
augenrules --load 2>&1 | tee -a ${var_logfile}
RC=( \${PIPESTATUS[@]} )
echo ExitCode of PIPESTATUS[0]: \${RC[0]} >> ${var_logfile}
else
@@ -367,8 +361,7 @@ EOF
chroot_script "${TARGET}" "
export INITRD=No
apt-get install -y --no-install-recommends --no-install-suggests aide aide-common 2>&1 | tee -a ${var_logfile}
RC=( \${PIPESTATUS[@]} )
echo ExitCode of PIPESTATUS[0]: \${RC[0]} >> ${var_logfile}
sed -i 's/Checksums = H/Checksums = sha512/' /etc/aide/aide.conf
aideinit > /dev/null 2>> ${var_logfile}
"
@@ -376,8 +369,7 @@ EOF
chroot_script "${TARGET}" "
export INITRD=No
apt-get install -y --no-install-recommends --no-install-suggests debsums 2>&1 | tee -a ${var_logfile}
RC=( \${PIPESTATUS[@]} )
echo ExitCode of PIPESTATUS[0]: \${RC[0]} >> ${var_logfile}
if ! debsums -g >> ${var_logfile} 2>> ${var_logfile}; then
printf 'Running debsums -g - encountered errors.' >> ${var_logfile}
fi
@@ -385,8 +377,6 @@ EOF
chroot_script "${TARGET}" "
rkhunter --propupd 2>&1 | tee -a ${var_logfile}
RC=( \${PIPESTATUS[@]} )
echo ExitCode of PIPESTATUS[0]: \${RC[0]} >> ${var_logfile}
"
guard_dir && return 0

View File

@@ -29,70 +29,70 @@ auditing_packages() {
chroot_script "${TARGET}" "
if ! dpkg --audit 2>&1 | tee -a ${var_logfile}; then
echo \"[dpkg --audit] failed with ExitCode: \$? \" >> ${var_logfile}
echo \"[dpkg --audit] failed.\" >> ${var_logfile}
else
echo \"[dpkg --audit] ExitCode: \$? \" >> ${var_logfile}
echo \"[dpkg --audit] successful.\" >> ${var_logfile}
fi
echo +++ >> ${var_logfile}
if ! apt-get check 2>&1 | tee -a ${var_logfile}; then
echo \"[apt-get check] failed with ExitCode: \$? \" >> ${var_logfile}
echo \"[apt-get check] failed.\" >> ${var_logfile}
else
echo \"[apt-get check] ExitCode: \$? \" >> ${var_logfile}
echo \"[apt-get check] successful.\" >> ${var_logfile}
fi
echo +++ >> ${var_logfile}
### Only log anomalies from dpkg -V (no output == OK)
if ! dpkg -V 2>&1 | tee -a ${var_logfile}; then
echo \"[dpkg -V] failed with ExitCode: \$? \" >> ${var_logfile}
echo \"[dpkg -V] failed.\" >> ${var_logfile}
else
echo \"[dpkg -V] ExitCode: \$? \" >> ${var_logfile}
echo \"[dpkg -V] successful.\" >> ${var_logfile}
fi
echo +++ >> ${var_logfile}
### Simulations (no changes)
if ! apt-get -s autoremove --purge 2>&1 | tee -a ${var_logfile}; then
echo \"[apt-get -s autoremove --purge] failed with ExitCode: \$? \" >> ${var_logfile}
echo \"[apt-get -s autoremove --purge] failed.\" >> ${var_logfile}
else
echo \"[apt-get -s autoremove --purge] ExitCode: \$? \" >> ${var_logfile}
echo \"[apt-get -s autoremove --purge] successful.\" >> ${var_logfile}
fi
echo +++ >> ${var_logfile}
### Residual configs & holds
if ! apt-mark showhold 2>&1 | tee -a ${var_logfile}; then
echo \"[apt-mark showhold] failed with ExitCode: \$? \" >> ${var_logfile}
echo \"[apt-mark showhold] failed.\" >> ${var_logfile}
else
echo \"[apt-mark showhold] ExitCode: \$? \" >> ${var_logfile}
echo \"[apt-mark showhold] successful.\" >> ${var_logfile}
fi
echo +++ >> ${var_logfile}
### Apt pinning
if ! grep -R . /etc/apt/preferences.d/ 2>&1 | tee -a ${var_logfile}; then
echo \"[grep -R . /etc/apt/preferences.d/] failed with ExitCode: \$? \" >> ${var_logfile}
echo \"[grep -R . /etc/apt/preferences.d/] failed.\" >> ${var_logfile}
else
echo \"[grep -R . /etc/apt/preferences.d/] ExitCode: \$? \" >> ${var_logfile}
echo \"[grep -R . /etc/apt/preferences.d/] successful.\" >> ${var_logfile}
fi
echo +++ >> ${var_logfile}
### Diversions, statoverrides, alternatives
if ! dpkg-divert --list 2>&1 | tee -a ${var_logfile}; then
echo \"[dpkg-divert --list] failed with ExitCode: \$? \" >> ${var_logfile}
echo \"[dpkg-divert --list] failed.\" >> ${var_logfile}
else
echo \"[dpkg-divert --list] ExitCode: \$? \" >> ${var_logfile}
echo \"[dpkg-divert --list] successful.\" >> ${var_logfile}
fi
echo +++ >> ${var_logfile}
if ! dpkg-statoverride --list 2>&1 | tee -a ${var_logfile}; then
echo \"[dpkg-statoverride --list] failed with ExitCode: \$? \" >> ${var_logfile}
echo \"[dpkg-statoverride --list] failed.\" >> ${var_logfile}
else
echo \"[dpkg-statoverride --list] ExitCode: \$? \" >> ${var_logfile}
echo \"[dpkg-statoverride --list] successful.\" >> ${var_logfile}
fi
echo +++ >> ${var_logfile}
if ! update-alternatives --get-selections 2>&1 | tee -a ${var_logfile}; then
echo \"[update-alternatives --get-selections] failed with ExitCode: \$? \" >> ${var_logfile}
echo \"[update-alternatives --get-selections] failed.\" >> ${var_logfile}
else
echo \"[update-alternatives --get-selections] ExitCode: \$? \" >> ${var_logfile}
echo \"[update-alternatives --get-selections] successful.\" >> ${var_logfile}
fi
echo +++ >> ${var_logfile}
"