umorpha-boxes/modules/sshd.sh

19 lines
431 B
Bash

#!/hint/bash -euE
# Copyright (C) 2023 Umorpha Systems
# SPDX-License-Identifier: AGPL-3.0-or-later
packages+=(openssh)
post_install+=(01: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
PasswordAuthentication no
PermitRootLogin no
AllowGroups users
EOF
systemctl --root="$arg_mountpoint" enable sshd.service
}