V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 38s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 38s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -15,27 +15,27 @@ guard_sourcing
|
||||
#######################################
|
||||
# Wrapper around 'printf' for clean code.
|
||||
# Globals:
|
||||
# C_RES
|
||||
# RES
|
||||
# Arguments:
|
||||
# 1: One of "${C_BLA}" | "${C_RED}" | "${C_GRE}" | "${C_YEL}" | "${C_BLU}" | "${C_MAG}" | "${C_CYA}" | "${C_WHI}"
|
||||
# 1: One of "${BLA}" | "${RED}" | "${GRE}" | "${YEL}" | "${BLU}" | "${MAG}" | "${CYA}" | "${WHI}"
|
||||
# 2: Text string to print on terminal.
|
||||
#######################################
|
||||
do_print_color() {
|
||||
printf "%s\n" "${1}${2}${C_RES}"
|
||||
printf "%s\n" "${1}${2}${RES}"
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Wrapper around 'printf' for clean, uniform terminal output and line fold for long text strings for better readability.
|
||||
# Globals:
|
||||
# C_RES
|
||||
# RES
|
||||
# Arguments:
|
||||
# 1: One of "${C_BLA}" | "${C_RED}" | "${C_GRE}" | "${C_YEL}" | "${C_BLU}" | "${C_MAG}" | "${C_CYA}" | "${C_WHI}"
|
||||
# 1: One of "${BLA}" | "${RED}" | "${GRE}" | "${YEL}" | "${BLU}" | "${MAG}" | "${CYA}" | "${WHI}"
|
||||
# 2: Text string to print on terminal.
|
||||
#######################################
|
||||
do_print_fold() {
|
||||
declare var_color="$1"; shift
|
||||
declare var_msg_string="$*"
|
||||
declare var_formatted_string="${var_color}${var_msg_string}${C_RES}"
|
||||
declare var_formatted_string="${var_color}${var_msg_string}${RES}"
|
||||
printf "%b\n" "${var_formatted_string}" | fold -s -w 76 | sed '1! s/^/ /'
|
||||
}
|
||||
|
||||
|
||||
@@ -49,23 +49,23 @@ do_should_log() {
|
||||
#######################################
|
||||
# Log level color retriever.
|
||||
# Globals:
|
||||
# C_BLU
|
||||
# BLU
|
||||
# C_GRN
|
||||
# C_MAG
|
||||
# C_RED
|
||||
# C_WHI
|
||||
# C_YEL
|
||||
# MAG
|
||||
# RED
|
||||
# WHI
|
||||
# YEL
|
||||
# Arguments:
|
||||
# 1: "${LOG_LEVEL}" one of: "debug" | "info" | "notice" | "warn" | "error" | "critical" | "fatal" | "emergency"
|
||||
#######################################
|
||||
do_get_log_color() {
|
||||
case "${1,,}" in
|
||||
debug) echo "${C_WHI}" ;;
|
||||
debug) echo "${WHI}" ;;
|
||||
info) echo "${C_GRN}" ;;
|
||||
notice) echo "${C_YEL}" ;;
|
||||
warn | error | critical) echo "${C_RED}" ;;
|
||||
fatal | emergency) echo "${C_MAG}" ;;
|
||||
*) echo "${C_BLU}" ;;
|
||||
notice) echo "${YEL}" ;;
|
||||
warn | error | critical) echo "${RED}" ;;
|
||||
fatal | emergency) echo "${MAG}" ;;
|
||||
*) echo "${BLU}" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
@@ -12,15 +12,12 @@
|
||||
|
||||
guard_sourcing
|
||||
|
||||
# Setup sudo user account
|
||||
#######################################
|
||||
# Setup sudo.
|
||||
# Arguments:
|
||||
# None
|
||||
#######################################
|
||||
setup_sudo() {
|
||||
|
||||
|
||||
if [[ ${accounts_user_login,,} == "true" ]]; then
|
||||
do_in_target "${TARGET}" /bin/bash -c "apt-get install -y sudo && usermod -aG sudo ${accounts_user_name}"
|
||||
do_log "info" "false" "Command: 'apt-get install -y sudo && usermod -aG sudo ${accounts_user_name}' executed in: '${TARGET}'."
|
||||
fi
|
||||
|
||||
|
||||
return 0
|
||||
}
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
|
||||
60
func/4230_setup_chrony.sh
Normal file
60
func/4230_setup_chrony.sh
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
# 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
|
||||
|
||||
guard_sourcing
|
||||
|
||||
#######################################
|
||||
# Setup chrony NTPSec client.
|
||||
# Globals:
|
||||
# ARY_NTPSRVR
|
||||
# DIR_BAK
|
||||
# NL
|
||||
# TARGET
|
||||
# VAR_SETUP_PATH
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# 0: on success
|
||||
#######################################
|
||||
setup_chrony() {
|
||||
# shellcheck disable=SC2155
|
||||
declare var_of="$(mktemp --tmpdir --mode=0600 /tmp/var_of.XXXXXXXX)"
|
||||
declare var_ntp_server
|
||||
|
||||
for var_ntp_server in "${ARY_NTPSRVR[@]}"; do
|
||||
printf "server %s iburst nts minpoll 5 maxpoll 9 %s" "${var_ntp_server}" "${NL}" >> "${var_of}"
|
||||
done
|
||||
printf "# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh %s" "${NL}" >> "${var_of}"
|
||||
|
||||
# do_remove_service "systemd-timesyncd.service" "systemd-timesyncd"
|
||||
|
||||
mkdir -p "${TARGET}/var/log/chrony"
|
||||
do_in_target "${TARGET}" apt-get install chrony -y
|
||||
|
||||
if [[ ! -e "${TARGET}/etc/systemd/system/multi-user.target.wants/chrony.service" ]]; then
|
||||
ln -s "${TARGET}/lib/systemd/system/chrony.service" "${TARGET}/etc/systemd/system/multi-user.target.wants/chrony.service"
|
||||
fi
|
||||
|
||||
mkdir -p "${DIR_BAK}/etc/chrony"
|
||||
mv "${TARGET}/etc/chrony/chrony.conf" "${DIR_BAK}/etc/chrony/chrony.conf.bak"
|
||||
|
||||
install -D -m 0644 -o root -g root "${VAR_SETUP_PATH}/includes/etc/chrony/chrony.cnf" "${TARGET}/etc/chrony/chrony.conf"
|
||||
cat "${var_of}" >> "${TARGET}/etc/chrony/chrony.conf"
|
||||
|
||||
do_log "info" "false" "Chrony NTPsec client installed."
|
||||
|
||||
rm -f "${var_of}"
|
||||
unset var_of
|
||||
|
||||
return 0
|
||||
}
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
Reference in New Issue
Block a user