V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m59s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m59s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -15,26 +15,29 @@ guard_sourcing || return "${ERR_GUARD_SOURCE}"
|
||||
#######################################
|
||||
# Append the GRUB superuser block to '/etc/grub.d/40_custom'.
|
||||
# Globals:
|
||||
# DIR_CNF
|
||||
# CISS_SECRET_GRUB
|
||||
# TARGET
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# 0: on success
|
||||
# ERR_READ_GRUB_FILE
|
||||
# ERR_READ_GRUB_FILE: on failure
|
||||
#######################################
|
||||
update_grub_password() {
|
||||
### Declare Arrays, HashMaps, and Variables.
|
||||
declare var_username="superadmin" var_password="" var_password_file="${DIR_CNF}/password_grub.txt" \
|
||||
declare var_username="superadmin" var_password="" \
|
||||
var_of="${TARGET}/etc/grub.d/40_custom" var_grub_entry=""
|
||||
|
||||
### SECRETS handling ---------------------------------------------------------------------------------------------------------
|
||||
guard_trace on
|
||||
|
||||
var_password=$(<"${var_password_file}") || return "${ERR_READ_GRUB_FILE}"
|
||||
var_password="${CISS_SECRET_GRUB}" || return "${ERR_READ_GRUB_FILE}"
|
||||
unset CISS_SECRET_GRUB
|
||||
|
||||
var_grub_entry=$(generate_grub_password_pbkdf2 "${var_username}" "${var_password}")
|
||||
|
||||
guard_trace off
|
||||
### SECRETS handling ---------------------------------------------------------------------------------------------------------
|
||||
|
||||
### Append if not already present.
|
||||
if ! grep -q "set superusers=" "${var_of}"; then
|
||||
@@ -56,6 +59,8 @@ readonly -f update_grub_password
|
||||
|
||||
#######################################
|
||||
# Generate PBKDF2 password hash for GRUB.
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# 1: Username (default to superadmin).
|
||||
# 2: User password.
|
||||
|
||||
Reference in New Issue
Block a user