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

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-11-07 20:46:09 +01:00
parent f797c16278
commit f4cec85f7f
10 changed files with 72 additions and 73 deletions

44
lib/lib_check_secrets.sh Normal file
View File

@@ -0,0 +1,44 @@
#!/bin/bash
# SPDX-Version: 3.0
# SPDX-CreationInfo: 2025-05-05; WEIDNER, Marc S.; <msw@coresecret.dev>
# SPDX-ExternalRef: GIT https://git.coresecret.dev/msw/CISS.debian.live.builder.git
# SPDX-FileContributor: WEIDNER, Marc S.; Centurion Intelligence Consulting Agency
# SPDX-FileCopyrightText: 2024-2025; WEIDNER, Marc S.; <msw@coresecret.dev>
# SPDX-FileType: SOURCE
# SPDX-License-Identifier: EUPL-1.2 OR LicenseRef-CCLA-1.0
# SPDX-LicenseComment: This file is part of the CISS.debian.installer.secure framework.
# SPDX-PackageName: CISS.debian.live.builder
# SPDX-Security-Contact: security@coresecret.eu
guard_sourcing || return "${ERR_GUARD_SRCE}"
#######################################
# Removes secrets securely before 'lb build' execution.
# Globals:
# BASH_SOURCE
# VAR_TMP_SECRET
# Arguments:
# None
# Returns:
# 0: on success
#######################################
x_remove() {
printf "\e[95m++++ ++++ ++++ ++++ ++++ ++++ ++ 🧪 %s starting ... \e[0m\n" "${BASH_SOURCE[0]}"
shopt -s nullglob dotglob
### Removes secrets securely.
# shellcheck disable=SC2312
find "${VAR_TMP_SECRET}" -xdev -type f -print0 | xargs -0 --no-run-if-empty shred -fzu -n 5 --
find "${VAR_TMP_SECRET}" -xdev -depth -type d -empty -delete
shopt -u nullglob dotglob
printf "\e[92m++++ ++++ ++++ ++++ ++++ ++++ ++ ✅ %s successfully applied. \e[0m\n" "${BASH_SOURCE[0]}"
return 0
}
### Prevents accidental 'unset -f'.
# shellcheck disable=SC2034
readonly -f x_remove
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh

View File

@@ -39,19 +39,19 @@ clean_up() {
rm -f -- "${VAR_KERNEL_TMP}"
rm -f -- "${VAR_NOTES}"
# Release advisory lock on FD 127.
### Release advisory lock on FD 127.
flock -u 127
# Close file descriptor 127.
### Close file descriptor 127.
exec 127>&-
# Remove the lockfile artifact.
### Remove the lockfile artifact.
rm -f /run/lock/ciss_live_builder.lock
# Removes the error log on clean exit.
### Removes the error log on clean exit.
if (( clean_exit_code == 0 )); then rm -f -- "${LOG_ERROR}"; fi
# Cleaning TCP wrapper artifacts.
### Cleaning TCP wrapper artifacts.
if [[ -f "${VAR_WORKDIR}/hosts.allow" ]]; then
rm -f "${VAR_WORKDIR}/hosts.allow"
fi
@@ -59,7 +59,7 @@ clean_up() {
rm -f "${VAR_WORKDIR}/hosts.deny"
fi
# Kill gpg-agent and remove artifacts securely.
### Kill gpg-agent and remove artifacts securely.
if [[ ! "${VAR_CDLB_INSIDE_RUNNER}" == "true" ]]; then
if [[ -n "${GNUPGHOME:-}" && -d "${GNUPGHOME}" ]]; then
@@ -85,7 +85,7 @@ clean_up() {
fi
# Removes secrets securely.
### Removes secrets securely.
# shellcheck disable=SC2312
find "${VAR_TMP_SECRET}" -xdev -type f -print0 | xargs -0 --no-run-if-empty shred -fzu -n 5 --
find "${VAR_TMP_SECRET}" -xdev -depth -type d -empty -delete

View File

@@ -75,13 +75,13 @@ hardening_ultra() {
if [[ ! -d "${VAR_HANDLER_BUILD_DIR}/config/includes.chroot" ]]; then
mkdir -p "${VAR_HANDLER_BUILD_DIR}/config/includes.chroot"
rsync -aHAX --delete ./config/includes.chroot/ "${VAR_HANDLER_BUILD_DIR}/config/includes.chroot/"
cp -af ./config/includes.chroot/ "${VAR_HANDLER_BUILD_DIR}/config/includes.chroot/"
chmod 0755 ./config/includes.chroot/etc/ciss/keys
chmod 0444 ./config/includes.chroot/etc/ciss/keys/*
else
rsync -aHAX --delete ./config/includes.chroot/ "${VAR_HANDLER_BUILD_DIR}/config/includes.chroot/"
cp -af ./config/includes.chroot/ "${VAR_HANDLER_BUILD_DIR}/config/includes.chroot/"
chmod 0755 ./config/includes.chroot/etc/ciss/keys
chmod 0444 ./config/includes.chroot/etc/ciss/keys/*

View File

@@ -70,9 +70,9 @@ export CDLB_VERSION="${VAR_VERSION}"
export CDLB_GIT_REL="${VAR_GIT_REL}"
export CDLB_CR_DATE="${VAR_DATE_INFO}"
export CDLB_CR_HOST="${VAR_HOST}"
export CDLB_BASHVER="${VAR_VER_BASH}"
export CDLB_DS_VER="${VAR_VER_DS}"
export CDLB_LB_VER="${VAR_VER_LB}"
export CDLB_VER_BASH="${VAR_VER_BASH}"
export CDLB_VER_DS="${VAR_VER_DS}"
export CDLB_VER_LB="${VAR_VER_LB}"
export CDLB_SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH}"
EOF
chmod 0444 "${VAR_HANDLER_BUILD_DIR}/config/includes.chroot/root/ciss-debian-live-builder.env"

View File

@@ -73,8 +73,6 @@ init_primordial() {
fi
printf "\e[92m++++ ++++ ++++ ++++ ++++ ++++ ++ ✅ %s successfully applied. \e[0m\n" "${BASH_SOURCE[0]}"
return 0

View File

@@ -167,13 +167,13 @@ readonly -f print_scr_err
trap_on_err() {
trap - DEBUG ERR INT TERM
declare -g ERRCODE="$1"
declare -g ERRSCRT="$2"
declare -g ERRLINE="$3"
declare -g ERRFUNC="$4"
declare -g ERRCMMD="$5"
declare -gx ERRCODE="$1"
declare -gx ERRSCRT="$2"
declare -gx ERRLINE="$3"
declare -gx ERRFUNC="$4"
declare -gx ERRCMMD="$5"
# shellcheck disable=SC2034
declare -g ERRTRAP="true"
declare -gx ERRTRAP="true"
if "${VAR_EARLY_DEBUG}"; then dump_user_vars; fi