V8.00.000.2025.06.17

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-07-17 13:42:37 +02:00
parent 81bcb407fd
commit 6a67646fb6
18 changed files with 239 additions and 213 deletions

View File

@@ -32,7 +32,13 @@ guard_sourcing
setup_ssh() {
do_in_target "${TARGET}" apt-get install -y ssh
rm -rf "${TARGET}/etc/ssh/ssh_host_*key*"
declare -a ary_user=()
ary_user+=("${user_user0_name}")
[[ -v "${user_user1_name}" ]] && ary_user+=("${user_user1_name}")
[[ -v "${user_user2_name}" ]] && ary_user+=("${user_user2_name}")
[[ -v "${user_user3_name}" ]] && ary_user+=("${user_user3_name}")
rm -rf "${TARGET}"/etc/ssh/ssh_host_*key*
do_in_target "${TARGET}" ssh-keygen -o -N "" -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -C "root@${VAR_FINAL_FQDN}-$(date -I)"
do_log "info" "true" "Generated ed25519 SSH Key, executed in: '${TARGET}'."
@@ -47,7 +53,7 @@ setup_ssh() {
cp "${TARGET}/etc/ssh/ssh_config" "${DIR_BAK}/etc/ssh/ssh_config.bak"
chmod 0644 "${DIR_BAK}/etc/ssh/ssh_config.bak"
rm "${TARGET}/etc/ssh/sshd_config"
rm -f "${TARGET}/etc/ssh/sshd_config"
cp "${VAR_SETUP_PATH}/includes/etc/ssh/sshd_config" "${TARGET}/etc/ssh/sshd_config"
chmod 0600 "${TARGET}/etc/ssh/sshd_config"
@@ -63,12 +69,17 @@ setup_ssh() {
sed -i "s/Port MUST_BE_CHANGED/Port ${user_ssh_port}/" "${TARGET}/etc/ssh/sshd_config"
if [[ -n "${user_user0_name,,}" ]]; then
sed -i "s/AllowUsers root/AllowUsers root ${user_user0_name}/" "${TARGET}/etc/ssh/sshd_config"
if [[ -n "${user_user0_name}" ]]; then
sed -i "s/AllowUsers root/AllowUsers root ${ary_user[*]}/" "${TARGET}/etc/ssh/sshd_config"
fi
do_in_target "${TARGET}" sshd -T >| "${DIR_LOG}/sshd_config.log"
do_in_target "${TARGET}" ssh-keygen -r "${VAR_FINAL_FQDN}." >| "${DIR_LOG}/ssh.log"
if [[ -n "${user_ssh_rootca}" ]]; then
install -D -m 0644 -o root -g root "${VAR_SETUP_PATH}${user_ssh_rootca}" "${TARGET}/etc/ssh/"
sed -i "s/TrustedUserCAKeys none/TrustedUserCAKeys \/etc\/ssh\/${user_ssh_rootca}/" "${TARGET}/etc/ssh/sshd_config"
fi
do_in_target_script "${TARGET}" "sshd -T >| ${DIR_LOG}/sshd_config.log"
do_in_target_script "${TARGET}" "ssh-keygen -r ${VAR_FINAL_FQDN}. >| ${DIR_LOG}/ssh.log"
###########################################################################################
# The file /etc/profile.d/idle-users.sh is created to set two read-only #