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

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-09-03 17:16:22 +02:00
parent 4624eb58cc
commit 3c5f78d2eb
5 changed files with 27 additions and 16 deletions

View File

@@ -260,7 +260,7 @@ fi)\
#######################################
read_passphrase() {
declare -i ROUNDS=0
declare CAND="" SALT="" _FULL_SALT=""
declare CAND="" SALT=""
### Read from SSH STDIN (or TTY fallback), never via '/lib/cryptsetup/askpass'.
ask_via_stdin "Enter passphrase: " PASSPHRASE
@@ -274,7 +274,7 @@ read_passphrase() {
ROUNDS="$(cut -d'$' -f3 <<< "${NUKE_HASH}")"
ROUNDS="${ROUNDS#rounds=}"
SALT="$(cut -d'$' -f4 <<< "${NUKE_HASH}")"
CAND=$(/usr/bin/mkpasswd --method=sha-512 --salt="${SALT}" --rounds="${ROUNDS}" "${PASSPHRASE}")
CAND=$(/usr/mkpasswd --method=sha-512 --salt="${SALT}" --rounds="${ROUNDS}" "${PASSPHRASE}")
# TODO: DEBUGGER
echo "ROUNDS : ${ROUNDS}"

View File

@@ -28,27 +28,37 @@ if [ ! -e /etc/initramfs-tools/files/unlock_wrapper.sh ]; then
fi
### Ensure directory structure in initramfs
mkdir -p "${DESTDIR}/usr/bin"
mkdir -p "${DESTDIR}/etc/dropbear/initramfs"
mkdir -p "${DESTDIR}/etc/keys"
mkdir -p "${DESTDIR}/usr/local/bin"
mkdir -p "${DESTDIR}/etc/initramfs-tools/conf.d"
mkdir -p "${DESTDIR}/etc/initramfs-tools/scripts/init-premount"
mkdir -p "${DESTDIR}/usr/sbin"
### Include Bash
### Include bash
copy_exec /usr/bin/bash /usr/bin/bash
printf "\e[92mSuccessfully executed: [copy_exec /usr/bin/bash /usr/bin/bash] \n\e[0m"
### Include Busybox
copy_exec /usr/bin/busybox /usr/bin/busybox
printf "\e[92mSuccessfully executed: [copy_exec /usr/bin/busybox /usr/bin/busybox] \n\e[0m"
### Include blkid
copy_exec /usr/sbin/blkid /usr/sbin/blkid
printf "\e[92mSuccessfully executed: [copy_exec /usr/sbin/blkid /usr/sbin/blkid] \n\e[0m"
### Include lsblk (block device info tool)
### Include busybox
copy_exec /usr/bin/busybox /usr/busybox
printf "\e[92mSuccessfully executed: [copy_exec /usr/bin/busybox /usr/busybox] \n\e[0m"
### Include gpgv
copy_exec /usr/bin/gpgv /usr/bin/gpgv
printf "\e[92mSuccessfully executed: [copy_exec /usr/bin/gpgv /usr/bin/gpgv] \n\e[0m"
### Include lsblk
copy_exec /usr/bin/lsblk /usr/bin/lsblk
printf "\e[92mSuccessfully executed: [copy_exec /usr/bin/lsblk /usr/bin/lsblk] \n\e[0m"
### Include mkpasswd
copy_exec /usr/bin/mkpasswd /usr/bin/mkpasswd
printf "\e[92mSuccessfully executed: [copy_exec /usr/bin/mkpasswd /usr/bin/mkpasswd] \n\e[0m"
copy_exec /usr/bin/mkpasswd /usr/mkpasswd
printf "\e[92mSuccessfully executed: [copy_exec /usr/bin/mkpasswd /usr/mkpasswd] \n\e[0m"
### Include udevadm (udev management tool)
copy_exec /usr/bin/udevadm /usr/bin/udevadm
@@ -56,15 +66,15 @@ printf "\e[92mSuccessfully executed: [copy_exec /usr/bin/udevadm /usr/bin/udevad
### Include sha384sum, sha512sum
copy_exec /usr/bin/sha384sum /usr/bin/sha384sum
printf "\e[92mSuccessfully executed: [copy_exec /usr/bin/sha384sum /usr/bin/sha384sum] \n\e[0m"
printf "\e[92mSuccessfully executed: [copy_exec /usr/bin/sha384sum /usr/bin/sha384sum ] \n\e[0m"
copy_exec /usr/bin/sha512sum /usr/bin/sha512sum
printf "\e[92mSuccessfully executed: [copy_exec /usr/bin/sha512sum /usr/bin/sha512sum] \n\e[0m"
### Include GPGV
copy_exec /usr/bin/gpgv /usr/bin/gpgv
printf "\e[92mSuccessfully executed: [copy_exec /usr/bin/gpgv /usr/bin/gpgv] \n\e[0m"
### Include tree
copy_exec /usr/bin/tree /usr/bin/tree
printf "\e[92mSuccessfully executed: [copy_exec /usr/bin/tree /usr/bin/tree] \n\e[0m"
### Include Whois
### Include whois
copy_exec /usr/bin/whois /usr/bin/whois
printf "\e[92mSuccessfully executed: [copy_exec /usr/bin/whois /usr/bin/whois] \n\e[0m"

View File

@@ -1,72 +0,0 @@
#!/bin/sh
# SPDX-Version: 3.0
# SPDX-CreationInfo: 2025-06-17; WEIDNER, Marc S.; <msw@coresecret.dev>
# SPDX-ExternalRef: GIT https://git.coresecret.dev/msw/CISS.debian.installer.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.installer
# SPDX-Security-Contact: security@coresecret.eu
# SPDX-Comment: Enforce merged-/usr symlinks inside the initramfs image.
set -e
PREREQ=""
prereqs() { echo "${PREREQ}"; }
case "${1}" in
prereqs) prereqs; exit 0 ;;
esac
. /usr/share/initramfs-tools/hook-functions
### Ensure target directories exist in the future initramfs root.
mkdir -p "${DESTDIR}/usr/bin" "${DESTDIR}/usr/sbin" "${DESTDIR}/usr/lib"
### /lib64 may or may not exist depending on arch; create if present on the host system.
# shellcheck disable=2292
[ -d "${DESTDIR}/usr/lib64" ] || mkdir -p "${DESTDIR}/usr/lib64" 2>/dev/null || true
# shellcheck disable=2292
move_dir_into_usr() {
### $1: top-level name (bin|sbin|lib|lib64)
### Moves all contents of /$1 into /usr/$1 and removes /$1 if it was a directory.
### Then creates a symlink /$1 -> usr/$1
d="$1"
top="${DESTDIR}/${d}"
usr="${DESTDIR}/usr/${d}"
if [ -L "${top}" ]; then
### Already a symlink, so nothing to do.
return 0
fi
if [ -d "${top}" ]; then
### Copy including dotfiles; -a preserves perms/links if available (coreutils on build host).
### If 'cp -a' is unavailable, fallback to 'cp -rp'.
if cp -a "${top}/." "${usr}/" 2>/dev/null; then
:
else
cp -rp "${top}/." "${usr}/"
fi
### Remove the original directory tree, then replace with symlink
rm -rf "${top}"
fi
### Create (or refresh) the canonical symlink
ln -sfn "usr/${d}" "${top}"
return 0
}
move_dir_into_usr bin
move_dir_into_usr sbin
move_dir_into_usr lib
### /lib64 exists only on some arch images; harmless if empty
# shellcheck disable=2292
[ -d "${DESTDIR}/usr/lib64" ] && move_dir_into_usr lib64
printf "\e[92mSuccessfully executed: [/etc/initramfs-tools/hooks/9999-custom-usrmerge.sh] \n\e[0m"
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh

View File

@@ -19,6 +19,7 @@ case "${1}" in
esac
### Make sure /usr/local/bin is in front of 'PATH'.
export PATH="/usr/local/bin:${PATH:-/sbin:/usr/sbin:/bin:/usr/bin}"
#export PATH="/usr/local/bin:${PATH:-/sbin:/usr/sbin:/bin:/usr/bin}"
export PATH="/usr/local/bin:/usr:/sbin:/usr/sbin:/bin:/usr/bin"
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh