umorpha-boxes/modules/base-sshd.sh

22 lines
479 B
Bash

#!/hint/bash -euE
# Copyright (C) 2023 Umorpha Systems
# SPDX-License-Identifier: AGPL-3.0-or-later
packages+=(openssh)
post_install+=(20:sshd:post_install)
sshd:post_install() {
local arg_mountpoint=$1
install -Dm644 /dev/stdin "$arg_mountpoint/etc/ssh/sshd_config.d/90-umorpha.conf" <<-EOF
UsePAM yes
PasswordAuthentication no
KbdInteractiveAuthentication no
PermitRootLogin no
AllowGroups users
EOF
systemctl --root="$arg_mountpoint" enable sshd.service
}