V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 54s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 54s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -30,12 +30,12 @@ write_fstab() {
|
||||
|
||||
if [[ "${write_maps}" =~ ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}$ ]] || [[ "${write_maps}" =~ ^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$ ]]; then
|
||||
|
||||
printf "%-43s%-28s%-8s%-74s0 %s\n" "UUID=${write_maps}" "${write_path}" "${write_type}" "${write_opts}" "${write_pass}" >> "${TARGET}/etc/fstab"
|
||||
printf "%-43s%-28s%-8s%-100s0 %s\n" "UUID=${write_maps}" "${write_path}" "${write_type}" "${write_opts}" "${write_pass}" >> "${TARGET}/etc/fstab"
|
||||
do_log "info" "file_only" "4040() fstab entry generated: [UUID=${write_maps} ${write_path} ${write_type} ${write_opts} 0 ${write_pass}]."
|
||||
|
||||
elif [[ "${write_maps}" == /dev/mapper/* ]]; then
|
||||
|
||||
printf "%-43s%-28s%-8s%-74s0 %s\n" "${write_maps}" "${write_path}" "${write_type}" "${write_opts}" "${write_pass}" >> "${TARGET}/etc/fstab"
|
||||
printf "%-43s%-28s%-8s%-100s0 %s\n" "${write_maps}" "${write_path}" "${write_type}" "${write_opts}" "${write_pass}" >> "${TARGET}/etc/fstab"
|
||||
do_log "info" "file_only" "4040() fstab entry generated: [${write_maps} ${write_path} ${write_type} ${write_opts} 0 ${write_pass}]."
|
||||
|
||||
fi
|
||||
@@ -67,7 +67,7 @@ generate_fstab() {
|
||||
: >| "${TARGET}/etc/fstab"
|
||||
chmod 0600 "${TARGET}/etc/fstab"
|
||||
|
||||
cat << 'EOF' >> "${TARGET}/etc/fstab"
|
||||
cat << "EOF" >> "${TARGET}/etc/fstab"
|
||||
# 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
|
||||
@@ -79,6 +79,8 @@ generate_fstab() {
|
||||
# SPDX-PackageName: CISS.debian.installer
|
||||
# SPDX-Security-Contact: security@coresecret.eu
|
||||
|
||||
# CISS.debian.installer ${VAR_VERSION}
|
||||
|
||||
# Static file system information '/etc/fstab'.
|
||||
#
|
||||
# Use 'blkid' to print the universally unique identifier for a device; this may be used with [UUID=] as a more robust way to
|
||||
@@ -87,20 +89,7 @@ generate_fstab() {
|
||||
# 'systemd' generates mount units based on this file. See systemd.mount(5). Please run 'systemctl daemon-reload' after making
|
||||
# changes here.
|
||||
#
|
||||
# <file system UUID> <mount point> <type> <options> <dump> <pass>
|
||||
|
||||
### Secure tmpfs mounts for a hardened system
|
||||
|
||||
# Mount the proc filesystem to provide process and kernel information
|
||||
proc /proc proc nodev,nosuid,noexec,hidepid=2 0 0
|
||||
# Mount sysfs to expose kernel device information to user space
|
||||
sysfs /sys sysfs defaults 0 0
|
||||
# Mount the devpts filesystem to enable pseudo-terminal support for user sessions
|
||||
devpts /dev/pts devpts gid=5,mode=620 0 0
|
||||
# Restrict /dev/shm to shared memory, limit size, prevent code execution
|
||||
tmpfs /dev/shm tmpfs rw,nodev,noexec,nosuid,relatime,size=1G 0 0
|
||||
# System runtime directory in RAM; do not set noexec here for compatibility
|
||||
tmpfs /run tmpfs mode=0755,nodev,nosuid 0 0
|
||||
# <file system UUID> <mount point> <type> <options> <dump> <pass>
|
||||
|
||||
EOF
|
||||
|
||||
@@ -109,15 +98,7 @@ EOF
|
||||
|
||||
case "${var_path,,}" in
|
||||
|
||||
swap)
|
||||
|
||||
var_dmapper="${HMP_EPHEMERAL_ENCLABEL["${var_path}"]}"
|
||||
var_fs_uuid="/dev/mapper/${var_dmapper}"
|
||||
var_fs_path="none"
|
||||
var_fs_type="swap"
|
||||
var_fs_opts="defaults"
|
||||
var_fs_pass="0"
|
||||
;;
|
||||
swap|SWAP) continue;;
|
||||
|
||||
/tmp)
|
||||
|
||||
@@ -172,23 +153,53 @@ EOF
|
||||
|
||||
done
|
||||
|
||||
### Generate separate SWAP entry.
|
||||
var_dmapper="${HMP_EPHEMERAL_ENCLABEL["SWAP"]}"
|
||||
var_fs_uuid="/dev/mapper/${var_dmapper}"
|
||||
var_fs_path="none"
|
||||
var_fs_type="swap"
|
||||
var_fs_opts="defaults"
|
||||
var_fs_pass="0"
|
||||
write_fstab "${var_fs_uuid}" "${var_fs_path}" "${var_fs_type}" "${var_fs_opts}" "${var_fs_pass}"
|
||||
|
||||
cat << 'EOF' >> "${TARGET}/etc/fstab"
|
||||
|
||||
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
|
||||
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
|
||||
|
||||
EOF
|
||||
do_log "info" "file_only" "fstab entry generated: '/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0'."
|
||||
|
||||
cat << 'EOF' >> "${TARGET}/etc/fstab"
|
||||
### Secure tmpfs mounts for a hardened system
|
||||
|
||||
# Mount the proc filesystem to provide process and kernel information
|
||||
proc /proc proc nodev,nosuid,noexec,hidepid=2 0 0
|
||||
# Mount sysfs to expose kernel device information to user space
|
||||
sysfs /sys sysfs defaults 0 0
|
||||
# Mount the devpts filesystem to enable pseudo-terminal support for user sessions
|
||||
devpts /dev/pts devpts gid=5,mode=620 0 0
|
||||
# Restrict /dev/shm to shared memory, limit size, prevent code execution
|
||||
tmpfs /dev/shm tmpfs rw,nodev,noexec,nosuid,relatime,size=1G 0 0
|
||||
# System runtime directory in RAM; do not set noexec here for compatibility
|
||||
tmpfs /run tmpfs mode=0755,nodev,nosuid 0 0
|
||||
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=192 ft=sh
|
||||
EOF
|
||||
|
||||
: >| "${DIR_LOG}/fstab.verify.log"
|
||||
chmod 0600 "${DIR_LOG}/fstab.verify.log"
|
||||
|
||||
do_in_target_script "${TARGET}" 'systemd-analyze verify /etc/fstab' >> "${DIR_LOG}/fstab.verify.log" 2>&1
|
||||
do_in_target_script "${TARGET}" "systemd-analyze verify /etc/fstab >> ${DIR_LOG}/fstab.verify.log" 2>&1
|
||||
rc="$?"
|
||||
|
||||
if (( rc == 0 )); then
|
||||
|
||||
do_log "info" "file_only" "4040() '/etc/fstab' verified successfully with systemd-analyze."
|
||||
|
||||
else
|
||||
|
||||
do_log "warning" "file_only" "4040() '/etc/fstab' verification returned errors — see '${DIR_LOG}/fstab.verify.log'."
|
||||
|
||||
fi
|
||||
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user