V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 53s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 53s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -13,15 +13,62 @@
|
||||
guard_sourcing
|
||||
|
||||
#######################################
|
||||
#
|
||||
# Hardening accounts: Google TOTP, Wordlists, masking ttys, expiration of accounts.
|
||||
# Globals:
|
||||
# TARGET
|
||||
# VAR_SETUP_PATH
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# 0: on success
|
||||
#######################################
|
||||
accounts_hardening() {
|
||||
### Declare Arrays, HashMaps, and Variables.
|
||||
declare -a ary_security_pkgs=()
|
||||
declare -r var_logfile="/root/.ciss/cdi/log/4510_accounts_hardening.log"
|
||||
declare t=""
|
||||
|
||||
chroot_logger "${TARGET}${var_logfile}"
|
||||
|
||||
### Installing Google TOTP, Wordlists.
|
||||
ary_security_pkgs=( "libpam-google-authenticator" "wamerican" "wbritish" "wfrench" "wngerman" )
|
||||
chroot_script "${TARGET}" "
|
||||
export INITRD=No
|
||||
apt-get install -y --no-install-recommends --no-install-suggests ${ary_security_pkgs[*]} 2>&1 | tee -a ${var_logfile}
|
||||
echo ExitCode: \$? >> ${var_logfile}
|
||||
"
|
||||
|
||||
### Keep 'tty1' active, disable the rest (VTs).
|
||||
chroot_script "${TARGET}" "
|
||||
systemctl unmask getty@tty1.service
|
||||
systemctl enable getty@tty1.service
|
||||
for t in tty2 tty3 tty4 tty5 tty6; do
|
||||
systemctl mask getty@${t}.service
|
||||
done
|
||||
"
|
||||
|
||||
### Hardening '/etc/login.defs'.
|
||||
mv "${TARGET}/etc/login.defs" "${TARGET}/root/.ciss/cdi/backup/etc/login.defs.bak"
|
||||
insert_header "${TARGET}/etc/login.defs"
|
||||
insert_comments "${TARGET}/etc/login.defs"
|
||||
cat "${VAR_SETUP_PATH}/includes/target/etc/login.defs" >> "${TARGET}/etc/login.defs"
|
||||
|
||||
### Hardening '/etc/security/pwquality.conf'.
|
||||
mkdir -p "${TARGET}/root/.ciss/cdi/backup/etc/security"
|
||||
mv "${TARGET}/etc/security/pwquality.conf" "${TARGET}/root/.ciss/cdi/backup/etc/security/pwquality.conf.bak"
|
||||
insert_header "${TARGET}/etc/security/pwquality.conf"
|
||||
insert_comments "${TARGET}/etc/security/pwquality.conf"
|
||||
cat "${VAR_SETUP_PATH}/includes/target/etc/security/pwquality.cnf" >> "${TARGET}/etc/security/pwquality.conf"
|
||||
|
||||
### Hardening password expiration; defaults to 16,384 days.
|
||||
install -m 0700 -o root -g root "${VAR_SETUP_PATH}/includes/chroot/hooks/4510_password_expiration.hooks.sh" \
|
||||
"${TARGET}/root/.ciss/cdi/hooks/4510_password_expiration.hooks.sh"
|
||||
|
||||
if ! chroot_script "${TARGET}" "/root/.ciss/cdi/hooks/4510_password_expiration.hooks.sh" "emergency"; then
|
||||
do_log "warn" "file_only" "4510() Command: [chroot_script ${TARGET} /root/.ciss/cdi/hooks/4510_password_expiration.hooks.sh emergency] failed."
|
||||
else
|
||||
do_log "debug" "file_only" "4510() Command: [chroot_script ${TARGET} /root/.ciss/cdi/hooks/4510_password_expiration.hooks.sh emergency] successful."
|
||||
fi
|
||||
|
||||
guard_dir && return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user